applescript - repeat if exists document x

Jim Ault jimaultwins at yahoo.com
Thu Mar 12 13:38:28 EDT 2009


AppleScript programming tip to make it a little more Rev-like

---------
set cr to return

tell application "System Events"
	get name of every window of application process "Preview"
end tell
set theList to the result
set output to ""

repeat with echItm in theList
	set output to output & cr & echItm
end repeat

return (characters 2 thru -1 of output as string)

Jim Ault
Las Vegas

On Mar 12, 2009, at 4:10 AM, Jim Sims wrote:

> Works slick for Keynote.
>
> A current issue I'm up against has been getting all this to also  
> work with Preview.app, for some reason Preview seems to not play  
> well with applescript. Seems that System Events has a better shot at  
> my goal.
>
> So, I changed direction a bit and am now going with:
>
> tell application "System Events"
> 	get name of every window of application process "Preview"
> end tell
> return the result
>
> Doing the above seems to require enabling access for assistive  
> devices, but that is not a problem.
>
> Thanks Bernd
>
>
> On Mar 12, 2009, at 11:55 AM, BNig wrote:
>> tell application "Keynote"
>> 	set docsPathes to the path of every slideshow
>> 	set PathOutput to ""
>> 	repeat with echItm in docsPathes
>> 		set PathOutput to PathOutput & echItm & return as string
>> 	end repeat
>>       -- take out the last return
>> 	set PathOutput to characters 1 through -2 of PathOutput as string
>> 	return PathOutput
>> end tell
>>
>> a return delimited list of the pathes, if a slideshow is open which  
>> is not
>> saved yet it returns missing value. on system 10.5.6 it returns the  
>> posix
>> form of the pathes (/xxx/xxx), older versions might return the mac- 
>> style
>> (xxx:xxx)
>> To return mulitple lists to Rev you can concatenate them into one  
>> list and
>> take them apart on the rev side or do multiple applescript calls.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list