Hello Forum, how can i get an int value in my code from another script ? is that possible in dxl ?
Regards, Control17 - Wed Aug 30 03:52:10 EDT 2017 |
Re: get int value from another module Not sure why you need that. Perhaps you are looking for functions? (DXL manual, Introduction -> Declarations -> Function definitions)? |
Re: get int value from another module Mike.Scharnow - Wed Aug 30 05:20:46 EDT 2017 Not sure why you need that. Perhaps you are looking for functions? (DXL manual, Introduction -> Declarations -> Function definitions)? thank u for your reply, sorry " get int value from another script" , i want to run many scripts one by one . i need to hole int count from the first script and use infoBox .
eval_ "#include <c:/path/to/dxl 1.dxl>"
if (count > 0 ){
infoBox ("result not ok .")}
else{ infoBox ("run next script!" )
eval_ "#include <c:/path/to/dxl 2.dxl>"
}
Regards,
|
Re: get int value from another module Control17 - Wed Aug 30 05:37:50 EDT 2017 thank u for your reply, sorry " get int value from another script" , i want to run many scripts one by one . i need to hole int count from the first script and use infoBox .
eval_ "#include <c:/path/to/dxl 1.dxl>"
if (count > 0 ){
infoBox ("result not ok .")}
else{ infoBox ("run next script!" )
eval_ "#include <c:/path/to/dxl 2.dxl>"
}
Regards,
I still do not see why you don't restructure your code. put the code of dxl 1.dxl into a function with a meaningful name like
bool checkDataIntegrityDeletedObjects(){
// do the checks of dxl 1
if "ok" then return true else return false
}
bool checkDataIntegrityModuleStructure(){
... // checks of dxl 2
}
if (!checkDataIntegrityDeletedObjects()) {
print "Error concerning deleted objects. Aborting checks"
halt
}
if (!checkDataIntegrityModuleStructure()){
print "Error concerning module structure. Aborting checks"
halt
}
With this scenario, you could even reuse the skip list that you create in some of your scripts
Regards |
Re: get int value from another module Mike.Scharnow - Wed Aug 30 06:19:11 EDT 2017 I still do not see why you don't restructure your code. put the code of dxl 1.dxl into a function with a meaningful name like
bool checkDataIntegrityDeletedObjects(){
// do the checks of dxl 1
if "ok" then return true else return false
}
bool checkDataIntegrityModuleStructure(){
... // checks of dxl 2
}
if (!checkDataIntegrityDeletedObjects()) {
print "Error concerning deleted objects. Aborting checks"
halt
}
if (!checkDataIntegrityModuleStructure()){
print "Error concerning module structure. Aborting checks"
halt
}
With this scenario, you could even reuse the skip list that you create in some of your scripts
Regards thank u for your reply , i just want to know if i can call the global variable in dxl1 and dxl 2 in mein code ?
Regards,
|
Re: get int value from another module Control17 - Thu Aug 31 03:05:18 EDT 2017 thank u for your reply , i just want to know if i can call the global variable in dxl1 and dxl 2 in mein code ?
Regards,
Hello Neven,
No, eval_ creates its own dxl context. In a code like main: string a = "lolo" eval_ "#include <c:/temp/a.dxl>" print a print b // does not work a.dxl: print a // does not work string b = "lala" a.dxl has no access to string a and the main program has no access to string b. Also, separate programs are no functions and cannot return any value. If you really really really want to have separate programs and need to communicate somehow, you can for examle write the result of your sub-script to a file and in the main program read the content of the file. Not worth the effort in my opinion.. |
Re: get int value from another module Mike.Scharnow - Thu Aug 31 05:43:50 EDT 2017 Hello Neven,
No, eval_ creates its own dxl context. In a code like main: string a = "lolo" eval_ "#include <c:/temp/a.dxl>" print a print b // does not work a.dxl: print a // does not work string b = "lala" a.dxl has no access to string a and the main program has no access to string b. Also, separate programs are no functions and cannot return any value. If you really really really want to have separate programs and need to communicate somehow, you can for examle write the result of your sub-script to a file and in the main program read the content of the file. Not worth the effort in my opinion.. thank u . Regards, Neven |