Help with repeat loop anyone!!

Hi
I’m trying to select a bunch of files repeat thru them then create a quark
dock with the same amount of pages as files. then each page would have a picture box.
and a file would be placed into each picture box on each page… sounds simple right!!
well i think i’m almost there but really struggling not to get all my files in each picture box…
here’s the script so far…

set x to choose file with multiple selections allowed without invisibles
set f to count x
tell the application "QuarkXPress"
	activate
	set newdoc to make new document
	tell newdoc
		set page height to "100 mm"
		set page width to "100 mm"
		repeat f - 1 times
			try
				set newpage to make new page at end with properties {master spread:"Blank Single", horizontal measure:millimeters, vertical measure:millimeters}
			end try
		end repeat
		repeat with i from 1 to count of pages
			set picBox to make new picture box at beginning of page i with properties {bounds:{"0", "0", "100", "100"}}
			tell application "Finder"
				repeat with y in x
					--display dialog y as string
					set y to y as alias
					tell application "QuarkXPress"
						tell picBox --picture box 1
							--set rotation to -25
							set image 1 of picBox to y
						end tell
					end tell
				end repeat
			end tell
		end repeat
		
	end tell
end tell

an help or advice would be fantastic…
this is really doing my head in…

cheers

Hello

I am unable to test without Quark Xpress but, at first look these changes may help:

set x to choose file with multiple selections allowed without invisibles
set f to count x
tell the application "QuarkXPress"
	activate
	set newdoc to make new document
	tell newdoc
		set page height to "100 mm"
		set page width to "100 mm"
		repeat f - 1 times
			try
				set newpage to make new page at end with properties {master spread:"Blank Single", horizontal measure:millimeters, vertical measure:millimeters}
			end try
		end repeat
		repeat with i from 1 to count of pages
			set picBox to make new picture box at beginning of page i with properties {bounds:{"0", "0", "100", "100"}}
			
			repeat with y in x
				--display dialog y as string
				 set y to y as alias (* no need to tell Finder for that *)
				tell application "QuarkXPress"
					tell picBox --picture box 1
						--set rotation to -25
						set image 1  to y (* of picBox was redundant *)
					end tell -- to picBox
				end tell -- to QXP
			end repeat
		end repeat
		
	end tell -- to newDoc
end tell -- to QXP

Yvan KOENIG (from FRANCE dimanche 1 octobre 2006 14:04:44)

Hi Yvan

Nice Try!!:smiley:

But it didn’t work…
Thanks anyhow…

cheers

Hello

Difficult to guess what is wrong without the app.

Somethings botters me. May you try this one ?

set x to choose file with multiple selections allowed without invisibles
set f to count x
tell the application "QuarkXPress"
   activate
   set newdoc to make new document
   tell newdoc
       set page height to "100 mm"
       set page width to "100 mm"
       repeat f - 1 times
           try
               set newpage to make new page at end with properties {master spread:"Blank Single", horizontal measure:millimeters, vertical measure:millimeters}
           end try
       end repeat
       repeat with i from 1 to count of pages
           set picBox to make new picture box at beginning of page i with properties {bounds:{"0", "0", "100", "100"}}
           
           repeat with y in x
               --display dialog y as string
                set y to y as alias (* no need to tell Finder for that *)
              --  tell application "QuarkXPress"
                   tell picBox --picture box 1
                       --set rotation to -25
                       set image 1 to y (* of picBox was redundant *)
                   end tell -- to picBox
              --  end tell -- to QXP
           end repeat
       end repeat
       
   end tell -- to newDoc
end tell -- to QXP

May you post the log report?

Yvan KOENIG (from FRANCE dimanche 1 octobre 2006 19:22:10)

Hey! Jaques & Yvan

At Home now and don’t have quark on my machine here!
But starting early tomorrow so it will be the first thing i do…

Thanks in advance!!

Cheers…

pidge1, here is a script of mine for printing files of a folder which I think you can pull the lines of code you need from, a bit of extra stuff there too. The thing to get around is you always have a page 1 in a new Quark doc based on Master Page A. You can set this up by using the set default page before creating the new doc. Once you have this you place image 1 in this default page then use a repeat after this from item 2 of your list to add the required extra pages. I have only had time to alter some of the specifics to you sample but this should provide you with much of what you wanted.

set TodaysDate to do shell script "date \"+%d-%m-%y\""
--
set thepath to (choose folder with prompt "Choose Folder") as text
set ItemList to list folder thepath without invisibles
set FileList to {}
--
tell application "QuarkXPress"
	activate
	--
	tell default document 1 -- Set up your page defaults here.
		set page height to "100 mm"
		set page width to "100 mm"
		set left margin to "5 mm"
		set right margin to "5 mm"
		set top margin to "5 mm"
		set bottom margin to "5 mm"
		set automatic text box to false
		set guides showing to true
		set guides in front to true
		set horizontal measure to millimeters
		set vertical measure to millimeters
	end tell
	--
	make document at beginning -- Then make the doc.
	--
	tell document 1
		set bounds to {23, 80, 1150, 200} -- This just sets the view.
		set view scale to 50
	end tell
	--
	tell spread 1 of master document 1 -- Add your objects to the master page.
		make picture box at beginning with properties ¬
			{bounds:{"0 mm", "0 mm", "80 mm", "100 mm"}, color:"None"}
		make text box at beginning with properties ¬
			{bounds:{"85 mm", "0 mm", "100 mm", "100 mm"}}
		tell text box 1
			set color to "none"
		end tell
		tell story 1 of text box 1
			set contents of it to (item 1 of ItemList & return & TodaysDate) as text
			set font to "Frutiger 65 Bold"
			set size to 12
			set leading to 14
			set justification to centered
		end tell
	end tell
	--
	set ThisItem to item 1 of ItemList
	try
		tell page 1 of document 1 -- Add the first item to the default page.
			set image 1 of picture box 1 to alias (thepath & (ThisItem))
			set angle of image 1 of picture box 1 to "25"
		end tell
	on error
		beep
	end try
	--
	repeat with x from 2 to count of ItemList -- Now use the repeat loop for the rest.
		set ThisItem to item x of ItemList
		tell document 1
			make new page at end
			set page x to current page
			try
				set image 1 of picture box x to alias (thepath & (ThisItem))
				set angle of image 1 of picture box x to "25"
				tell story 1 of text box 1 of page x
					set contents of it to (item x of ItemList & return & TodaysDate) as text
				end tell
			on error
				beep
			end try
		end tell
	end repeat
	--
	set guides showing of document 1 to false
	--
	tell print setup of document 1 -- Set the print options
		set printer type to "Xerox DocuColor3535"
		set paper size to "A4 SEF"
		set orientation to landscape
		set page position to center position
		set print colors to composite CMYK
		set print spreads to false
		set reduce or enlarge to "100%"
		set registration marks to off
	end tell
	--
	print document 1 copies 2 -- Print
	close document 1 saving no -- Done it's job and gone!!!
	--
end tell

Hey Guys

Thanks for all the replies!!
jacques yours worked perfectly…! Thanks
i think your turning into my personal applescript problem solver.
Cheers…

I need to have a look at everyone else’s but am very busy at the mo…
will get back to you guys…

thanks