02-19-2013 05:30 AM
Hi,
I created a dialog which load folder files and when i click the button i run another script by StartScript(...) command
How could i pass my arguments to the script (the files paths)?
Thanks
Solved! Go to Solution.
02-19-2013 08:13 AM
Hi OzShimon
All variables that a declared in the "Declaration part" are also available in subscripts. The "Declaration part" is the very top script part outside of any procedure. These variables are global variables.
They have to defined with dim, but can be changed everywhere. Of course you can call subfunctions with parameters like "Call MySub(ParamOne, ParamTwo)"
Hope this helps
Winfried
02-19-2013 08:34 AM
Hi Winfried,
That not what i meant.
For example:
**My dialog contains one button and event click
the dialog code:
Dim obj
Sub Button1_EventClick(ByRef This)
obj= "Hello World"
Call ScriptStart("C:\Users\Oz\Desktop\test.vbs")
End Sub
**the script code(test.vbs):
Call MsgBox(obj)
I want to pass the- obj parameter to the test.vbs script .
How i do it?
Thanks
02-19-2013 09:23 AM
Hi OzShimon
Why do you use ScriptStart. You can use Scriptinclude instead. Then you can use parameters as well. Please look at
http://zone.ni.com/reference/en-XX/help/370858K-01/comoff/scriptinclude/
for the differences.
Winfried
02-19-2013 09:45 AM
Hey OzShimon,
As long as you use a Diadem predefined global variables (T1,T2,....) you would be fine. You can also define user variables (.VAS files) or even declare your own global variables with : Call GlobalDim("Myname").
These variables will not be re-initialized until you restart the script engine. So just changing "obj" for T1 your test should work
'Dim obj
Sub Button1_EventClick(ByRef This)
T1= "Hello World"
Call ScriptStart("C:\Users\Oz\Desktop\test.vbs")
End Sub
**the script code(test.vbs):
Call MsgBox(T1)
Regards,
Javier
02-19-2013 10:43 AM
Sorry for this second post but i missed to say that I totally agree with winner, using scripInclude seems to be the best option to pass parameters between script. However i giev you some info about the global variables cause migth be interesting if you want to pass info between dialog box...
Regards,
Javier
02-19-2013 11:00 AM
Thanks to all of you,
I decided to use: Call GlobalDim(....) because i need to passing parameters from dialog to script, but all the others options working .
02-25-2013 11:16 PM
Hi,
i succeeded to declare user variables with Call GlobalDim("myVar") but how could i declare an array of strings with GlobalReDim ?
It's give me an error.
I tried: *Call GlobalReDim("myArray(2)")
Thanks
02-25-2013 11:16 PM
Hi,
i succeeded to declare user variables with Call GlobalDim("myVar") but how could i declare an array of strings with GlobalReDim ?
It's give me an error.
I tried: *Call GlobalReDim("myArray(2)")
Thanks
02-26-2013 07:31 AM
Try it out;
f Not ItemInfoGet("MyArray") Then Call GlobalDim("MyArray")
GlobalReDim "MyArray(20,20)"
Javier