Does anyone here do scripts for hire?

Does anyone here do scripts for hire? I am working on a new venture for a startup company that needs, what I think/hope will be a pretty simple AppleScript. However, my AppleScript skills are rusty at best (it’s been like 10 years).

I basically need a script that will take 4 files which are named the same except for extension (jpg, gif, png, etc.) and create a text file similar to the following:


ArtistName	Jill
ArtistID	103
email	jill@jill.com
fixedRate	.10
percent	.10
TopLevel	Color Graphics
Genre	Misc
Family	2
ItemName	Funky Furry Hat
display	jpg	/Source/Jivjiv/content/color/jill/jpg/furryhat.jpg
delivery	jpg	/Source/Jivjiv/content/color/jill/jpg/furryhat.jpg
delivery	gif	/Source/Jivjiv/content/color/jill/gif/furryhat.gif
delivery	png	/Source/Jivjiv/content/color/jill/png/furryhat.png

Most of the first few lines would remain constant but the last 4 line would be the ones that would be based on the four files… (The first 8 lines could be a text file itself if that would be simple.

Anyway, if you think this is an simple task or you know of someone who may be interested, would you let me know? (If this isn’t clear or you need more info, please let me know as well)

Thanks,

– Schwa

Hi Schwa,

Here’s a rough draft of a script to see if it generates the output that you need. Save the script as an application (it will become a droplet) and then drop the image files onto the script’s icon. It will create a text file named “script test.txt” on the desktop. Warning: If there is a file of the same name on the desktop, it will be destroyed.

property static_ : "ArtistName   Jill 
ArtistID   103 
email   jill@jill.com 
fixedRate   .10 
percent   .10 
TopLevel   Color Graphics 
Genre   Misc 
Family   2 
ItemName   Funky Furry Hat"

on open files_
	try
		repeat with file_ in files_
			set info_ to (info for file_)
			if name extension of info_ is "jpg" then
				set display to "display" & tab & tab & "jpg" & tab & POSIX path of file_
				set delivery1 to "delivery" & tab & "jpg" & tab & POSIX path of file_
			end if
			if name extension of info_ is "gif" then
				set delivery2 to "delivery" & tab & "gif" & tab & POSIX path of file_
			end if
			if name extension of info_ is "png" then
				set delivery3 to "delivery" & tab & "png" & tab & POSIX path of file_
			end if
		end repeat
		
		set output_ to static_ & return & display & return & delivery1 & ¬
			return & delivery2 & return & delivery3
		
		my write_to_file(output_, ((path to desktop as text) & "script test.txt"), false)
	on error e
		return display dialog e
	end try
end open

on write_to_file(this_data, target_file, append_data)
	try
		set the target_file to the target_file as text
		set the open_target_file to ¬
			open for access file target_file with write permission
		if append_data is false then ¬
			set eof of the open_target_file to 0
		write this_data to the open_target_file starting at eof
		close access the open_target_file
		return true
	on error
		try
			close access file target_file
		end try
		return false
	end try
end write_to_file

This is only a test and should not be considered suitable for production. There are details to be worked out and error traps to add. :slight_smile:

– Rob