New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Applescript Help req. as script not working under 10.6.2


Post Reply New Thread Subscribe

 
Thread Tools
argeetee

 
Member Since: Mar 14, 2010
Posts: 1
argeetee is on a distinguished road

argeetee is offline
Apologies if this is posted in the wrong place. I'm hoping someone can assist me with the following script which was kindly written for me a while ago. It worked for ages but now produces an error message. Does it need tweaking or rewriting?

I use the script to automatically sort files into folders which are created from a selected number of letters from the filenames. AT the moment I'm getting the message...

"error "Finder got an error: Cant make \"500 Gb HUB 1ownloads:JD: Thumbs Created - CHECK: FACES:Manuelas-2" into type item." number -1700 from "500 Gb HUB 1ownloads:JD: Thumbs Created - CHECK: FACES:Manuelas-2:" to item"

Any help is much appreciated. Thanks.


--script---

set baseFolder to choose folder
set {ATID, AppleScript's text item delimiters} to {"", "-"}
tell application "Finder"
set theFiles to every file of entire contents of baseFolder as alias list

set s_c to text returned of (display dialog "Please enter the STARTING character:" default answer "")
set e_c to text returned of (display dialog "Please enter the ENDING character:" default answer "")
repeat with aFile in theFiles
set fileName to name of aFile
set collection to text s_c through e_c of fileName
set cont to container of aFile as string

if folder (cont & collection) exists then
else
make new folder at cont with properties {name:collection}
end if
-- The next line trims the file name as so given a file name "GroupAbcSubGroupDefViewXYZFile012345-0"
-- and entering Start: 9 End: 19 then when the file is moved the new name would be "SubGroupDefViewXYZFile012345-0"
-- To retain the text prior to the character start (assuming there is any) remove the following line.
-- set name of aFile to (text s_c through -1 of fileName)
move file aFile to (cont & collection & ":")
end repeat
end tell
set AppleScript's text item delimiters to ATID
QUOTE Thanks

Post Reply New Thread Subscribe


« Creating an installer for my first Cocoa Application | Problems with running c-files »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Applescript and X11 not working. need help deathnomore OS X - Operating System 2 01-04-2010 01:56 AM
Logic Express and Applescript via GUI Scripting albertaurus Music, Audio, and Podcasting 0 04-09-2009 01:13 PM
Use Applescript to run a terminal command Turk182 OS X - Development and Darwin 1 02-12-2009 12:08 PM
apple script to greet me off stand by jakeroberts OS X - Development and Darwin 0 04-29-2007 12:34 PM
[ANN] New comprehensive AppleScript book hanaan OS X - Development and Darwin 0 11-06-2004 07:28 PM

All times are GMT -4. The time now is 11:39 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?