几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   PC-DMIS二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=153)
-   -   【转帖】No ENDSCRIPT? (http://www.dimcax.com/hust/showthread.php?t=1573)

huangyhg 2007-11-26 11:28 AM

【转帖】No ENDSCRIPT?
 
I'm desparately trying to get the sample code running in 4.2. Using the code editor, I create a sample file, testscript.bas:

Sub main

Dim app As Object
Set app = createobject("PCDLRN.Application")
Dim part As Object
Set part = app.activepartprogram
Dim var As Object
Set var = part.getvariablevalue("V2")
If Not var is Nothing Then
msgbox "Starting Script = " & var.longvalue
var.longvalue = var.longvalue + 1
msgbox part.setvariablevalue("V2", var)
Else
msgbox "Var not there"
End If
End Sub

The code in the part program:

C2 =COMMENT/INPUT,NO,'Enter V2'
ASSIGN/V2 = INT(C2.INPUT)
CS1 =SCRIPT/FILENAME= C:\PROGRAM FILES\WAI\PC-DMIS V42\TESTSCRIPT.BAS
FUNCTION/Main,SHOW=YES,,
STARTSCRIPT/
COMMENT/OPER,NO,variable is now
,V2

********

If I highlight and run the above block, nothing appears to happen. For instance, I set the variable to 99, run the block, and it comes back saying that the variable is 99.

If I just run the basic code, I get a msgbox saying that it is 99, then one saying "true" (the assignment was successful??). If I run the code again, it says that the value is 100, then 101, then 102. But nothing happens to the variable inside the program.

The example shows a line saying "ENDSCRIPT/", but no such line appears in my code window. I'm suspecting this is the problem here, but can find now way to insert that code in the program.

Any thoughts? I forgot how fun BASIC was, with no debugger, tools, etc.

TIA, tweaks

huangyhg 2007-11-26 11:28 AM

回复: 【转帖】No ENDSCRIPT?
 
Finally called the help desk, and I hadn't marked the script! It ran the comments OK, but not the script. Once I marked it, the /ENDSCRIPT line came up by itself.
tweaks


所有的时间均为北京时间。 现在的时间是 01:56 AM.