Freehand Batch Printing

Hi everyone, I’m a newbie to applescripting.I looking for a way to drag/drop folders on a icon, that will batch postscript the files within the folders.

The files are freehand 8 files.
Running mac OS 9.2.2
If anyone can help that would be great

Thanks

Ahhh, a fellow FH scripter.

Compile and save the following script as an application. You should be able to drag and drop any combination of FreeHand files, and or Folder’s containing FH files to have them batch printed. If you drop a folder, that contains a folder, the subfolder will be ignored as it will only dig one folder deep and will only seek out files where the creator = “AGD3”.

The FH dictionary doesn’t appear to contain anything that pertains to printing to a postscript file - so I hope that isn’t what you are asking. That may be possible through some clever thinking though.

**You may have to change the version of FH - I am on 8.0.1 on this station.

Here is the code:


on run --if the script is launched
	display dialog "Drop a combination of FreeHand 8 files, or folders containing FreeHand 8 files to batch print" with icon note
end run

on open droppedItems
	repeat with thisItem in droppedItems --repeat with each item dropped
		tell application "Finder"
			if file type of thisItem = "fold" then --check to see if this one is a folder
				--folder, get the name of every FH file inside
				set lisFHFiles to get (the name of every file of thisItem whose file type = "AGD3")
				repeat with thisFHFile in lisFHFiles --repeat with each FH file in this folder
					--build the path to the file
					set thisPath to (thisItem as string) & thisFHFile as string
					my printThis(thisPath) --pass the path to the print handler below
				end repeat
			else
				if the file type of file (thisItem as string) = "AGD3" then --AGD3= FreeHand 8
					my printThis(thisItem as string) --if it is a FH8 file, pass the path 
					--to the print handler below
				else
					--if it was not a FH file, log it or skip it without warning
					--your choice
				end if
			end if
		end tell
	end repeat
end open

--=================Handler
on printThis(thisPath)
	tell application "FreeHand 8.0.1"
		--activate--bring FH to the front - optional if you are just printing
		Update --good idea to separate every FH command with an update - FH tends to skip things
		try
			open alias thisPath without Dialogs --open the file we are currently on
			Update --slow down FreeHand
			print --print the file
			Update
			close last document saving no --close the document without saving
		on error
			--do something if there is an error, like log it
		end try
	end tell
end printThis

Best regards!

Thank You Mytzlscript

I give this a try… I am looking to create postscript files so I will eventually have to come up with some “creative way” to do this, but thankyou again. This should get me on the right track.

If you have any ideas to make postscript possible please let me know.

I will post a reply to let you know how this worked.

Thanks

Fishheadtw

I had a friend email me about PrintDesk, a free print spooler application that may help do the trick. I couldn’t find it after a versiontracker and google search - perhaps you can.

Another option may be saving the file out as a PDF or EPS, depending on what you need the final file for.

Here is how you would do that.

property pathToDest : "Your HD:Desktop Folder:Some Folder:"

on run --if the script is launched
	display dialog "Drop a combination of FreeHand 8 files, or folders containing FreeHand 8 files to batch print" with icon note
end run

on open droppedItems
	repeat with thisItem in droppedItems --repeat with each item dropped
		tell application "Finder"
			if file type of thisItem = "fold" then --check to see if this one is a folder
				--folder, get the name of every FH file inside
				set lisFHFiles to get (the name of every file of thisItem whose file type = "AGD3")
				repeat with thisFHFile in lisFHFiles --repeat with each FH file in this folder
					--build the path to the file
					set pathToSaveTo to pathToDest & (thisFHFile as string) & ".pdf" as string --change the pdf to eps if you try eps
					set thisPath to (thisItem as string) & thisFHFile as string
					my printThis(thisPath, pathToSaveTo) --pass the path to the print handler below
				end repeat
			else
				if the file type of file (thisItem as string) = "AGD3" then --AGD3= FreeHand 8
					set pathToSaveTo to pathToDest & (the name of thisItem as string) & ".pdf" as string --change pdf to eps if you try eps
					my printThis(thisItem as string, pathToSaveTo) --if it is a FH8 file, pass the path 
					--to the print handler below
				else
					--if it was not a FH file, log it or skip it without warning
					--your choice
				end if
			end if
		end tell
	end repeat
end open

--=================Handler
on printThis(thisPath, pathToSaveTo)
	tell application "FreeHand 8.0.1"
		--activate--bring FH to the front - optional if you are just printing
		Update --good idea to separate every FH command with an update - FH tends to skip things
		try
			open alias thisPath without Dialogs --open the file we are currently on
			Update --slow down FreeHand
			save in file pathToSaveTo as PDF --or {MacEPS, GenericEPS, MSDOSEPS}
			Update
			close last document saving no --close the document without saving
		on error
			--do something if there is an error, like log it
		end try
	end tell
end printThis

Hope this helps…