Using AppleScript I am trying to write a file named redirect.htm to a Windows network share named LINKS. I can write the file to the Macbook desktop and then copy it to the network share using Finder, but I cannot figure out how to write the file directly to the Windows folder. The code looks something like this:
tell application “Safari”
tell document 1
set JavaURL to “self.location.replace("” & my escapeURL(URL) & “");”
set OutputPath to (path to desktop as Unicode text) & “LinkTo.htm”
set fRef to (open for access file OutputPath with write permission)
set eof fRef to 0
write “” & return to fRef
close access fRef
After copying the resulting file from the Mac desktop to the Windows share, the Finder Info shows “Where: /Volumes/LINKS; Server: cifs://HOME;administrator@LIFEBOOK/LINKS” (the Windows PC name is LIFEBOOK, the workgroup name HOME, the share name LINKS). I have tried changing the SET OutputPath to various combinations such as: set OutputPath to “//LINKS/redirect.htm” and “cifs://HOME;administrator@LIFEBOOK/LINKS/redirect.htm”.
As you might suspect I am new to AppleScript. Any guidance would be appreciated!
Browser: Safari 523.12.2
Operating System: Mac OS X (10.4)