better scripting questions, also itunes artwork

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

Hi,

I don’t use Audio Hijack so I have no idea how to get the data you want, but
the following script works at least with only one file (I used an alias)

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 music folder as Unicode text) & "Audio Hijack:paparimage:ttbookedit:" & newFileName & ".jpg")
	set the target_path to ((path to music folder as Unicode text) & "Audio Hijack:paparimage:ttbookedit:" & newFileName & ".pict")
	
	try
		tell application "Image Events"
			launch
			open file this_file
			save image 1 as PICT in file target_path with icon
			close image 1
		end tell
	on error error_message
		try
			tell application "Image Events" to close image 1
		end try
		display dialog error_message
	end try
	
	--Into iTunes ye files shall go
	tell application "iTunes"
		if not (exists playlist "best knowla") then make new playlist with properties {name:"best knowla"}
		repeat with TheFile in theArgs
			set newTrack to add TheFile to playlist "best knowla"
			set name of result to my GetTitleFromFile() -- Not 'name of thisfile'.
			try
				set artworkCount to count of artwork of newTrack
			on error
				set artworkCount to 0
			end try
			set myArt to read file target_path from 513 as picture
			-- display dialog myArt -- doesn't work
			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 repeat
	end tell
	tell application "Image Events"
		delete file target_path
	end tell
end process

on GetTitleFromFile()
	return read file ((path to music folder as Unicode text) & "Audio Hijack:paparimage:ttbooktitle:finaltext2.txt")
end GetTitleFromFile

But there are some problems to run it with multiple files:
¢ All files will have the same artwork picture
¢ All new tracks have the same name (read from finaltext2.txt)

Wow, that worked!
I have another part that actually getst the files ( 2 seperate scripts)
how would you suggest I put them together in the code?
If I use audio hijack, I can activate a script after it finishes recording but I’ve had trouble getting the whole thing to work together.

So do I, because I have no idea how your scripts look like :wink:

ok, all the parts of the script are now here
http://bbs.applescript.net/viewtopic.php?pid=83331#p83331