Hi,
i`m using this script to search for words in my document:
set search_string to “eeee”
set replace_string to “somthing else”
tell application “QuarkXPress Passport”
tell document 1
tell text box 1
set search_ref to a reference to (every word of story 1 whose text of it = search_string)
set text of search_ref to replace_string
end tell
end tell
end tell
that works pretty good, but now I have to change the replace_string
into a inline picture-box with something like that:
make new picture box with properties {bounds:{20, 80, 60, 150}}
I found nothing in this bbs about that.
can sombody please help me?
Thanks
Dave
Hi
In version 3 of QuarkXPress that I use, it is not possible to simply insert objects in the text with the AppleScript code.
To do that, we must automate manual handling, namely, copy it to paste of the object in the text.
Here a small suggestion, handling is done in 3 stages :
- It is necessary, in first time, to copy the object with the drag tool selected.
- Afterwards, it is necessary to select the text box to be modified with the contents tool.
- Lastly, launche this small script. Its mission simply consists to select the text wished, then, to paste to its place the object being in the clipboard :
tell application "QuarkXPress 3"
activate
tell document 1
set Txt to "" & (text returned of (display dialog ¬
"The text to search :" default answer "" with icon 1))
set Nbr to count (every text of story 1 whose text of it is Txt)
repeat with Bcl from Nbr to 1 by -1
set selection to item Bcl of (every text of story 1 whose text of it is Txt)
paste
end repeat
end tell
end tell
Hi,
thank you very much, but unfortunately that doesnt work in Quark 6. I copied the picturebox, switched in Text-Selection mode and run the script. But the text won
t be replaced.
Did anyone has an idea?
Dave
Hi
Ok… i dont know XPress 6… I cannot help you more, sorry…
Hi Fredo,
I modified your script a little bit, and now It `s running.
But it could be a bit faster …
tell application “QuarkXPress Passport”
activate
tell document 1
set Txt to “” & (text returned of (display dialog ¬
“The text to search :” default answer “” with icon 1))
set Nbr to count (every word of story 1 of text box 1 whose text of it is Txt)
repeat with Bcl from Nbr to 1 by -1
select first text of (first word of story 1 of text box 1 whose first text of it is Txt)
paste
end repeat
end tell
end tell
Thanx
Dave
Hi Dave
I’m happy
Yea… it is because of the method used… but I did not find faster… :?
Perhaps with this new syntax (but I am not sure):
tell application "QuarkXPress™ 3"
activate
tell document 1
set Txt to "" & (text returned of (display dialog ¬
"Le texte à remplacer :" default answer "" with icon 1))
set TxtRef to a reference to ¬
(every text of story 1 of text box 1 whose text of it is Txt)
set Nbr to count TxtRef
repeat Nbr times
set selection to last item of TxtRef
paste
end repeat
end tell
end tell
Otherwise, we can try to inhibit displaying while avoiding activating the application and also by masking it, for example :
tell me
activate
set Txt to "" & (text returned of (display dialog ¬
"Le texte à remplacer :" default answer "" with icon 1))
end tell
tell application "Finder" to set visible of process "QuarkXPress™ 3" to false
tell application "QuarkXPress™ 3"
tell document 1
set TxtRef to a reference to ¬
(every text of story 1 of text box 1 whose text of it is Txt)
set Nbr to count TxtRef
repeat Nbr times
set selection to last item of TxtRef
paste
end repeat
end tell
end tell
tell application "Finder" to set visible of process "QuarkXPress™ 3" to true
tell application "QuarkXPress™ 3" to activate
Maybe… I hope