Apple Automator

Peter M. Brigham pmbrig at gmail.com
Fri Mar 4 10:13:50 EST 2016


On Mar 2, 2016, at 5:29 AM, Kay C Lan wrote:

> The final script for your button should look like this:
> 
> on mouseUp
> put "tell application " & quote & "Finder" & quote & cr & \
> "activate" & cr & \
> "open document file " & quote & "test.workflow" & quote & " of folder
> " & quote & "Documents" & quote & " of folder " & quote & "yourname" &
> quote & " of folder " & quote & "Users" & quote & " of startup disk" &
> cr & \
> "end tell" & cr & \
> "delay 2" & cr & \
> "tell application " & quote & "Automator" & quote & cr & \
> "execute workflow " & quote & "test.workflow" & quote & cr & \
> "end tell" into tScript
> 
> do tScript as "AppleScript"
> 
> end mouseUp

I use this as a way of constructing strings that contain quotes:


function qInString pStr, pAltChar
   -- use for creating strings that contain quotes
   --    eg, for constructing ask/answer dialogs, error messages, etc.
   -- default is to use "^" as quote placeholder, can be overridden
   -- eg,
   --    qInString("fld ^text^ of card ^apple^ of stack ^fruits^")
   -- returns:
   --    fld "text" of card "apple" of stack "fruits"
   -- shorter, and easier to proofread than
   --    put "fld" && quote & "text" & quote && "of card" && quote & "apple" \
      --        & quote && "of stack" && quote & "fruits" & quote into tStr
   --    from a handler on the Use-LC list
   
   if pAltChar = empty then put "^" into pAltChar
   replace pAltChar with quote in pStr
   return pStr
end qInString

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list