DXL "System" command on Windows

I would like to call the DXL "system" command to delete a directory structure on a Windows box as a quick way to start fresh on my database export. My script then recreates the directory structure and starts populating it with modules exported from the DOORS database.

The problem is that deleting hundreds of files and graphics along with all the folders takes several minutes and so I need the DXL to wait until it has finished before it continues to recreate the folder structure and populate. I couldn't find a way under Windows to get it to wait (the Unix version has a parent and child process for the system command but Windows doesn't.)

So, is there a way to force the DXL to wait until the DXL "system" command has completed?
ZenMonkey760 - Wed Feb 24 13:52:16 EST 2010

Re: DXL "System" command on Windows
Mathias Mamsch - Wed Feb 24 14:02:11 EST 2010

You might want to try the

int win32SystemWait_ (string commandString, string& sResult, int waitTime, Skip envString)

 


perm which will do exactly what you want (I think waitTime=0 will make it wait forever) ...

Regards, Mathias

 

Re: DXL "System" command on Windows
ZenMonkey760 - Wed Feb 24 15:03:46 EST 2010

Mathias Mamsch - Wed Feb 24 14:02:11 EST 2010

You might want to try the

int win32SystemWait_ (string commandString, string& sResult, int waitTime, Skip envString)

 


perm which will do exactly what you want (I think waitTime=0 will make it wait forever) ...

Regards, Mathias

 

Where can I find some reference to this?

How does it get used? I have tried a few different ways to call it, but got nothing but errors.

Re: DXL "System" command on Windows
doors36677 - Wed Feb 24 15:07:14 EST 2010

ZenMonkey760 - Wed Feb 24 15:03:46 EST 2010
Where can I find some reference to this?

How does it get used? I have tried a few different ways to call it, but got nothing but errors.

Here is perhaps a more useful form:

int win32SystemWait_(string commandString,string& sResult, int waitTime)

No documentation but you can find some reference on the old forum files.

Re: DXL "System" command on Windows
llandale - Wed Feb 24 15:31:19 EST 2010

I was unable to make that win32Wait stuff work; perhaps some Windows settings I do not understand. Other folks have used it with success.

I've got a 'system' command that I must wait for, so after the 'system' call I just issue an 'ack(Wait for black window to close...). You could do the same, with some detailed instructions to the user about getting out and back into the folder to make sure its empty, and THEN OK the ack.

  • Louie

Re: DXL "System" command on Windows
Mathias Mamsch - Thu Feb 25 10:54:36 EST 2010

llandale - Wed Feb 24 15:31:19 EST 2010
I was unable to make that win32Wait stuff work; perhaps some Windows settings I do not understand. Other folks have used it with success.

I've got a 'system' command that I must wait for, so after the 'system' call I just issue an 'ack(Wait for black window to close...). You could do the same, with some detailed instructions to the user about getting out and back into the folder to make sure its empty, and THEN OK the ack.

  • Louie

This works for me:
 

string result = ""
print win32SystemWait_ ("notepad.exe", result, -1)
print "Thanks: " result "\n"

 


Regards, Mathias

 

Re: DXL "System" command on Windows
C124id - Sat Jan 22 10:58:58 EST 2011

Your post was helpful for us.

We have a similar problem !!

If you have deleted the Windows files from a DXL script, can you share the method with me. Following code does not work for me. I use a Windows XP OS - NTFS; we are trying to delete a file from a Windows share.

This does not throw any error; a console pops-up and closes immediately.
 

string Windows_Share = "//srti008a.xyz.com/Testing/*.*"
string commandexe = "c:/windows/system32/cmd.exe /c del /Q /F " "\"" Windows_Share "\""
system (commandexe)

Re: DXL "System" command on Windows
Mathias Mamsch - Sat Jan 22 12:36:07 EST 2011

C124id - Sat Jan 22 10:58:58 EST 2011

Your post was helpful for us.

We have a similar problem !!

If you have deleted the Windows files from a DXL script, can you share the method with me. Following code does not work for me. I use a Windows XP OS - NTFS; we are trying to delete a file from a Windows share.

This does not throw any error; a console pops-up and closes immediately.
 

string Windows_Share = "//srti008a.xyz.com/Testing/*.*"
string commandexe = "c:/windows/system32/cmd.exe /c del /Q /F " "\"" Windows_Share "\""
system (commandexe)

I have never seen "/" used as a path separator on a windows shell. Maybe replace it by "\" ?

This happens when I try on the shell:

