Re: Selecting a folder from the sidebar in a save dialog
Re: Selecting a folder from the sidebar in a save dialog
- Subject: Re: Selecting a folder from the sidebar in a save dialog
- From: <email@hidden>
- Date: Tue, 11 May 2010 23:52:32 +0000
- Sensitivity: Normal
Hi Jim,
I rushed through this, but this seemed to work for me on Snow Leopard when wanting to select "Desktop" from the sidebar:
--------
tell application "Safari" to activate
delay 2
tell application "System Events"
tell process "Safari"
set nameList to name of static text 1 of rows of outline 1 of scroll area 1 of splitter group 1 of group 2 of sheet 1 of window 1
repeat with x from 1 to (count nameList)
if item x of nameList is "Desktop" then
select row x of outline 1 of scroll area 1 of splitter group 1 of group 2 of sheet 1 of window 1
exit repeat
end if
end repeat
end tell
end tell
--------
I'm not a big fan of GUI scripting though. I'd recommend checking the OS version and then saving to the appropriate path depending on which OS is running. The code below should get the OS version for you:
--------
set osVersion to getOsVersion()
if osVersion is "10.6" then
return "it's Snow Leopard"
else if osVersion is "10.4" then
return "it's Tiger"
end if
on getOsVersion()
tell (system attribute "sysv")
set n to it mod 4096
-------
set a to it div 4096
set b to n div 256
set c to (n mod 256) div 16
-------
return (a & b & "." & c) as string
end tell
end getOsVersion
--------
Jay
--
> My primary computer is a G4 running Tiger 10.4.11. I have several
> scripts that open a URL in Safari and save the source of that page
> as a text file (with extension .HTML) so I can search the text using
> a text editor. I store the source in a folder that is shown in the
> sidebar of the save dialog and is clickable via GUI scripting using
> the following line:
> click button "To_Be_Sent" of list 1 of scroll area 1 of splitter group 1 of group 1 of sheet 1 of window w_Name
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden