Apple Photo (media) Picker

Ken Ray kray at sonsothunder.com
Fri Dec 9 16:47:55 EST 2011


First create the automate as Ken described and save it somewhere. In this
> case I saved it on y desktop.
> then in LC do the following
> 
> get shell ("automator '/Users/todd/Desktop/test.workflow'")
> 
> put value(line 2 of it)
> 
> 
> That should do it.

I didn't realize you could call Automator from shell()… so I revised it so you don't even need to save out a text file - just make a workflow that has a single Ask for Picture action, and then run it with shell(); loop through the lines and get the paths and you're done:

on mouseUp
  ChoosePicture
  put the result
end mouseUp

on ChoosePicture
  put specialFolderPath("desktop") & "/Choose Picture.workflow" into tWorkflowPath
  put shell("automator '" & tWorkflowPath & "'") into tResult
  put "" into tPaths
  repeat for each line tLine in tResult
    if tLine contains quote then
      get matchText(tLine,".*?\"(.*?)\"",tPath)
      put tPath into line (the number of lines of tPaths)+1 of tPaths
    end if
  end repeat
  return tPaths
end ChoosePicture

Thanks, Todd!


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/	




More information about the use-livecode mailing list