Re: Finder's "exists" command ignores leading zero's in filename
Re: Finder's "exists" command ignores leading zero's in filename
- Subject: Re: Finder's "exists" command ignores leading zero's in filename
- From: "koenig.yvan" <email@hidden>
- Date: Thu, 22 May 2014 16:15:23 +0200
Le 22/05/2014 à 16:01, Bert Groeneveld < email@hidden> a écrit : set path_to_desktop to path to desktop folder set my_img to path_to_desktop & "2028.jpg" as string tell application "Finder" set file_found to exists my_img end tell
When I change the name of the file on the desktop from "2028.jpg" into "002028.jpg" I hope to receive false as the result from above script, but the result is still true. It seems that the leading zero's are ignored. How can I fix that?
Thanks in advance for any help, Bert.
Perfectly normal !
Your code is not checking the existence of a file but the existence of the string my_img.
Replace : set file_found to exists my_img by
set file_found to exists file my_img
For my own use I would code :
set path_to_desktop to path to desktop folder as text set my_img to path_to_desktop & "2028.jpg" tell application "System Events" set file_found to exists disk item my_img end tell
Yvan KOENIG (VALLAURIS, France) jeudi 22 mai 2014 16:15:11
2028.jpg F |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden