Re: Replace with different text or by using counter
Re: Replace with different text or by using counter
- Subject: Re: Replace with different text or by using counter
- From: Jay Young <email@hidden>
- Date: Mon, 20 May 2002 19:43:40 -0500
Hi Elmer,
If you have a huge Quark document, this might take some time since it's
looking through each word, but it might at least give you some ideas.
Hope it helps.
Jay
-------------------------------------------------------------
tell application "QuarkXPress"
tell story 1 of text box 1 of document 1
set LibName to "LIBRARYNAME"
set Cnt to count of (every word where it is "LIBRARYNAME")
set x to 1
repeat with i from 1 to count of words
if x = (Cnt + 1) then
exit repeat
else
if word i is LibName then
set word i to "FG" & x
set x to x + 1
end if
end if
end repeat
try
set i to 1
repeat 9 times
set every word where it is "FG" & i to "FG0" & i
set i to i + 1
end repeat
end try
end tell
end tell
-------------------------------------------------------------
On Thursday, May 16, 2002, at 04:50 PM, Elmer Banate wrote:
>
Hi to all,
>
>
I need to replace the word "LIBRARYNAME" in my quark document to the
>
name of
>
items in the library I created.
>
The script must replace not one replace string. example "LIBRARYNAME"
>
will
>
be replaced to "FG01" after replacing the first word ("LIBRARYNAME") in
>
the
>
next replace is "FG02" and soon, depending on how many occurrences, if
>
"LIBRARYNAME" occurred 22 time the last replacement text is "FG22".
>
>
I'm trying to use counter but my counter doesn't work.
>
I suspect the my problem is around here:
>
set (every text of stories where it is search_string) to replace_string
>
--------
>
>
tell application "QuarkXPress 4.11"
>
set FigName to "FG0"
>
tell document 1
>
try
>
set LibName to every text of every story where it is
>
"LIBRARYNAME" as list
>
end try
>
>
set ctr to 1
>
repeat with i from 1 to the number of items in LibName
>
set search_string to item i of LibName
>
set replace_string to FigName & ctr as string
>
try
>
set (every text of stories where it is search_string) to
>
replace_string
>
set ctr to ctr + 1
>
end try
>
end repeat
>
end tell
>
end tell
>
>
TIA
>
>
Regards
>
elmer
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.