Kick names, take ass.

5-03-2006 3:25 pm
David: In Case You're Bored Enough...
to be interested, I've enhanced, cleaned up, and commented on the Applescript code I posted earlier. The process now only requires 1 user interaction in the case of a full page sized file, and in that case all that is required is a 5 digit number. My next step will probably be to set up some better font handling. Or, I could just set us up the bomb.

tell application "Adobe InDesign CS2"
--Bring InDesign to the front
activate
set thisDocument to active document
tell thisDocument

--Get page information
set myPageTotal to pages per document of document preferences
set myPageHeight to page height of document preferences
set myPageWidth to page width of document preferences

--Set print preset
tell print preferences of thisDocument
set printer to postscript file
set PPD to "Prinergy Refiner"

--General
set reverse order to false
set print spreads to false
set print master pages to false
set print nonprinting to false
set print blank pages to true

--Setup
set paper size to custom
set print page orientation to portrait
set paper height to myPageHeight + 1
set paper width to myPageWidth + 1
set paper offset to 0
set paper gap to 0
set paper transverse to false
set scale mode to scale width height
set scale width to 100
set scale height to 100
set scale proportional to true
set page position to centered
set thumbnails to false
set tile to false

--Marks and Bleed
set crop marks to true
set registration marks to true
set bleed marks to false
set color bars to false
set page information marks to false
set mark type to default
set mark line weight to p25pt
set mark offset to "0.1667 in"
set use document bleed to print to false
set bleed top to "0.125 in"
set bleed inside to "0.125 in"
set bleed bottom to "0.125 in"
set bleed outside to "0.125 in"
set include slug to print to false

--Output
set color output to composite CMYK
set flip to none
set simulate overprint to false

--Graphics
set send image data to optimized subsampling
set font downloading to complete
set PostScript level to level 3
set data format to ASCII
set download PPD fonts to true

--Advanced
set OPI image replacement to false
set omit EPS to false
set omit PDF to false
set omit bitmaps to false
set flattener preset name to "[High Resolution]"
set ignore spread overrides to false
end tell

--Determines which job folder the document is in based on it's links
set AdFolder to file path of link 1 as alias
set ExistingLinks to AdFolder as text

--If the link is in a folder titled "_Links" then we can assume that the folder has already been organized by this script, and use the currently existing document file path. If not, then the job folder will be the folder in which the link exists.
if ExistingLinks does not contain "_Links" then
set OrganizeOrNot to "Organize" as text
set StupidName to name of link 1
set AdFolder to my myReplace(AdFolder, StupidName, "")
set AdFolder to AdFolder as alias
else
set OrganizeOrNot to "Not" as text
set AdFolder to file path of thisDocument
set AdFolder to AdFolder as alias
end if

--Determines how many links are in the document for use in the link move and relink loop below
set TotalLinks to count of links
end tell

--This file will be moved to the "_Support Files" folder while we are working and deleted in the end, as a new version will be saved in the "_Documents" folder.
set DoomedFile to name of thisDocument as text
end tell

--This is the path that will organize the job folder.
if OrganizeOrNot is "Organize" then
tell application "Finder"

--Uses the name of the folder for the final file name of the .indd and .pdf files.
set DocName to name of AdFolder as text
set GenericName to DocName
set AdFolder to AdFolder as text

--This creates the internal folders and saves their paths as text to a variable.
set SupportFolder to make new folder in folder AdFolder with properties {name:"_Support Files"}
set SupportFolder to SupportFolder as text

--Puts everything inside the job folder besides a font folder named "_Fonts" (renaming currently required by user) into the "_Support Files" folder.
move (items in folder AdFolder where name is not "_Support Files" and name is not "_Fonts") to folder SupportFolder
set LinksFolder to make new folder in folder AdFolder with properties {name:"_Links"}
set LinksFolder to LinksFolder as text
set DocumentFolder to make new folder in folder AdFolder with properties {name:"_Document"}
set DocumentFolder to DocumentFolder as text

