Script that shows hidden ~snapshot folder on Filer on current location

Hello,

My colleque has build an Apple script under MacOs 10.6 that can be used by users to show the snapshot folder on our NetApp Filer on the current folder location of the user.
The script is not working under MacOs 10.7 and the person that made it has left the company.
When we use the script under 10.7 the finder jumps to the root of the share and shows the ~Snapshot folder on the root and not on the current folder location the user is working on!

Ik hope some can guide my in the right direction to make it work!

Thanks in advance!


tell application “Finder”
set current view of Finder window 1 to column view
set Itms to selection
set als to Itms’s item 1 as string
set text1 to “~snapshot” as string
set aPath to als & text1
set aPath1 to POSIX path of aPath
set the clipboard to (aPath1 as string)

end tell

tell application “Finder” to activate
delay 2
tell application “System Events”
keystroke “g” using {shift down, command down}
key code 9 using {command down}
delay 2
keystroke return
if (exists folder aPath1) is true then
set the clipboard to “”
else
key code 53
delay 1
tell application “Finder” to display dialog “Op deze lokatie is geen SnapShot map aanwezig.
Dit werkt alleen op de Filer.” with icon stop buttons {“OK”} default button 1
end if
end tell


Model: Macbook Pro
Browser: Safari 534.57.2
Operating System: Mac OS X (10.7)

Hi,

GUI scripting the Finder is actually never needed.
I’m not sure to get everything right, but try this


tell application "Finder"
	if not (exists Finder window 1) then return
	set windowTarget to target of Finder window 1 as text
end tell
tell application "System Events" to set snapShotFolderExists to exists folder "~snapshot" of folder windowTarget
if snapShotFolderExists then
	tell application "Finder" to set target of Finder window 1 to alias (windowTarget & "~snapshot:")
else
	display dialog "Op deze lokatie is geen SnapShot map aanwezig. 
Dit werkt alleen op de Filer." with icon stop buttons {"OK"} default button 1
end if