🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8677

AS Cant make number into integer?

#8677
From: KEVINP1
Date: Fri, 29 Sep 2006 02:01
95 lines
4412 bytes
Hi
Ive been trying to get a number ie; 55.5 or 64.3 or 45.2 etc etc, numbers that have . whatever after them to work in my script but cannot, I can use whole numbers ie: 55 or 64 or 45, these work fine.

I have tried using "as real", "as number" but have had no luck.
the error I keep getting back is:

Can't make 55.5 into type integer. (-1700)

their is only one line in the script that uses the 55.5 etc, and that is

set y to (contents of text field "pulllength" of _window as real)

any ideas appreciated.

Kev

on clicked theObject
	if name of theObject is "cancel" then
		quit
	end if
	if name of theObject is "build" then
		set _window to window of theObject
		set y to (contents of text field "pulllength" of _window as real) --as real
		set x to (contents of text field "polwidth" of _window as real)
		set w to (contents of text field "winwidth" of _window as real)
		set h to (contents of text field "winheight" of _window as real)
		----------
		set _step to (contents of text field "step" of _window as real)
		set myStep to (contents of text field "pulllength" of _window as real)
		set _newHeight to (contents of text field "pulllength" of _window as real)
		----------
		tell application "Adobe InDesign CS2"
			set myDocument to make document
			tell myDocument
				tell document preferences
					set page height to y
					set page width to x
					set page orientation to landscape
					set pages per document to 1
				end tell
				set {a, b, c, d} to bounds of page 1
				set myRectangle_1 to make rectangle with properties {geometric bounds:{0, 0, h, w}, label:"Main Window"}
				set corner effect of page item 1 to rounded corner
				set corner radius of page item 1 to 4.6999
				set stroke weight of page item 1 to 0.25
				set {w, x, y, z} to geometric bounds of myRectangle_1
				move myRectangle_1 by {(d / 2 - (x + z) / 2), (c / 2 - (w + y) / 2)}
				----------
				set myRectangle_2 to duplicate myRectangle_1
				set {w, x, y, z} to geometric bounds of myRectangle_2
				set geometric bounds of myRectangle_2 to {w - 2, x - 2, y + 2, z + 2}
				set myRectangle_3 to duplicate myRectangle_2
				----------
				set myRectangle_4 to duplicate myRectangle_1
				----------
				set geometric bounds of myRectangle_4 to {a + 2, b + 2, c - 2, d - 2}
				set corner radius of page item 2 to 0
				----------
				set myCompoundPath to make compound path myRectangle_2 with myRectangle_4
				set myNewColor to make color
				tell myNewColor
					set model to process
					set space to CMYK
					set color value to {0, 50, 0, 0}
					set name to "GUMMER 50%"
				end tell
				set fill color of myCompoundPath to myNewColor
				----------step and repeat----------
				tell application "Adobe InDesign CS2"
					set myDocument to active document
					tell myDocument
						tell document preferences
							set page height to (_newHeight * _step)
							set {y, x, l, h} to geometric bounds of myCompoundPath
							repeat with I from myStep to (myStep * _step - 1) by myStep
								duplicate myCompoundPath
								move myCompoundPath to {x + 0, y + I}
							end repeat
							----------------move the page items--------------
							tell application "Adobe InDesign CS2"
								set a_Doc to active document
								set a_Sel to page items of a_Doc
								tell a_Doc
									set _newsel to make group with properties {group items:a_Sel}
									move _newsel to {2, 2}
								end tell
							end tell
							------------------------------
						end tell
					end tell
				end tell
			end tell
		end tell
	end if
end clicked
Technical Details
Message-ID: <3bc1d19a.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.icl.net!news-lond.gip.net!news.gsl.net!gip.net!news.tele.dk!news.tele.dk!small.news.tele.dk!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!news.albasani.net!news.isoc.lu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,252e4f6a361f8985,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: KEVINP1@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.icl.net!news-lond.gip.net!news.gsl.net!gip.net!news.tele.dk!news.tele.dk!small.news.tele.dk!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!news.albasani.net!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: AS  Cant make number into integer?
Message-ID: <3bc1d19a.-1@webcrossing.la2eafNXanI>
Date: Thu, 28 Sep 2006 19:01:25 -0700
Lines: 106
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit