Thread View: adobe.scripting.indesign
12 messages
12 total messages
Started by Kermy
Tue, 27 Jan 2009 20:57
Align to page
Author: Kermy
Date: Tue, 27 Jan 2009 20:57
Date: Tue, 27 Jan 2009 20:57
2 lines
802 bytes
802 bytes
Hi - new to using applescript I've got a text box that I've made with Applescript. How can create my box, so that it is aligned to the bottom left of the page? I will be using this script on ID docs that are different sizes, but I will always need my text box at the bottom left.
Re: Align to page
Author: Eric
Date: Tue, 27 Jan 2009 21:59
Date: Tue, 27 Jan 2009 21:59
28 lines
1511 bytes
1511 bytes
Something like this should do the trick...
tell application "Adobe InDesign CS3"
tell active document
--Standardize your coords
set zero point to {"0p", "0p"}
set horizontal measurement units of view preferences to picas
set vertical measurement units of view preferences to picas
set ruler origin of view preferences to page origin
--Define Doc & Box height/width
set thisDocHeight to page height of document preferences
set thisDocWidth to page width of document preferences
set boxHeight to 3 --pi
set boxWidth to 12 --pi
--Position in bottom right corner
-- using top,left,bottom,right coord system
set boxBounds to {thisDocHeight - boxHeight, thisDocWidth - boxWidth, thisDocHeight, thisDocWidth}
--Place the boxes
tell every page
set myTextBox to make new text frame with properties {geometric bounds:boxBounds}
end tell
end tell
end tell
Re: Align to page
Author: Shane_Stanley
Date: Tue, 27 Jan 2009 22:15
Date: Tue, 27 Jan 2009 22:15
10 lines
1554 bytes
1554 bytes
On 28/1/09 7:57 AM, "Kermy" <member@adobeforums.com> wrote: > How can create my box, so that it is aligned to the bottom left of the page? You set it's geometric bounds property accordingly. Perhaps if you posted the code you have already, we could help. -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
Re: Align to page
Author: Kermy
Date: Wed, 28 Jan 2009 15:12
Date: Wed, 28 Jan 2009 15:12
33 lines
1573 bytes
1573 bytes
Well crap, somehow today my code is all screwed up. I guess I saved it in the wrong format and it changed(?). I have all of these funky brackets in my code now. Here's my screwed up code:
tell application "Adobe InDesign CS3"
set myDocument to make document
tell �class vwpp� of myDocument
set �class hunt� to �class zpoi�
set �class vunt� to �class zpoi�
set �class RCtp� to �constant MRcdRCPo�
end tell
set myPage to �class page� 1 of myDocument
set myString to "TEST" & return
tell myPage
set myTextFrame to make �class txtf� with properties {�class gbnd�:{0, 0, 15.738, 144}, contents:" " & myString}
tell myTextFrame
tell paragraph 1
set font to "Georgia"
set �class ptfs� to "Regular"
set size to 5
set �class szld� to 5
set �class paln� to �constant Baltleft�
end tell
end tell
tell �class strp� of myTextFrame
end tell
end tell
end tell
How should I be saving this? -
Re: Align to page
Author: Kermy
Date: Wed, 28 Jan 2009 21:34
Date: Wed, 28 Jan 2009 21:34
42 lines
1673 bytes
1673 bytes
Eric - That worked out swell. How can I get the font formatted, i.e. Arial, 4pt, Rt justified?
My Code:
tell application "Adobe InDesign CS3"
set myDocument to active document
set MyDocName to (name of document 1) as string
tell active document
--Standardize your coords
set zero point to {"0p", "0p"}
set horizontal measurement units of view preferences to points
set vertical measurement units of view preferences to points
set ruler origin of view preferences to page origin
--Define Doc & Box height/width
set thisDocHeight to page height of document preferences
set thisDocWidth to page width of document preferences
set boxHeight to 9
set boxWidth to 72
--Position in bottom right corner
-- using top,left,bottom,right coord system
set boxBounds to {thisDocHeight - boxHeight, 0, thisDocHeight, boxWidth}
--Place the boxes
tell every page
set myTextBox to make new text frame with properties {geometric bounds:boxBounds, contents:MyDocName}
end tell
end tell
end tell
Re: Align to page
Author: Shane_Stanley
Date: Wed, 28 Jan 2009 23:05
Date: Wed, 28 Jan 2009 23:05
11 lines
1541 bytes
1541 bytes
On 29/1/09 2:12 AM, "Kermy" <member@adobeforums.com> wrote: > How should I be saving this? If you want to run it from InDesign's panel, save it as a Compiled Script (Data Fork). If you want to make it a standalone app, save it as either kind of application. -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
Re: Align to page
Author: Olav_Kvern
Date: Wed, 28 Jan 2009 23:50
Date: Wed, 28 Jan 2009 23:50
7 lines
929 bytes
929 bytes
Shane wrote: "If you want to run it from InDesign's panel, save it as a Compiled Script (Data Fork). If you want to make it a standalone app, save it as either kind of application." If you're running from the Scripts panel, I'm not aware of any advantage to saving as a compiled script over saving as a text file. What am I missing? Thanks, Ole
Re: Align to page
Author: Eric
Date: Thu, 29 Jan 2009 00:54
Date: Thu, 29 Jan 2009 00:54
9 lines
1060 bytes
1060 bytes
Add a label so you can change them all afterwards. Better yet, create a text style and then just set them to that. Something like this:
tell every page
set myTextBox to make new text frame with properties {geometric bounds:boxBounds, label:"myTextBox", contents:MyDocName}
end tell
set applied font of parent story of every text frame whose label = "slug" to font ("Monaco" & tab & "Regular") as string
set point size of parent story of every text frame whose label = "slug" to "8pt"
Re: Align to page
Author: Shane_Stanley
Date: Thu, 29 Jan 2009 22:29
Date: Thu, 29 Jan 2009 22:29
21 lines
2210 bytes
2210 bytes
On 29/1/09 10:50 AM, "Olav Kvern" <member@adobeforums.com> wrote: > If you're running from the Scripts panel, I'm not aware of any advantage to > saving as a compiled script over saving as a text file. What am I missing? Speed. If you save as text, the file has to be converted to AppleScript tokens before it's run. How much time this takes can vary from next to nothing to quite dramatic -- for example, if your script also addresses another app, it means loading another dictionary. You also lose the ability to use persistent properties, you're more susceptible to problems with terminology changes, and in some cases you risk problems with different text encodings. You also avoid some potential problems when moving between versions. Against that, I see few cons. The fact that you *can* run text files is a good thing, and in some cases useful. But as a default, IMO, it doesn't make sense. -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
Re: Align to page
Author: Olav_Kvern
Date: Thu, 29 Jan 2009 22:39
Date: Thu, 29 Jan 2009 22:39
11 lines
944 bytes
944 bytes
Hi Shane, I guess I've just been burned too often by compiled scripts. My scripts often need to reside on non-Mac OS systems, and I've just had too many compiled files get corrupted as they go back and forth. re: Speed Certainly I'd expect it to be slower, but I haven't noticed much of a speed difference with scripts that *don't* call other applications. Thanks, Ole
Re: Align to page
Author: Shane_Stanley
Date: Fri, 30 Jan 2009 07:23
Date: Fri, 30 Jan 2009 07:23
19 lines
2074 bytes
2074 bytes
On 30/1/09 9:39 AM, "Olav Kvern" <member@adobeforums.com> wrote: > I guess I've just been burned too often by compiled scripts. My scripts often > need to reside on non-Mac OS systems, and I've just had too many compiled > files get corrupted as they go back and forth. That was certainly a problem with the old resource-fork format, but now that everything is saved in the one fork (unless you want a bundle), there's much less risk. And if you use Script Debugger, it adds in a copy of the source text anyway, so it can be recovered that way. The other thing worth mentioning is that InDesign supports script bundles (.scptd). These are very useful for things like attachment scripts, because they give you a simple way to package (and find) external scripts called by do script. -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
Re: Align to page
Author: Shane_Stanley
Date: Fri, 30 Jan 2009 22:14
Date: Fri, 30 Jan 2009 22:14
17 lines
1799 bytes
1799 bytes
On 31/1/09 3:57 AM, "Kermy" <member@adobeforums.com> wrote: > I'm also thinking on making a version where I can drop multiple indd files > on it from the Finder. What's the best format for that - Application (.app)? Yes, that has to be an app. There are two kinds -- bundle apps are Cocoa native apps, and have some other advantages. > What/where is Script Debugger? It's a third-party script editor. You can download a copy from <www.latenightsw.com/> for evaluation. I recommend it highly. -- Shane Stanley <sstanley@myriad-com.com.au> AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads