OT Applescript utility for Photoshop

Jim Ault JimAultWins at yahoo.com
Sun Apr 15 14:58:10 EDT 2007


After receiving an Applescript question, I wrote two more utility scripts
that return to Rev a list of selected files.
Script 1 - Finder version
Script 2 - Path Finder version
Because of slightly different dictionaries, the scripts need to have a
couple variations.  Try them if you like since it is very simple to do.

Make a new mainstack, open the stack script, paste the following code and
apply.  If you do not have Path Finder, you will get an error when holding
down the optionKey.
(correct for line wrap if necessary, esp the one line that has "POSIX"  )

-------------------------------------start copy here
on mouseDoubleUp
  if the optionKey is down then
    pathFinderVer
  else
    finderVersion
  end if
end mouseDoubleUp

------------/////  Path Finder version ///////----------
on pathFinderVer
  put quote into q
  get "tell application "&q&"Path Finder"&q&cr
  get it & "set fileList to the selection as list"&cr
  get it & " set revList to "&q&q&cr
  get it & "    repeat with pathFN in fileList"&cr
  get it & "       set revList to revList & return & the POSIX path of
pathFN"&cr
  get it & "    end repeat"&cr
  get it & " end tell"&cr
  get it & " return revList as text"
  put it into cmd
  do cmd as Applescript
  put the result into listOfFinderItems
  --///note: Unix paths returned
  --value returned between quotes
  put char 2 to -2 of listOfFinderItems into listOfFinderItems
  --need to convert return chars to char 10 for Rev
  replace numtochar(13) with cr in listOfFinderItems
  filter listOfFinderItems without empty --purge blank lines
  
--  repeat for each line LNN in listOfFinderItems
--    put revUnixFromMacPath(LNN) & cr after newList
--  end repeat
  filter newList without empty
  put newList into msg
  put listOfFinderItems into msg

end pathFinderVer

------------/////  Finder version ///////----------
on finderVersion
  put quote into q
  get "tell application "&q&"Finder"&q&cr
  get it & "set fileList to the selection as list"&cr
  get it & " set revList to "&q&q&cr
  get it & "    repeat with pathFN in fileList"&cr
  get it & "       set revList to revList & return & pathFN"&cr
  get it & "    end repeat"&cr
  get it & " end tell"&cr
  get it & " return revList as text"
  put it into cmd
  do cmd as Applescript
  put the result into listOfFinderItems
  --///note: Mac paths returned
  --value returned between quotes
  put char 2 to -2 of listOfFinderItems into listOfFinderItems
  --need to convert return chars to char 10 for Rev
  replace numtochar(13) with cr in listOfFinderItems
  filter listOfFinderItems without empty --purge blank lines
  
  repeat for each line LNN in listOfFinderItems
    put revUnixFromMacPath(LNN) & cr after newList
  end repeat
  filter newList without empty
  put newList into msg
end finderVersion

--------------------------------- end copy






More information about the use-livecode mailing list