C:\>c:/windows/system32/cmd.exe /C "echo Hallo"
Syntaxfehler.
 
C:\>c:\windows\system32\cmd.exe /C "echo Hallo"
Hallo

 


Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: DXL "System" command on Windows
C124id - Mon Jan 24 05:37:29 EST 2011

Mathias Mamsch - Sat Jan 22 12:36:07 EST 2011

I have never seen "/" used as a path separator on a windows shell. Maybe replace it by "\" ?

This happens when I try on the shell:

C:\>c:/windows/system32/cmd.exe /C "echo Hallo"
Syntaxfehler.
 
C:\>c:\windows\system32\cmd.exe /C "echo Hallo"
Hallo

 


Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Thanks Mr.Mamsch !!
It worked.

Re: DXL "System" command on Windows
llandale - Mon Jan 24 16:34:18 EST 2011

C124id - Sat Jan 22 10:58:58 EST 2011

Your post was helpful for us.

We have a similar problem !!

If you have deleted the Windows files from a DXL script, can you share the method with me. Following code does not work for me. I use a Windows XP OS - NTFS; we are trying to delete a file from a Windows share.

This does not throw any error; a console pops-up and closes immediately.
 

string Windows_Share = "//srti008a.xyz.com/Testing/*.*"
string commandexe = "c:/windows/system32/cmd.exe /c del /Q /F " "\"" Windows_Share "\""
system (commandexe)

You can delete a Windows file directly from DXL:
string ErrMess = deleteFile(NameFileFull)

  • Louie

Re: DXL "System" command on Windows
ChidambaramL - Tue Jan 25 03:56:19 EST 2011

llandale - Mon Jan 24 16:34:18 EST 2011
You can delete a Windows file directly from DXL:
string ErrMess = deleteFile(NameFileFull)

  • Louie

Thanks !!

Same is done through:

Stat temp_folder = create <<Folder path of string type>>
while (!(null temp_folder)) { 
    temp_folder = create folder_path 
} //continue after the folder is deleted

Re: DXL "System" command on Windows
jester76 - Thu Oct 17 17:32:49 EDT 2013

Mathias Mamsch - Wed Feb 24 14:02:11 EST 2010

You might want to try the

int win32SystemWait_ (string commandString, string& sResult, int waitTime, Skip envString)

 


perm which will do exactly what you want (I think waitTime=0 will make it wait forever) ...

Regards, Mathias

 

Hello,

Is there a way to supply arguement to this command. For example if I have to run a program and supply som arguements to it.

This command does not seem to work.

Please reply back if this can be done

Thanks

jester

Re: DXL "System" command on Windows
Mathias Mamsch - Fri Oct 18 06:02:30 EDT 2013

jester76 - Thu Oct 17 17:32:49 EDT 2013

Hello,

Is there a way to supply arguement to this command. For example if I have to run a program and supply som arguements to it.

This command does not seem to work.

Please reply back if this can be done

Thanks

jester

If you read that post to the end, there is actually an example for having arguments to the command. If in your special case it does not work, why not post some code? Regards, Mathias

Re: DXL "System" command on Windows
jester76 - Thu Oct 24 15:34:51 EDT 2013

Mathias Mamsch - Fri Oct 18 06:02:30 EDT 2013

If you read that post to the end, there is actually an example for having arguments to the command. If in your special case it does not work, why not post some code? Regards, Mathias

Sorry, here is the code:

Object obj = current
string sProbNumber1 = obj."A1"""
string sProbNumber2 = obj."A2"""
string strValue = ""
string result = ""
string strCMD =  "C:\\1Pradeep\\condoors.exe " "\"" sProbNumber1 "\" " "\"" sProbNumber2 "\" " "\"" "*" "\""

system(strCMD) to be replaced with win32SystemWait(strCMD, string& sResult, int waitTime)

If possible I want to hide the command windows flying around.

Thanks

Jester

Re: DXL "System" command on Windows
Mathias Mamsch - Thu Oct 24 16:04:36 EDT 2013

jester76 - Thu Oct 24 15:34:51 EDT 2013

Sorry, here is the code:

Object obj = current
string sProbNumber1 = obj."A1"""
string sProbNumber2 = obj."A2"""
string strValue = ""
string result = ""
string strCMD =  "C:\\1Pradeep\\condoors.exe " "\"" sProbNumber1 "\" " "\"" sProbNumber2 "\" " "\"" "*" "\""

system(strCMD) to be replaced with win32SystemWait(strCMD, string& sResult, int waitTime)

