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

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
I had this script working before, but I moved it to another system and changed the folder alias's accordingly but I am getting an error message. It basically reads all the files in a folder and makes them into a list to add them to a render cue of my video compression software. I posted the script and the error message below. Does anyone know what it means or how to fix it?

Script:

tell application "Finder"
set Afolder to "MacintoshHD:Users:comcastcable:Desktop:Render" as alias
set a_list to every file in Afolder as alias list
repeat with i from 1 to number of items in a_list
set a_file to (item i of a_list)
tell application "Cleaner 6.5.1" to Add a_file
end repeat
end tell

Error message:

Can't make alias "MacintoshHD:Users:comcastcable:Desktop:Render:fanaxxessbump.wmv" into type «class alst». (-1700)
 

numero

macrumors regular
Jul 23, 2002
106
3
OR
Nothing stands out on this one.

Try this:
Run it in Script Editor and have the "Event Log" showing. There will be some output for each line that runs. Let us know where the failure is.

You can also put in "log" lines. Such as: log a_file. These will print to the Event Log as well.

I'd also comment out the "tell Cleaner" line until the rest is working.

-numero
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
Nothing stands out on this one.

Try this:
Run it in Script Editor and have the "Event Log" showing. There will be some output for each line that runs. Let us know where the failure is.

You can also put in "log" lines. Such as: log a_file. These will print to the Event Log as well.

I'd also comment out the "tell Cleaner" line until the rest is working.

-numero

Here is the Event Log when I ran the script:

tell application "Finder"
get every file of alias "MacintoshHD:Users:comcastcable:Desktop:Render:"
{alias "MacintoshHD:Users:comcastcable:Desktop:Render:fanaxxessbump.wmv"}
"Can't make alias \"MacintoshHD:Users:comcastcable:Desktop:Render:fanaxxessbump.wmv\" into type «class alst»."
 

macfaninpdx

macrumors regular
Mar 6, 2007
198
0
It sounds like it cannot find "Cleaner 6.5.1" on the new system. I am assuming when you changed the alias to the Render folder, the script compiled properly? Did it ask you where "Cleaner 6.5.1" is?
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
It sounds like it cannot find "Cleaner 6.5.1" on the new system. I am assuming when you changed the alias to the Render folder, the script compiled properly? Did it ask you where "Cleaner 6.5.1" is?

It never gets that far in the script to ask where cleaner is, even if it doesn't know. As goes for the only one file in the folder issue. I was running tests on the last machine with only one file and it ran fine.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Was the last machine exactly the same version of OS X (This bug could have been fixed)? Are you sure there wasn't a .DS_Store file in the directory as well as the 1 file you knew of? Try adding another file and see if that fixes it. The error you get is exactly the same as what's mentioned in the thread.

-Lee
 

macfaninpdx

macrumors regular
Mar 6, 2007
198
0
It never gets that far in the script to ask where cleaner is, even if it doesn't know.

If you open the script in Script Editor, can you click on the Compile button? When you compile it in Script Editor, it wlil look for any applications referenced in a Tell block. If it can't find them, it will ask you to find them for it. If it compiles, you will see your code re-format into a syntax-colored font, and that means it was able to find Cleaner.

Edit: You will need to open it in Script Editor on the new machine to which you copied the script.
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
Was the last machine exactly the same version of OS X (This bug could have been fixed)? Are you sure there wasn't a .DS_Store file in the directory as well as the 1 file you knew of? Try adding another file and see if that fixes it. The error you get is exactly the same as what's mentioned in the thread.

-Lee

The other system had the new mac os 10.5. This other system has 10.4.11. Is there any huge significant changes that would effect this script?
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
If you open the script in Script Editor, can you click on the Compile button? When you compile it in Script Editor, it wlil look for any applications referenced in a Tell block. If it can't find them, it will ask you to find them for it. If it compiles, you will see your code re-format into a syntax-colored font, and that means it was able to find Cleaner.

Edit: You will need to open it in Script Editor on the new machine to which you copied the script.

I compiled it in script editor with no errors.
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
http://lists.apple.com/archives/Applescript-users/2003/Jan/msg01296.html
That response to a similar question explains that if a folder only has one item, this fails. if you add another file it would work, but that post gives a means of handling the case that there is only 1 file as well.

-Lee

So I ran the script again after compiling with 3 files in the folder and it ran properly. I looked at the script in the link posted above, but I don't know where to insert the script. COuld you guys help me out?

Link Script:

tell app "Finder"
try
set foos to theItems as alias list
on error -- only one item present
set foos to theItems as alias as list
end try
end tell

My Script:

tell application "Finder"
set Afolder to "MacintoshHD:Users:comcastcable:Desktop:Render" as alias
set a_list to every file in Afolder as alias list
repeat with i from 1 to number of items in a_list
set a_file to (item i of a_list)
tell application "Cleaner 6.5.1" to Add a_file
end repeat
end tell
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I don't have a mac handy, but I believe you want to change:
Code:
set a_list to every file in Afolder as alias list

to

Code:
try
  set a_list to every file in Afolder as alias list
  on error -- only one item present
  set a_list to every file in Afolder as alias as list
end try

If that doesn't work, I can try it out when I get home this evening.

-Lee
 

thriftinkid

macrumors regular
Original poster
Mar 24, 2008
119
0
I don't have a mac handy, but I believe you want to change:
Code:
set a_list to every file in Afolder as alias list

to

Code:
try
  set a_list to every file in Afolder as alias list
  on error -- only one item present
  set a_list to every file in Afolder as alias as list
end try

If that doesn't work, I can try it out when I get home this evening.

-Lee

Bingo. That worked. Thanks so much for helping out such a sad, lost soul among the programming genious's on this site.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.