--This loop will move all images linked within the document to the newly created "_Links" folder and redirect the document links to the new location.
repeat with i from 1 to TotalLinks
tell application "Adobe InDesign CS2"
activate

--Gets the current link location.
tell thisDocument
set thisLink to link i
set LinkName to name of thisLink
set LinkPath to SupportFolder&LinkName
end tell
end tell

--Moves the current link to the "_Links" folder.
tell application "Finder"
move file LinkPath to folder LinksFolder
set FinalLink to LinksFolder&LinkName
end tell

--Redirects the document's link.
tell application "Adobe InDesign CS2"
tell thisDocument
relink thisLink to FinalLink
end tell
end tell
end repeat
end tell
tell application "Adobe InDesign CS2"
tell thisDocument

--Checks for standard full page size to determine whether or not job number should be incorporated into filename.
if myPageWidth is 8.375 and myPageHeight is 10.875 then
set FullOrNot to "Yes"
else
set FullOrNot to "No"
end if

--Both paths will set DocName to the final .indd filename.
if FullOrNot is "Yes" then
set JobNumber to (display dialog "Enter your 5 digit job number" default answer "")
set JobNumber to (text returned of result)
set DocName to JobNumber&" "&DocName&".indd" as text
else if FullOrNot is "No" then
set DocName to DocName&".indd" as text
end if

--Saves the document to the "_Document" folder.
set DocPath to DocumentFolder&DocName
save thisDocument to DocPath
end tell
tell application "Adobe InDesign CS2"

--Updates the variable to the new file name
set thisDocument to active document
--Prints the .ps file to the job folder
tell thisDocument
set PSName to AdFolder&JobNumber&" "&GenericName&".ps"
tell print preferences of thisDocument
set print file to PSName
end tell
print PSName without print dialog
end tell
end tell
end tell
else if OrganizeOrNot is "Not" then
tell application "Adobe InDesign CS2"
activate
save thisDocument

--Works with the known and existing folder structure to set up the file names.
set OrganizedPath to file path of thisDocument as string
set PDFFilePath to my myReplace(OrganizedPath, "_Document:", "")
set GenericName to name of thisDocument as string
set GenericName to my myReplace(GenericName, ".indd", "")
tell application "Adobe InDesign CS2"
tell thisDocument
set PSName to PDFFilePath&GenericName&".ps"
tell print preferences of thisDocument
set print file to PSName
end tell
print PSName without print dialog
end tell
end tell
end tell
end if

--Sets the variable PDFName to the name of the final PDF
set PDFName to my myReplace(PSName, ".ps", ".pdf")
--Sets the variable DistillerError to the name of the Distiller .log file produced in an error
set DistillerError to my myReplace(PSName, ".ps", ".log")
--Deletes an existing PDF or .log file in the job folder and then waits for the .ps file to be created.
tell application "Finder"
if file PDFName exists then delete file PDFName
if file DistillerError exists then delete file DistillerError
repeat until file PSName exists
delay 5
end repeat
end tell
tell application "Adobe InDesign CS2"
close thisDocument saving yes
end tell

--Opens the .ps file in Distiller, creating the PDF with the current Distiller settings.
tell application "Acrobat Distiller 7.0"
activate
open PSName
end tell

--Waits for the PDF or .log file to exist, then deletes the .ps file.
tell application "Finder"
repeat until (file PDFName exists) or (file DistillerError exists)
delay 5
end repeat
delete file PSName
end tell

--Opens the successfully created PDF in Acrobat, or informs the users of a Distiller error.
if PDFName exists then
set myPDF to PDFName as alias
tell application "Adobe Acrobat 7.0 Pro#D8C5B"
activate
open myPDF
end tell
else if DistillerError exists then
display dialog "The PostScript file failed to generate a PDF"
end if

--Deletes any unnecessary InDesign lock files and the original document, if they exist.
tell application "Finder"
try
set DoomedFile to SupportFolder&DoomedFile
delete file DoomedFile
set LockKillerItems to count of items in folder SupportFolder
repeat with i from 1 to LockKillerItems
set CurrentSuspect to item i in folder SupportFolder
if name of CurrentSuspect contains ".idlk" then
set OffWithHisHead to CurrentSuspect
end if
end repeat
delete OffWithHisHead
end try
end tell

--Function to replace string items. Variables are (String to be Changed, What will Be Replaced, What Will Replace It)
on myReplace(myString, myFindString, myChangeString)
set AppleScript's text item delimiters to myFindString
set myTextList to every text item of (myString as text)
set AppleScript's text item delimiters to myChangeString
set myString to myTextList as string
set AppleScript's text item delimiters to ""
return myString
end myReplace






5-01-2006 9:05 pm
David: Me and my Lightsabers
Since I've got Windows on my iMac these days, I've been slowly dipping into the world of Windows gaming.

I'm currently in the middle of playing Knights of the Old Republic 2. It was on sale for $19.99 at Target, and I'm a sucker for the force. I haven't played KOTOR I, but why bother?

I found the game dull to start with. Then, after quite a lot of running around and using swords with batteries in them (they vibrate, which is why they are called Vibroswords...) I was able to build my lightsaber. The game instantly became more fun. Not because it was anymore challenging or the mechanics had changed in any perceivable way, but because now I heard the *whummmm, whummmm, whummmm* of my lightsaber during battle.

Then, this morning before work, I got a another one. Now I have 2!

Plus, it's fun to have an interrogation droid follow me around and make that sound that they make. It's a little creepy and I keep getting the feeling that I'm going to get a hypodermic to the back of my Jedi cranium.

What's worse, when I'm done with the game I'll play it again, due to the branching narratives and choices in the game. Next time I play, I'm gonna go Sith. Damn those Jedi.





4-28-2006 6:51 pm
David: How to...
Automate the cleanup and organization of job folders, while at the same time generating a high resolution PDF from an InDesign file. And some other stuff.

Oh, and it's in Applescript, that way Windows users can't use it. Why? Because I'm too lazy to worry about Java.

