🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20765

REALBasic: Support Only for Integer and String Perams

#20765
From: Benny Johnson
Date: Wed, 05 Jun 2002 21:55
67 lines
3527 bytes
Hey folks, 

I'm tinkering with REALbasic and ID 2.0.1, attempting to build a simple user interface for an AppleScript script. However, I'm running into a problem. I need to pass a few values from RB to ID, such as the spread width and height, but nothing happens when I  run the RB script. Let me post a little of the RB code and then I'll post some of the AppleScript code: 


 The REALbasic code (that doesn't even run) is as follows: 

 Sub Action()
   Dim dblYDimOfSpread As Double
   Dim dblXDimOfSpread As Double 
   Dim dblYSpacingFactor As Double 
   Dim dblXSpacingFactor As Double 
   

//the following are just EditField controls
   dblYDimOfSpread = CDbl(txtPageHeight.Text)
   dblXDimOfSpread = CDbl(txtPageWidth.Text)
   dblYSpacingFactor = CDbl(txtVerticalSpacingFactor.Text)
   dblXSpacingFactor = CDbl(txtHorizontalSpacingFactor.Text)
   

   AIPAOSXrev1compiledScript dblYDimOfSpread, dblXDimOfSpread, dblYSpacingFactor, dblXSpacingFactor
 End Sub

 REALbasic gives an error saying that "Only integer and string perameters are supported for scripts". So, I tired the following coercion: 

 Sub Action()
   Dim dblYDimOfSpread As Integer
   Dim dblXDimOfSpread As Integer
   Dim dblYSpacingFactor As Integer
   Dim dblXSpacingFactor As Integer
 
//the following are just EditField controls
   dblYDimOfSpread = CDbl(txtPageHeight.Text)
   dblXDimOfSpread = CDbl(txtPageWidth.Text)
   dblYSpacingFactor = CDbl(txtVerticalSpacingFactor.Text)
   dblXSpacingFactor = CDbl(txtHorizontalSpacingFactor.Text)
 
 AIPAOSXrev1compiledScript dblYDimOfSpread, dblXDimOfSpread, dblYSpacingFactor, dblXSpacingFactor 

 And here is some of the AppleScript

 on run {dblScalingFactor, dblXDimOfSpread, dblYDimOfSpread, dblYSpacingFactor}
 	tell application "InDesign 2.0.1"
 	activate
 		set currentPublication to make new document
 		tell currentPublication
 			set horizontal measurement units of view preferences to inches
 			set vertical measurement units of view preferences to inches
 			set currentDocPrefs to document preferences
 			tell currentDocPrefs
 				set pages per document to 1
 				set pages per spread to 1
 				set page height to dblYDimOfSpread
 				set page width to dblXDimOfSpread
 			end tell
 		end tell
 display dialog dblYDimOfSpread--this returns 0 instead of whatever number I enter in the appropriate field in my GUI if I use the second RB code example
 	end tell
 end run
 
 How is it, then, that anyone is able to use REALbasic for InDesign/AppleScript scripting? It's obviously necessary to be able to use decimal values for mathematical calculations (i.e. not Integers). How might one go about circumventing this limitation in REALbasic? 

 Thanks a lot, any advice is greatly appreciated!
 

-Benny
Technical Details
Message-ID: <ef8f2ce.-1@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,65f0de717439eddb,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-06-05 15:07:50 PST
From: "Benny Johnson" <allstarx22@aol.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: REALBasic: Support Only for Integer and String Perams
Message-ID: <ef8f2ce.-1@WebX.aaQKaf7vad4>
Date: Wed, 5 Jun 2002 14:55:05 -0700
Lines: 69
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit