Problem converting characters

I nearly have this complete but I can’t get two parts working.

For some reason the script won’t convert character 1 of a text file to an integer and I do not know how to select text box 1 and text box 2 at the same time and “Group” them.

Here is my code:


global textBoxList
set newBoxList to ""
set textBoxList to {}
set heightDWBox to ""
set thisList to ""
set thisPage to ""
set numberList to {"1", "2", "3", "4", "5"} as text

set alphaList to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", �
	"q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
set newBoxName to ""

--2) Get list from text export
set exportList to (choose file with prompt �
	"Choose the export for this section." of type {"TEXT"}) as text

tell application "QuarkXPress� 4.11"
	activate
	make document at beginning with properties {page width:"51p", page height:"66p", top margin:"3p", left margin:"3p", bottom margin:"3p", right margin:"3p", automatic text box:true}
	tell document 1
		if not (text box 1 exists) then
			make text box at beginning with properties {bounds:{"3p", "3p", "60p", "48p"}}
		else
			set bounds of text box 1 to {"3p", "3p", "60p", "48p"}
		end if
		--tell document 1
		set story 1 to alias exportList
		tell story 1
			repeat with i from 1 to (count of paragraphs)
				set thisGuy to contents of paragraph i as text
				set newBoxList to (newBoxList & thisGuy) as list
				set thisGuy to {}
			end repeat
		end tell
		close saving no
		
	end tell
	
	set createBox to ""
	repeat with n from 1 to count of items of newBoxList
		set createBox to item n of newBoxList as text
		try
			if first character of createBox is in (alphaList as text) then
				my makePage(createBox)
			end if
		end try
		try
			if first character of createBox is in (numberList as text) then
				set newBoxName to createBox as string
				

This part doesn’t work for number 1. The other numbers work. It converts 1 to 1.866 but then it will not create the box?


				set widthDWBox to (character 1 of createBox) as integer --newBoxName
				if widthDWBox = 1 then
					set widthDWBox to 1.866
				else
					if widthDWBox = 2 then
						set widthDWBox to 3.9
					else
						if widthDWBox = 3 then
							set widthDWBox to 5.933
						else
							if widthDWBox = 4 then
								set widthDWBox to 7.967
							else
								if widthDWBox = 5 then
									set widthDWBox to 10
								end if
							end if
						end if
						--	end if
					end if
					set heightDWBox to character 3 of newBoxName as integer
					
					
					tell document 1
						tell page 1
							make new text box at beginning with properties �
								{bounds:{"0"", "-3"", heightDWBox, (widthDWBox - 3)}, color:"white", frame:{color:"black", style:solid, width:"0.25 pt"}}
							try
								tell text box 1
									set story 1 to createBox as text
								end tell
							end try
							copy (origin of bounds of text box 1 as list) to {yorigin, xorigin}
							set b to "Circle No. xxx on Reader Service Card" as text
							make new text box at beginning with properties �
								{bounds:{heightDWBox, "-3"", (heightDWBox + 0.399), (widthDWBox - 3)}} --, color:"none", frame:{color:"none"}}
							tell text box 1
								set story 1 to b as text
								set style sheet of paragraph 1 to "LittleBox"
								set vertical justification of current box to centered
							end tell -- text box

Here, I need to group the two new boxes but only with each other, not with all the boxes on the page.


							set selectedBoxes to (text box 1 & text box 2)
							select selectedBoxes
							
							TypeText "G" with Command
						end tell -- page
					end tell -- document
					
					--end tell
					--set newBoxName to thisItem as string
				end if
			end if
		end try
	end repeat
end tell
--end if

--on makeBoxes(thisItem, thisPage)


--end makeBoxes

on makePage(thisItem)
	tell application "QuarkXPress� 4.11"
		set x to thisItem as text
		tell document 1
			make new page at beginning
			--set thisPage to page 1
			make new text box at beginning of page 1 with properties {shape:rectangular, bounds:{"2.107"", "2"", "2.506"", "6""}}
			tell text box 1
				set story 1 to x as text
				set style sheet of paragraph 1 to "BigBox"
				set vertical justification of current box to centered
				set color to "Org" --of document 1  --of current box 
				set shade to "100%" --of current box 
			end tell
		end tell
	end tell
	return thisPage
end makePage

AS 1.6
OS 9.2.2
Quark 4.11

*Moving soon to OS X and either Quark 6 or InDesign CS. I’ll worry about that later.

Thank you all,

Steven.

Hi Steven,

You have in the second part : “-- end if”. Just remove the “–” and remove one of the “end if” at the end of your script. It will work for “widthDWBox = 1”.

I did this :


tell application " Passport™ 4.04 "
	activate
	tell document 1
		  tell page 1
			  set tool mode to drag mode
			  select text box 1
				select text box 2
			TypeText "g" with Command
		  end tell -- page 
	 end tell -- document 
end tell

Sometimes it works, sometimes not ( 1 text box selected only) and sometimes x-Press quit.
I was not able to find why. A problem with my version?
You should make a try, maybe you have more luck with your QXP.