Reply to topic  [ 1 post ] 
Applescript advice for variables and other issues 
Author Message
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
After much consternation and experimentation I was able to get an Applescript to work properly. The Applescript sends my NWP text to MarsEdit blogging software for publishing. Here's the code:


Code:
$code = "
tell application \"MarsEdit\"
   activate
   set theSubj to \"$subject\"
   set theText to \"$text\"
   set theBlog to \"$blog\"
   make new document
   set the current blog of document 1 to blog theBlog
   tell document 1
      set body to theText
      set title to theSubj
   end tell
end tell"

$error = ""
$result = Run AppleScript $code, $error


The things to note are in order for your Nisus macro variables to expand (is that the correct word?) the entire block of Applescript code needs to be enclosed in double quotes with your variables placed between escaped double quotes. In the macro guide single quotes are used in the example - not that that is wrong, it just won't work for setting Applescript variables from Nisus macro variables. Also, I highly recommend that before setting your $text variable, select your entire document and run the Edit > Convert > Plain Quotes to Smart Quotes command on the text. Applescript doesn't like plain quotes and your script will error, but it doesn't mind smart quotes.

All the best
Lou


2011-06-05 13:35:35
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software