Re: InDesign: how to move cursor by one place?
Re: InDesign: how to move cursor by one place?
- Subject: Re: InDesign: how to move cursor by one place?
- From: Stan Cleveland <email@hidden>
- Date: Mon, 25 Jun 2007 12:15:57 -0700
- Thread-topic: InDesign: how to move cursor by one place?
Title: Re: InDesign: how to move cursor by one place?
On 6/25/07 7:42 AM, Charles Arthur, UKClimbing Editor wrote:
> so I've got a single, simple problem. I want to convert URLs into tinyurls
> (http://tinyurl.com/) for print because they're shorter.
>
> I'm working in InDesign.
>
> Given a URL which is selected, it's very simple to get the tinyurl via curl.
> It's very easy to take the selected URL and turn it into a "note" which
> won't print.
> It's very easy to replace the original URL selection with the tinyurl - but
> I don't want to do that, because other people have to check the tinyurl
> against the original.
>
> So what I want to do is, given a selected URL
> -get its tinurl (can do that already)
> -turn the URL into a note (can do that already)
> -move the cursor one place to the right or left and paste the tinyurl in
> there. (CAN'T FIND ANYTHING IN THE DICTIONARY!)
>
> Seriously: does InDesign have *any* commands for moving the cursor about? I
> can't find anything. All I want to do is go one place forward or back.
Charles, this is a bit of a kludge, but it works:
tell application "Adobe InDesign CS2"
set selRef to object reference of selection of document 1
end tell
try
get xyzzy of selRef
on error errText
-- always errors
end try
-- get character offset, story id, and document name from object reference
set oldTIDs to AppleScript's text item delimiters -- store current TIDs
set AppleScript's text item delimiters to " character "
set x to (word 1 of text item 3 of errText) as integer
set AppleScript's text item delimiters to "story id "
set storyID to (word 1 of text item 2 of errText) as integer
set AppleScript's text item delimiters to "of document \""
set docName to text 1 thru -3 of text item -1 of errText
set AppleScript's text item delimiters to oldTIDs -- restore TIDs
-- use acquired info to set insertion point
tell application "Adobe InDesign CS2"
set selection to object reference of insertion point (x + 2) of story id storyID of document docName
end tell
HTH,
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden