What does this Error message mean?

Discussion in 'Mac Programming' started by thriftinkid, Apr 12, 2008.

  1. macrumors regular

    Joined:
    Mar 24, 2008
    #1
    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)
     
  2. macrumors regular

    Joined:
    Jul 23, 2002
    Location:
    OR
    #2
    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
     
  3. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #3
    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»."
     
  4. macrumors regular

    Joined:
    Mar 6, 2007
    #4
    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?
     
  5. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
  6. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #6
    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.
     
  7. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #7
    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
     
  8. macrumors regular

    Joined:
    Mar 6, 2007
    #8
    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.
     
  9. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #9
    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?
     
  10. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #10
    I compiled it in script editor with no errors.
     
  11. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #11
    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
     
  12. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #12
    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
     
  13. thread starter macrumors regular

    Joined:
    Mar 24, 2008
    #13
    Bingo. That worked. Thanks so much for helping out such a sad, lost soul among the programming genious's on this site.
     

Share This Page