Author Topic: Making this script into a droplet that could find every text box.  (Read 1356 times)

0 Members and 1 Guest are viewing this topic.

Offline iBabs

  • Visitor
  • Posts: 2
  • Karma: 0
Hello,

I have a script here that runs on any currently selected text box in Quark. It basically runs a find and change.

I would love to be able to turn this into a droplet, that would open any quark files that are dropped onto it, search for each text box on every page of the document, perform the script here and just leave the file open, so that I could check it.
Can any one help me with this...Thanks!!
babs


Code: [Select]
set digits to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
tell document 1 of application "QuarkXPress"
tell story 1 of current box
set myDollars to object reference of every text where it is "$"
end tell

repeat with myPrice in reverse of myDollars
if (character after myPrice is in digits) and (character after character after myPrice is in digits) and (character after character after character after myPrice is in digits) then
set character after myPrice to "0"
set character after character after myPrice to "0"
set character after character after character after myPrice to "0"
end if
end repeat
end tell


thanks!!!

Offline Jean-Marie Schwartz

  • Sr. Member
  • ****
  • Posts: 436
  • Karma: 6
  • Gender: Male
Re: Making this script into a droplet that could find every text box.
« Reply #1 on: March 05, 2010, 03:02:24 AM »
Hi! You'll find the scheme of a droplet here. HTH.
Then you can either copy your script in a tell block inside of the tell app block or as a handler (see Michel's example).
Jean-Marie Schwartz
May the Schwartz be with you :-)

= Mac Pro Quad-Core Intel 2.8 GHz 10 Go 1066 MHz DDR3 Mac OS 10.8.5 QuarkXPress 9.5.4.1 Adobe CS5 =

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: Making this script into a droplet that could find every text box.
« Reply #2 on: March 05, 2010, 03:31:03 PM »
Hi Babs,

This should get you going:

Quote
001     property digits : {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}

002     on open of theDocs
003          repeat with ThisDoc in theDocs
004               tell application "QuarkXPress Passport 7.x"
005                    try
006                         open ThisDoc
007                         set DocName to name of document 1
008                         tell me to Zero_Dollar(DocName)
009                         close document DocName with saving
010                    end try
011               end tell --application "QuarkXPress Passport 7.x"
012          end repeat --with ThisDoc in theDocs
013     end open

014     on Zero_Dollar(DocName)
015          tell application "QuarkXPress Passport 7.x"
016               tell document DocName
017                    repeat with s from 1 to count of story
018                         tell story s
019                              try
020                                   set myDollars to (object reference of every text where it is "$")
021                                   
022                                   repeat with myPrice in reverse of myDollars
023                                        if (character after myPrice is in digits)
024                                             and
025                                             (character after character after myPrice is in digits)
026                                                  and
027                                             (character after character after character after myPrice is in digits) then
028                                             
029                                             set character after myPrice to "0"
030                                             set character after character after myPrice to "0"
031                                             set character after character after character after myPrice to "0"
032                                        end if -- following 3 chars are digits
033                                   end repeat --with myPrice in reverse of myDollars
034                              end try
035                         end tell --story s
036                    end repeat -- with s from 1 to count of story
037               end tell -- document DocName
038          end tell --application "QuarkXPress Passport 7.x"
039     end Zero_Dollar

I haven't tested it but it should run ok ;-)

HTH
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5