Re: First time script ... help for debugging
Re: First time script ... help for debugging
- Subject: Re: First time script ... help for debugging
- From: Craig Sutherland <email@hidden>
- Date: Sat, 17 Jan 2004 09:30:42 -0600
Sven,
Look at some of the scripts in /Library/Scripts. You need to use the
syntax and floww control of Applescript.
On Jan 17, 2004, at 7:59 AM, SVEN AERTS wrote:
What's wrong with this ?
Display dialog
"Welcome, this script replaces the last 4 characters of a filename
with .jpg
if the filename has no .jpg at the end. What folder are the files in
?"
choose folder with promt
Select Folder\
if name ends with ".jpg"
Name of what? The is no abject or item that name refers to.
then goto next name
goto is not an applescript term.
else
replace name -4 to -1 by ".jpg"
by is not an applescript term
*********
Display Dialog "Welcome. etc. etc."
set _folder to choose folder with prompt "Select Folder"
tell application "Finder"
set fileList to every file of _folder as alias list
repeat with aFile in fileList
set fileName to name of aFile
set theExt to name extension of aFile
if ((count of (characters of fileName)) > 5) and theExt is not "jpg"
then
set newName to (text 1 through -5 of fileName) & ".jpg"
set name of aFile to newName
end if
end repeat
end tell
*********
Become familiar with the Applescript dictionary.
Sven-Brussels
Craig Sutherland
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.