Hi tmckenna,
Your script looks pretty good to me.
Here’s a few things you might try:
When you get some text from a string, instead of getting ‘characters’ use text. For example:
set the_string to “somefilename.ext”
set dot_offset to (offset of “.” in the_string) - 1
set the_name to (text 1 thru dot_offset of the_string)
When you use ‘charaters of …’, you get a list of characters and then you need to coerce to string. This way you just get a range of text.
Try to avoid nested tell blocks and using scripting addition commands in application tell blocks if possible. Firstly, you might get conflicts with key words. Another, if your wording is not exact for an inner tell block, the script will look for the next target and might use the dictionary of the outer tell block. So, your syntax check might come out ok but it won’t work as expected. For instance, after a quick glance at your script, it looks like you can do the ‘info for’ command outside the Finder tell block and the AppleWorks tell block looks like it doesn’t need to be inside the Finder tell block. Doing this may increase speed also, as the Finder is not needed there anyway.
Edit: I just looked through the script again and found that the Finder is not needed in the repeat loop. The ‘info for’ command returns a record with a lot of information.
Edit: more stuff. ‘path to dektop’ is used more than once. I like to put this in a variable. It helps to not crunch statements also for debugging especially when starting off. This section:
tell application “Finder”
make new folder at desktop with properties {name:“Converted Items”}
set targetFolder to ((path to desktop folder as text) & “Converted Items:”) as text
end tell
In OSX, Finder ‘make’ command returns a reference to the item. So, the second line is not needed.
tell application “Finder”
set targetFolder to (make new folder at desktop with properties {name:“Converted Items”}) – as text – if a reference is not needed later
end tell
If you’re using a reference to the made folder later, then coerce to alias (as alias). This is good if you’re using the reference out of the Finder as the Finder returns a Finder reference.
Good Job,