insert a discretionary return
-
- Posts: 279
- Joined: 12 Oct 2004, 14:01
insert a discretionary return
I've been trying for hours to find even the basic information I need to make this script, and just can't come up with it. Is it possible to create an applescript that will replace every instance of "/" in my selected text with the slash plus a discretionary return (option-\)?
-
- Posts: 1172
- Joined: 23 Nov 2004, 04:30
Re: insert a discretionary return
Hi! Give this a try:
HTH.
Code: Select all
property DiscRet : character id 7 --«data utxt0007» as Unicode text -- U+0007; 7
tell application "QuarkXPress9"
tell document 1
tell story 1 of current box
set every text where it is "/" to DiscRet
end tell
end tell
end tell
Jean-Marie Schwartz
= Mac Pro Quad-Core Intel 2.8 GHz • 10 Go 1066 MHz DDR3 • Mac OS 10.10.5 • QuarkXPress 9.5.4.1 + QuarkXPress 2017 • Adobe CS5 =
= Mac Pro Quad-Core Intel 2.8 GHz • 10 Go 1066 MHz DDR3 • Mac OS 10.10.5 • QuarkXPress 9.5.4.1 + QuarkXPress 2017 • Adobe CS5 =
-
- Posts: 279
- Joined: 12 Oct 2004, 14:01
Re: insert a discretionary return
Thanks. That's closer, but not quite what I need. I need to keep the slash and also have a discretionary return. This version (below) using the unicode you provided works except it's using soft returns, not discretionary returns. I can't find the correct code for a discretionary return or I think it would work. (BTW, in my original post I typed the WRONG keystroke for the discretionary return. Brain fart. I meant command-return for the discretionary return)
property DiscRet : character id 7 --«data utxt0007» as Unicode text -- U+0007; 7
tell document 1 of application "QuarkXPress"
tell selection
set every text where it is "/" to "/" & DiscRet
end tell
end tell
property DiscRet : character id 7 --«data utxt0007» as Unicode text -- U+0007; 7
tell document 1 of application "QuarkXPress"
tell selection
set every text where it is "/" to "/" & DiscRet
end tell
end tell
-
- Posts: 279
- Joined: 12 Oct 2004, 14:01
Re: insert a discretionary return
I think I figured it out. With a bit more research I discovered that the discretionary return in Quark is technically a "zero-width space." Found the code for that and this script now works.
Code: Select all
tell document 1 of application "QuarkXPress"
tell selection
set every text where it is "/" to "/" & {character id 8203}
end tell
end tell
-
- Posts: 1172
- Joined: 23 Nov 2004, 04:30
Re: insert a discretionary return
Sorry for the misunderstanding.
Wonderful how you dealt with it! Congrats and enjoy!
Wonderful how you dealt with it! Congrats and enjoy!
Jean-Marie Schwartz
= Mac Pro Quad-Core Intel 2.8 GHz • 10 Go 1066 MHz DDR3 • Mac OS 10.10.5 • QuarkXPress 9.5.4.1 + QuarkXPress 2017 • Adobe CS5 =
= Mac Pro Quad-Core Intel 2.8 GHz • 10 Go 1066 MHz DDR3 • Mac OS 10.10.5 • QuarkXPress 9.5.4.1 + QuarkXPress 2017 • Adobe CS5 =