Hot Topic (More than 10 Replies) Can we suppress the DOS box during @shell events? (Read 2555 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Can we suppress the DOS box during @shell events?
Sep 14th, 2004 at 10:31pm
Print Post Print Post  
Ive got a button that copies images from an image LE to another location on the users hard drive via the @Shell command.

All my @Shell commands cause the black DOS box to flash on and off for each record (sometimes the program does not continue until the box closes).

I'm sure there are reasons for this, but I don't know why. Is there a way to run @Shell commands without the DOS box flashing on the screen?

I'd rather see the writeln slate display the progress of the program instead.

Thanks,
Steve
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Can we suppress the DOS box during @shell even
Reply #1 - Sep 14th, 2004 at 10:46pm
Print Post Print Post  
Steve,

@Shell is asking the OS to launch another program, so I don't think you can suppress the window with Sesame.

But this new feature for version 1.0.5 may help, because Sesame won't wait for the DOS command to finish before moving on to the next line of programming.

@AsynchShell( command as string ) as int
Just like @Shell, except it doesn't wait. That way you can launch another program and Sesame will keep doing while that program runs.

More info at this link:
http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Can we suppress the DOS box during @shell even
Reply #2 - Sep 14th, 2004 at 10:50pm
Print Post Print Post  
Check the folder where the executable command is located. 

See if there is a PIF file for that program.  The PIF file will usually have the same name with no extension.  (One may frequently be created if that program is called from another one).  In Explore, under the Type column you may see something like "Performs text-based (command-line) functions."

If there is a PIF file, edit the properties for that file.  Go to the tab for Properties and change the value in the Run field to minimized.

If no PIF file exists, then you could make a batch file with a single line to run the program.  Calling that batch file will usually create a PIF file.  Now you edit that as noted above.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Can we suppress the DOS box during @shell even
Reply #3 - Sep 15th, 2004 at 2:30am
Print Post Print Post  
Carl and Bob,

Thanks for the tips. All of my @shell commands run from a simple batch file which makes it easier to program. I just use a command like:

vGo = @shell("launch.bat copy " + image1 + " c:\photos"

launch.bat is a batch file that reads:
%1 %2 %3 %4 %5 %6

this way I can use launch.bat for almost anything. It handles a command line up to 6 commands long.

I'll set the poperties for the .bat file tomorrow and report back to you guys.

Thanks again for the help.

Steve
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Can we suppress the DOS box during @shell even
Reply #4 - Sep 15th, 2004 at 2:38am
Print Post Print Post  
Look in the folder where you keep Launch.bat for a PIF file for Launch.

Change property of PIF for RUN to Run Minimized.

That's all you need to do.  DOS box will not be visible.

Let me know if you need help to make a PIF file if none is there.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Can we suppress the DOS box during @shell even
Reply #5 - Sep 15th, 2004 at 2:44am
Print Post Print Post  
A Pif file does not exist on my windows 2000 or XP machines. (Perhaps in another folder?)  I cant recall ever seeing one created when calling a batch file. I'll need directions if you don't mind.

Thanks
Steve
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Can we suppress the DOS box during @shell even
Reply #6 - Sep 15th, 2004 at 4:56am
Print Post Print Post  
On XP the easiest thing to do is make a shortcut to the batch file. 

Using Explore, open the folder with launch.bat.  Right click on file and select Make a Shortcut.  That shortcut is the same as the PIF file I referred to.  Edit that to run minimized.   

You may need to change your routine to call the shortcut vs. the batch file, or the batch file may use these settings anyway.  The "PIF"/shortcut file values are written to the registry for that batch file.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Can we suppress the DOS box during @shell even
Reply #7 - Sep 15th, 2004 at 2:22pm
Print Post Print Post  
Bob, it worked well when launched from the 'shortcut' in windows 2000, but DOS can't launch the '.lnk' format (the shortcut)

I'll play around with it a bit more when later in the week when I have more time and report back with results.

Thanks for the help. Let me know if you have any other suggestions.

Steve
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Can we suppress the DOS box during @shell even
Reply #8 - Sep 15th, 2004 at 3:37pm
Print Post Print Post  
Since Shortcuts to applications aren't recognized by DOS, you can't execute them directly. However, there is a way to launch them, either from the prompt, or from a batch file.  The answer is to use the start command:

Type the following: start "C:\Path\Shortcut to Someprog.exe.lnk", where C:\Path is the full path containing the shortcut, and Shortcut to Someprog.exe.lnk is the filename of the shortcut.

Note that the shortcut filename may not have an extension, that is OK.  You can try this manually in a command window before you  put it into your programming.  The quotes are included to allow for spaces in long path/file names.
=================
Now that I think a bit more about it, you don't even need the shortcut.  When you use start  you can tell it to run minimized at the same time with the /m switch. 

Try this: Quote:
start /m C:\Path\launch.bat
I should have thought of this earlier. Roll Eyes
« Last Edit: Sep 15th, 2004 at 11:08pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Can we suppress the DOS box during @shell even
Reply #9 - Sep 15th, 2004 at 4:08pm
Print Post Print Post  
Your advice worked when running from the start button in Windows, but still doesnt work when running from Sesame.

It looks like the boxes still flash on the screen (as before), but they do not display any text.

I'll try on XP machine later this week and let you know.

Thanks again,
Steve
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Can we suppress the DOS box during @shell even
Reply #10 - Sep 15th, 2004 at 4:19pm
Print Post Print Post  
Be sure to try both from my last message: The start /m launch.bat and the start /m launch.lnk that has been modified to Run minimized.

I have not yet tried in Sesame myself, these are just normal functions that work with other programs.  I have been thinking that Sesame's @shell should handle them also.

Whether or not this works,  provide example of the @shell command you are using.  If good, we will all know, if no good we can all contribute to solution.



« Last Edit: Sep 15th, 2004 at 11:08pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Can we suppress the DOS box during @shell even
Reply #11 - Sep 15th, 2004 at 4:22pm
Print Post Print Post  
Looks like I can't use /m after a batch file that is expecting arguments to follow.

Even using Start C:\shortcut /m  doesnt work.

It's trying to run /m as a program. I may need to ditch my 'generic batch file' (%1 %2 %3..) and start using real commands.

Maybe /m needs to go at the very end of the command line.

Steve
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Can we suppress the DOS box during @shell even
Reply #12 - Sep 15th, 2004 at 9:08pm
Print Post Print Post  
Nope, the /m goes right after start.........

Here is the format for syntax for start:

Quote:
C:\Batch>start /?
Runs a Windows program or an MS-DOS program.

START [options] program [arg...]
START [options] document.ext

/m[inimized] Run the new program minimized (in the background).
/max[imized] Run the new program maximized (in the foreground).
/r[estored]  Run the new program restored (in the foreground). [default]
/w[ait]      Does not return until the other program exits.


  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Can we suppress the DOS box during @shell even
Reply #13 - Sep 15th, 2004 at 9:53pm
Print Post Print Post  
Oh, I was putting /m right after the batch file and also right after the shortcut file.

I'll test it out soon and respond to you.

Thanks again for your help!

Steve
  
Back to top
IP Logged