I have a pretty simple question. I need to put certain files on a server during my script. However, I need to connect to the server before doing that. How can I connect to a server in my script?
I don’t know if this is exactly what you want but it might do the trick!
This is how I managed it.
Make an alias to the server location you need to access.
Put the alias in a suitable location on the local drive.
Add the following lines to the start of your script:
tell application “Finder”
open file “Alias” of folder “Folder” of startup disk
That should do it.
sorry I wasn’t so clear in my question. Basically what we’re doing is automating CD production. My script gets all the info necessary to make the CD. Then I need to connect to a server where I will place the appropiate files my script made. When I place these files on the server the machines that actually make the CDs will be activated and make the CDs according to the information in the files I place in the server. My big question is if there is any to connect to that server(I can’t assume that I’ll already be connected) with applescript. I didn’t think it should be too hard using the Finder, but I can’t figure it out. So, if you can help, it would be greatly appreciated. Thanks
try something like this.
tell application "Finder" if not (exists disk "myvolume") then mount volume "afp://username:password@server/myvolume/" end if end tell
you can substitute afp with other protocols such as SMB. You may have to use the IP address of the server instead of the server name. Depends on how your network is set up.
Well, I can now do I what I need to do. Thank you very much for the help.
Applescript newbie here
I am trying to accomplish the same thing, however my password to connect to the server contains the “@” symbol. I think because of this, the script isn’t working. I would rather not change my password…is there a way around this?
THanks in advance!!
there might be one way. if you can mount the disk through the Finder, and then check the box to ‘save password in keychain’, then you can do:
tell application "Finder" if not (exists disk "myvolume") then mount volume "afp://username@server/myvolume/" end if end tell