OK,
I know I can reveal a disk using code this:
tell application “Finder”
set fulldisk to " MHM-Files-" & “Row-your-Boat”
reveal disk fulldisk of application “Finder”
end tell
In Leopard, if you navigate to “Network”, you’ll see machines with sharing on. I’d like to do something similar to reveal a particular shared machine…however, I can’t find out how to do so from Googling or in the Finder AppleScript Dictionary.
Can anyone clue me in?
The only way I would know is to use gui scripting. Here’s how you can reveal a shared machine and then select one of the volumes on that shared machine.
set shareName to "g4"
set shareVolumeName to "Movies"
tell application "Finder"
activate
make new Finder window at front
end tell
tell application "System Events" to tell process "Finder"
-- select the share from the "Shared" section of a Finder window
select UI element shareName of list 1 of scroll area 1 of splitter group 1 of window 1
-- select a volume on that shared computer in a Finder window
select UI element shareVolumeName of list 1 of UI element 2 of scroll area 1 of scroll area 1 of browser 1 of splitter group 1 of window 1
end tell
OK,
here’s the solution, and I really wanted to stay away form GUI scripting, which just cannot be counted in all contexts.
tell application "Finder"
tell window 1
repeat with a from 1 to count items
if (displayed name of item a) = "iMac-G5" then
select item a
exit repeat
end if
end repeat
end tell
end tell
Many thanks to Ben Waldie for his assistance, and recognizing that the solution lay in the fact that I had registered the computer with Bonjour myself, and thus knew the name of the item (machine) in advance.