If possible I want to hide the command windows flying around.

Thanks

Jester

See this post for an alternative way to launch executables: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014702144. Maybe the shell.inc file can help you with the flying windows. The win32SystemWait uses the shell to launch commands, therefore you will always have shell windows flying around with this one.

Regards, Mathias

 

Re: DXL "System" command on Windows
jester76 - Thu Oct 24 16:27:39 EDT 2013

Mathias Mamsch - Thu Oct 24 16:04:36 EDT 2013

See this post for an alternative way to launch executables: https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014702144. Maybe the shell.inc file can help you with the flying windows. The win32SystemWait uses the shell to launch commands, therefore you will always have shell windows flying around with this one.

Regards, Mathias

 

Hi,

I found this code other day and it does not seem to wait. Here is my code:

Object obj = current
string sProbNumber1 = obj."A1"""
string sProbNumber2 = obj."A2"""
string strValue = ""
string result = ""
string strCMD =  "C:\\1Pra\\condoors.exe " "\"" sProbNumber1 "\" " "\"" sProbNumber2 "\" " "\"" "*" "\""

fnInvokeFile(strCMD)

Stream fInput = read  "c:\\temp\\doorscal.txt"  // load path to variable
flush fInput
while (true)
{
   fInput >> strValue
   if(end fInput) break
}

obj."A6" = strValue
close fInput

Added the following function in the inc.

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - -
void fnInvokeFile(string strArg)
{
   Shell cmd  = create (strArg, true)
}

Am I doing anything wrong?

I have a c# program doing calculations and storing them in a file.

 

Re: DXL "System" command on Windows
Mathias Mamsch - Thu Oct 24 16:48:36 EDT 2013

jester76 - Thu Oct 24 16:27:39 EDT 2013

Hi,

I found this code other day and it does not seem to wait. Here is my code:

Object obj = current
string sProbNumber1 = obj."A1"""
string sProbNumber2 = obj."A2"""
string strValue = ""
string result = ""
string strCMD =  "C:\\1Pra\\condoors.exe " "\"" sProbNumber1 "\" " "\"" sProbNumber2 "\" " "\"" "*" "\""

fnInvokeFile(strCMD)

Stream fInput = read  "c:\\temp\\doorscal.txt"  // load path to variable
flush fInput
while (true)
{
   fInput >> strValue
   if(end fInput) break
}

obj."A6" = strValue
close fInput

Added the following function in the inc.

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - -
void fnInvokeFile(string strArg)
{
   Shell cmd  = create (strArg, true)
}

Am I doing anything wrong?

I have a c# program doing calculations and storing them in a file.

 

Double check if your program has really been executed! Invoke getStatus and getOutput to check if anything went wrong.  It might just seem, that it did not wait, just because the file was not created? Just run:

Shell npad = create ("Notepad.exe", true /* wait */)

The DXL program should freeze on your computer, waiting for Notepad to end. End Notepad and see, if the program unfreezes.  If it does not for you, then you might have a platform problem, which makes the Shell code not work on your side. Regards, Mathias

Re: DXL "System" command on Windows
jester76 - Thu Oct 24 20:30:47 EDT 2013

jester76 - Thu Oct 24 16:27:39 EDT 2013

Hi,

I found this code other day and it does not seem to wait. Here is my code:

Object obj = current
string sProbNumber1 = obj."A1"""
string sProbNumber2 = obj."A2"""
string strValue = ""
string result = ""
string strCMD =  "C:\\1Pra\\condoors.exe " "\"" sProbNumber1 "\" " "\"" sProbNumber2 "\" " "\"" "*" "\""

fnInvokeFile(strCMD)

Stream fInput = read  "c:\\temp\\doorscal.txt"  // load path to variable
flush fInput
while (true)
{
   fInput >> strValue
   if(end fInput) break
}

obj."A6" = strValue
close fInput

Added the following function in the inc.

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - -
void fnInvokeFile(string strArg)
{
   Shell cmd  = create (strArg, true)
}

Am I doing anything wrong?

I have a c# program doing calculations and storing them in a file.

 

It did work. but shell/command windows are flying.

Is there a way to hide these windows

Thanks

Jester

Re: DXL "System" command on Windows
llandale - Mon Oct 28 09:55:28 EDT 2013

jester76 - Thu Oct 24 20:30:47 EDT 2013

It did work. but shell/command windows are flying.

Is there a way to hide these windows

Thanks

Jester

Is there perhaps a way to run the command window minimized?