Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dirtyharrydev

macrumors member
Original poster
Aug 5, 2013
56
1
Hi,
I'm trying to get my script to look if a file exist on a SMB server, but I can't get it to work.
I know that the file are there.

Can someone help me please?

Code:
set connection to "smb://xx:xx@10.0.1.2/Webb"
set DownloadFolder to (path to downloads folder) as string
set UpdateFile to "xxx_v1.0b04.zip"
set UpdateFolder to ("smb://xxx:xxx@10.0.1.2/Webb/" & UpdateFile) as string




tell application "Finder"
	mount volume connection
end tell


tell application "Finder"
	if exists file UpdateFolder then
		set theAction to button returned of (display dialog "There is a new update." buttons {"Download later", "Download now"} default button {"Download now"})
		if theAction = "Download now" then copy file UpdateFolder to DownloadFolder
		delay 100
	end if
end tell
 
Can someone help me please?


Try this :

Code:
set connection to "smb://xx:xx@10.0.1.2/Webb"
set DownloadFolder to path to downloads folder
set UpdateFile to "xxx_v1.0b04.zip"

set mountedVolSpecifier to mount volume connection

tell application "Finder"
	if exists file UpdateFile of folder mountedVolSpecifier then
		set theAction to button returned of (display dialog "There is a new update." buttons {"Download later", "Download now"} default button {"Download now"})
		if theAction = "Download now" then duplicate file UpdateFile of folder mountedVolSpecifier to folder DownloadFolder
	end if
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.