Solution scripting Quark

I’m stuck with this script:


try 
   tell application "Finder" to set the picFolder to (choose folder with prompt "Selecteer een map met afbeeldingen") as alias 
   try 
      set picList to list folder picFolder without invisibles 
   on error 
      display dialog "Error! could not set piclist to list folder" buttons {"Exit"} default button 1 with icon stop 
      return 
   end try 
on error 
   display dialog "Error! could not set alias for chosen folder" buttons {"Exit"} default button 1 with icon stop 
   return 
end try 

tell application "QuarkXPress Passport™" 
   activate 
   set docname to name of document 1 
   tell document docname 
      set view scale to fit page in window 
      repeat with ThisItem in ItemList 
         set selection to null 
         set ItemText to "Please locate the container for the following item:" & return & return & ThisItem 
         display dialog ItemText with icon note giving up after 1 

	try
          tell application "QuarkXPress Passport™" to repeat while current box is null 
            delay 2 
          end repeat 
          if box type of current box is picture box type then 
            set image 1 of current box to file (SourceFolder & ThisItem) 
          else if box type of current box is text box type then 
            set story 1 of current box to file (SourceFolder & ThisItem) 
          end if 
	end try

      end repeat 
   end tell 
   beep 3 
end tell

what it should do is:

  • ask to select a folder with images
  • ask to select a picture box
  • import the image in the selected picture box and continue untill all images are imported

but it’won’t work.
What is wrong with this script?

Can someone help me please?

In advance, thanks

Frederick -

There may be more to it than this, but you initialize picList at the top but reference ItemList below.

  • Dan

yeah, I know :slight_smile:

I changed that, but it still gives me an error…

You also set your ‘choose folder’ to picFolder and reference it as SourceFolder…

but to solve your problem, change:

set image 1 of current box to file (SourceFolder & ThisItem)

to

set image 1 of current box to file ((SourceFolder & ThisItem) as string)

This works with Quark 6, but I’m not sure about Passport.

thanks

I changed a few things in the script, and added your part to it

this is how the script works for me:


try 
   tell application "Finder" to set the picFolder to (choose folder with prompt "Select a folder with images") as alias 
   try 
      set picList to list folder picFolder without invisibles 
   on error 
      display dialog "Error! could not set piclist to list folder" buttons {"Exit"} default button 1 with icon stop 
      return 
   end try 
on error 
   display dialog "Error! could not set alias for chosen folder" buttons {"Exit"} default button 1 with icon stop 
   return 
end try 

tell application "QuarkXPress Passport™" 
   activate 
   set docname to name of document 1 
   tell document docname 
      set view scale to fit page in window 
       
      repeat with ThisItem in picList 
         set selection to null 
         set ItemText to "Selecteer een kader voor het volgende item:" & return & return & ThisItem 
         display dialog ItemText with icon note 
         repeat while selection is null 
         end repeat 
         try 
            set image 1 of current box to file ((picFolder & ThisItem) as string) 
             
            set selection to null 
         on error 
            display dialog "Het geslecteerde kader is geen illustratiekader" buttons {"Stop"} default button 1 with icon stop 
            quit script 
         end try 
      end repeat 
   end tell 
   beep 3 
end tell

As you see I’m working with Passport

but can you check if this will also work with Quark 6?
thanks

Using Quark 6.1 and Mac OS 10.3.7, your script works only when you change:

repeat while selection is null

to this:

repeat while current box is null

Hope this helps!

it helps, thanks!