applescript - repeat if exists document x

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


the short explanation about Preview.app not playing well is that it  
has no dictionary or built-in scripting functions, but does play well  
with System Events, in that it is wired to interact properly.  Safari  
has both a rich scripting environment and the System Event interface.   
(System Events is handy for allowing interaction with java applets  
running inside the Safari browser that know nothing about OSX or  
Applescript.  Safari makes all the objects and strings available to  
System Events.  Pretty cool.)

The Rev dictionary has a couple functions that make paths easy

Syntax: revMacFromUnixPath(unixPathname[,convertOSX])
from "/" to ":" and converts the special root drive naming

Syntax: revUnixFromMacPath(macPathname[,convertOSX])
from ":" to "/" and converts the special root drive naming

Hope this helps

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