tell application "Adobe InDesign CS2"
activate
set thisDocument to active document
set AdFolder to file path of thisDocument as alias
set ExistingOrganize to AdFolder as text
set DoomedFile to name of thisDocument as text
tell thisDocument
set TotalLinks to count of links
end tell
end tell
tell application "Finder"
if ExistingOrganize contains "_Document" then
set OrganizeOrNot to "Not" as text
else
set OrganizeOrNot to "Organize" as text
end if
end tell
if OrganizeOrNot is "Organize" then
tell application "Finder"
activate
set DocName to name of AdFolder as text
set AdFolder to AdFolder as text
set SupportFolder to make new folder in folder AdFolder with properties {name:"_Support Files"}
set SupportFolder to SupportFolder as text
move (items in folder AdFolder where name is not "_Support Files" and name is not "_Fonts") to folder SupportFolder
set LinksFolder to make new folder in folder AdFolder with properties {name:"_Links"}
set LinksFolder to LinksFolder as text
set DocumentFolder to make new folder in folder AdFolder with properties {name:"_Document"}
set DocumentFolder to DocumentFolder as text
repeat with i from 1 to TotalLinks
tell application "Adobe InDesign CS2"
activate
tell thisDocument
set thisLink to link i
set LinkName to name of thisLink
set LinkPath to SupportFolder&LinkName
end tell
end tell
tell application "Finder"
move file LinkPath to folder LinksFolder
set FinalLink to LinksFolder&LinkName
end tell
tell application "Adobe InDesign CS2"
tell thisDocument
relink thisLink to FinalLink
end tell
end tell
end repeat
end tell
tell application "Adobe InDesign CS2"
set myDocument to active document
tell myDocument
--Get page information
set myPageTotal to pages per document of document preferences
set myPageHeight to page height of document preferences
set myPageWidth to page width of document preferences
--Set print preset
tell print preferences of myDocument
set printer to postscript file
set PPD to "Prinergy Refiner"
--General
set reverse order to false
set print spreads to false
set print master pages to false
set print nonprinting to false
set print blank pages to true
--Setup
set paper size to custom
set print page orientation to portrait
set paper height to myPageHeight + 1
set paper width to myPageWidth + 1
set paper offset to 0
set paper gap to 0
set paper transverse to false
set scale mode to scale width height
set scale width to 100
set scale height to 100
set scale proportional to true
set page position to centered
set thumbnails to false
set tile to false
--Marks and Bleed
set crop marks to true
set registration marks to true
set bleed marks to false
set color bars to false
set page information marks to false
set mark type to default
set mark line weight to p25pt
set mark offset to "0.1667 in"
set use document bleed to print to false
set bleed top to "0.125 in"
set bleed inside to "0.125 in"
set bleed bottom to "0.125 in"
set bleed outside to "0.125 in"
set include slug to print to false
--Output
set color output to composite CMYK
set flip to none
set simulate overprint to false
--Graphics
set send image data to optimized subsampling
set font downloading to complete
set PostScript level to level 3
set data format to ASCII
set download PPD fonts to true
--Advanced
set OPI image replacement to false
set omit EPS to false
set omit PDF to false
set omit bitmaps to false
set flattener preset name to "[High Resolution]"
set ignore spread overrides to false
end tell
set FullOrNot to button returned of (display dialog "Is this a full page ad?" buttons {"Yes", "No"} default button "No")
if FullOrNot is "Yes" then
set JobNumber to (display dialog "Enter your 5 digit job number" default answer "")
set JobNumber to (text returned of result)
set DocName to JobNumber&" "&DocName
else if FullOrNot is "No" then
set DocName to DocName as text
end if
set DocPath to DocumentFolder&DocName
save myDocument to DocPath
end tell
set myFileName to my myReplace(DocName, ".indd", "")
tell application "Adobe InDesign CS2"
set myDocument to active document
tell myDocument
set myFullName to AdFolder&myFileName&".ps"
tell print preferences of myDocument
set print file to myFullName
end tell
print myFullName without print dialog
end tell
end tell
end tell
set myPDFName to my myReplace(myFullName, ".ps", ".pdf")
set myErrorName to my myReplace(myFullName, ".ps", ".log")
tell application "Finder"
if file myPDFName exists then delete file myPDFName
if file myErrorName exists then delete file myErrorName
repeat until file myFullName exists
delay 5
end repeat
end tell
tell application "Adobe InDesign CS2"
close myDocument saving yes
end tell
tell application "Acrobat Distiller 7.0"
activate
open myFullName
end tell
tell application "Finder"
repeat until (file myPDFName exists) or (file myErrorName exists)
delay 5
end repeat
delete file myFullName
end tell
if myPDFName exists then
set myPDF to myPDFName as alias
tell application "Adobe Acrobat 7.0 Pro#D8C5B"
activate
open myPDF
end tell
else if myErrorName exists then
display dialog "The PostScript file failed to generate a PDF"
end if
tell application "Finder"
try
set DoomedFile to SupportFolder&DoomedFile
delete file DoomedFile
end try
end tell
else if OrganizeOrNot is "Not" then
tell application "Adobe InDesign CS2"
activate
set myDocument to active document
tell myDocument
--Get page information
set myPageTotal to pages per document of document preferences
set myPageHeight to page height of document preferences
set myPageWidth to page width of document preferences
--Set print preset
tell print preferences of myDocument
set printer to postscript file
set PPD to "Prinergy Refiner"
--General
set reverse order to false
set print spreads to false
set print master pages to false
set print nonprinting to false
set print blank pages to true
--Setup
set paper size to custom
set print page orientation to portrait
set paper height to myPageHeight + 1
set paper width to myPageWidth + 1
set paper offset to 0
set paper gap to 0
set paper transverse to false
set scale mode to scale width height
set scale width to 100
set scale height to 100
set scale proportional to true
set page position to centered
set thumbnails to false
set tile to false
--Marks and Bleed
set crop marks to true
set registration marks to true
set bleed marks to false
set color bars to false
set page information marks to false
set mark type to default
set mark line weight to p25pt
set mark offset to "0.1667 in"
set use document bleed to print to false
set bleed top to "0.125 in"
set bleed inside to "0.125 in"
set bleed bottom to "0.125 in"
set bleed outside to "0.125 in"
set include slug to print to false
--Output
set color output to composite CMYK
set flip to none
set simulate overprint to false
--Graphics
set send image data to optimized subsampling
set font downloading to complete
set PostScript level to level 3
set data format to ASCII
set download PPD fonts to true
--Advanced
set OPI image replacement to false
set omit EPS to false
set omit PDF to false
set omit bitmaps to false
set flattener preset name to "[High Resolution]"
set ignore spread overrides to false
end tell
save myDocument
end tell
set myDocument to active document
set myFilePath to file path of myDocument as string
set PDFFilePath to my myReplace(myFilePath, "_Document:", "")
set myFileName to name of myDocument as string
set myFileName to my myReplace(myFileName, ".indd", "")
tell application "Adobe InDesign CS2"
tell myDocument
set myFullName to PDFFilePath&myFileName&".ps"
tell print preferences of myDocument
set print file to myFullName
end tell
print myFullName without print dialog
end tell
end tell
end tell
set myPDFName to my myReplace(myFullName, ".ps", ".pdf")
set myErrorName to my myReplace(myFullName, ".ps", ".log")
tell application "Finder"
if file myPDFName exists then delete file myPDFName
if file myErrorName exists then delete file myErrorName
repeat until file myFullName exists
delay 5
end repeat
end tell
tell application "Adobe InDesign CS2"
close myDocument saving yes
end tell
tell application "Acrobat Distiller 7.0"
activate
open myFullName
end tell
tell application "Finder"
repeat until (file myPDFName exists) or (file myErrorName exists)
delay 5
end repeat
delete file myFullName
end tell
if myPDFName exists then
set myPDF to myPDFName as alias
tell application "Adobe Acrobat 7.0 Pro#D8C5B"
activate
open myPDF
end tell
else if myErrorName exists then
display dialog "The PostScript file failed to generate a PDF"
end if
tell application "Finder"
try
set DoomedFile to SupportFolder&DoomedFile
delete file DoomedFile
end try
end tell
end if
on myReplace(myString, myFindString, myChangeString)
set AppleScript's text item delimiters to myFindString
set myTextList to every text item of (myString as text)
set AppleScript's text item delimiters to myChangeString
set myString to myTextList as string
set AppleScript's text item delimiters to ""
return myString
end myReplace



Thankful: I'm not a programmer



4-25-2006 4:29 pm
David: Reflecting
I've been meaning to toy around in Photoshop and replicate the reflection effect that Apple uses quite a bit on its website as well as in iWeb, iPhoto, and iChat.

So here's another picture (actually the same picture) of Jager and a shotglass. It stands on the nose and antlers when you poor the shot.



The perspective of the shot kind of screws with the effect. Unfortunately, this effect only works with a straight perspective, such as...



The End.





4-24-2006 2:09 am
David: A Trip to the Liquor Store
I went to the liquor store to buy this:



And ended up buying this as well:



That's a pretty spiffy pewter shotglass that came with my Jagermeister, my favorite booze. Now you know where the suffix of my online nick is from.

This is the hunter's badge of honor,
that he protect and nourish his game,
hunt sportingly, as is proper,
and honor the Creator in creation.


The End.





< Next 5 | Previous 5 >

Log In
Username:

Password:

Public Terminal

 
Lyric
Komm, gib mir deine Hand
 
User Journals
Your Hosts
Links