I am trying to write code with an application “audio Hijack pro”
it renames the file and places it in an itunes playlist.
I am having trouble debugging this since I need to run it with audio hijack pro that launches a script.
so far this is what I have
on process(theArgs)
--Coerce args to be a list
if class of theArgs is not list then
set theArgs to {theArgs}
end if
set newFileName to "ttbookpic1"
set this_file to ((path to home folder) as string) & "Music:Audio Hijack:paparimage:ttbookedit:" & newFileName & ".jpg"
set the target_path to ((path to home folder) as string) & "Music:Audio Hijack:paparimage:ttbookedit:" & newFileName & ".pict"
try
tell application "Image Events"
launch
set this_image to open this_file
save this_image as PICT in file target_path with icon
close this_image
end tell
on error error_message
display dialog error_message
end try
--Into iTunes ye files shall go
tell application "iTunes"
repeat with TheFile in theArgs
add TheFile to playlist "best knowla"
set name of result to my GetTitleFromFile() -- Not 'name of thisfile'.
end repeat
set newTrack to TheFile
set artworkCount to count of artwork of newTrack
set myArt to read file target_path from 513 as picture
display dialog myArt
if artworkCount > 0 then
set data of artwork (artworkCount + 1) of newTrack to myArt
else
set data of artwork 1 of newTrack to myArt
end if
end tell
tell application "Image Events"
delete file target_path
end tell
end process
on GetTitleFromFile()
return (read file ((":users:username:Music:Audio Hijack:paparimage:ttbooktitle:" as Unicode text) & "finaltext2.txt"))
end GetTitleFromFile
I need help understanding a few things first.
the on process (the Args)
places the file in from audio hijack. Must I start with this command to get the info from audio hijack?
In some scripts I placed Properties after this first block and received errors. why?
In this file the text works great to replace the title, however, I got the script for the artwork from another source and it doesn’t appear to be working. I can’t watch the code since it is not going through the applescript editor.
How can I see what is going on?
Lastly. The code returns nothing in the artwork for itunes.
Do you know what went wrong?
also, I don’t need a repeat in my script but I don’t know how to declare Thefile
any suggestions?
repeat with TheFile in theArgs
add TheFile to playlist "best knowla"
set name of result to my GetTitleFromFile() -- Not 'name of thisfile'.
end repeat