I've run into a problem with a script I'm working on where the script works fine when reading from a DVD but fails with an error when reading from the hard drive.
The purpose of the entire script is to convert Adobe InDesign files (.indd) into InDesign tagged text files, which I then process via PHP for conversion into HTML. (Yes, I realize InDesign will export to HTML but the result is not correct as it loses formatting info such as italicized words. I know next to nothing about InDesign... my job is to take the InDesign files, which are for a printed journal publication, and turn them into HTML and post them on my work's website.)
try
set parentINDDfolder to (choose folder with prompt "Select the folder that contains the InDesign files:" default location (alias "Macintosh HD:"))
set outputFolder to (choose folder with prompt "Select the folder to write the HTML files to:" default location (alias "Macintosh HD:filesWrittenFromPHP:"))
set listOfINDDfiles to {}
getAllINDDfiles(parentINDDfolder, listOfINDDfiles) --lists are passed by reference
--log "indd"
--log listOfINDDfiles
repeat with currentINDDfile in listOfINDDfiles
tell application "Finder"
log "MARI"
set aliasToNewFolder to (make new folder at outputFolder with properties {name:(name of (container of currentINDDfile) as text)}) as alias
log "MARI2"
set aliasToLinksFolder to (make new folder at aliasToNewFolder with properties {name:"Links"}) as alias
log "MARI3"
end tell
convertINDDtoTaggedText(currentINDDfile, aliasToNewFolder)
copyLinksFolders(currentINDDfile, aliasToLinksFolder)
end repeat
-- do more stuff here... (these parts seem to work fine so I did not include them in order to save space and highlight the problem area)
on error errorMessage number errorNumber
tell application "Finder"
activate
display alert "An error has occurred (" & errorNumber & "). " & errorMessage
end tell
end try
The error I get (copied from AppleScript log) when the files I am converting are located on my hard drive is:
(*MARI*)
end tell
tell application "Finder"
get name of container of alias "mari:Desktop:maritest:indd:hoov-09-04-01 Folder:hoov-09-04-01.indd"
activate
display alert "An error has occurred (-1700). Can't make name of «class ctnr» of item 1 of {alias \"mari:Desktop:maritest:indd:hoov-09-04-01 Folder:hoov-09-04-01.indd\"} into type string."
{button returned:"OK"}
end tell
However, when the files I am converting are on a DVD everything works and this is the log output from MARI to MARI3:
(*MARI*)
end tell
tell application "Finder"
get name of container of alias "xxx publication 2009 No. 4:indd:hoov-09-04-01 Folder:hoov-09-04-01.indd"
"hoov-09-04-01 Folder"
make new folder at alias "Macintosh HD:filesWrittenFromPHP:blah:" with properties {name:"hoov-09-04-01 Folder"}
folder "hoov-09-04-01 Folder" of folder "blah" of folder "filesWrittenFromPHP" of startup disk
get folder "hoov-09-04-01 Folder" of folder "blah" of folder "filesWrittenFromPHP" of startup disk
alias "Macintosh HD:filesWrittenFromPHP:blah:hoov-09-04-01 Folder:"
(*MARI2*)
make new folder at alias "Macintosh HD:filesWrittenFromPHP:blah:hoov-09-04-01 Folder:" with properties {name:"Links"}
folder "Links" of folder "hoov-09-04-01 Folder" of folder "blah" of folder "filesWrittenFromPHP" of startup disk
get folder "Links" of folder "hoov-09-04-01 Folder" of folder "blah" of folder "filesWrittenFromPHP" of startup disk
alias "Macintosh HD:filesWrittenFromPHP:blah:hoov-09-04-01 Folder:Links:"
(*MARI3*)
end tell
Any clues would be greatly appreciated. Thanks!
Mari