Sign in to follow this  
Followers 0
copyleft

Hiding Dos Windows

7 posts in this topic

when specify "comspec" in a script to open a browser window. how do you hide the brief DOS window that appears before the browser opens? Is there anyway to minimize the DOS window or hide it altogether?[

e.g., this won't do it:

RunWait(@ComSpec & ' /c 'http://hiddensoft.com',' ',@SW_HIDE)

winsetstate("HiddenSoft","",@SW_RESTORE)

Any suggestions?

Share this post


Link to post
Share on other sites



think it will always show the cmd screen briefly...

you could start your browser directy to avoid the "DOS" box...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

if you want it to start hidden, you might try accessing the browser directly:

Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE http://hiddensoft.com','',@sw_hide)
sleep(1000)
winsetstate("HiddenSoft","",@SW_RESTORE)

but yes, if using comspec, you get the blink.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

but yes, if using comspec, you get the blink.

On what speed computer and OS? I've never seen a cmd blink with @SW_HIDE.

Jeff

Share this post


Link to post
Share on other sites

98se Dual Xeons (of course only one cpu being used with this OS :-). Unfortunately, I can't call a specific browser, cause user may be running firefox, which is my preference :-). Curiously, though, the hide function seems to work on some scripts but not on others. Weird...

Share this post


Link to post
Share on other sites

You can easily get the default browser from the registry. In fact, I've written a function that does that.

; ===================================================================
; RunBrowser($szUrl)
;
; Looks up the web browser and launches it with the specified URL (Can be a file, too)
; Parameters:
;   $szUrl - IN - The URL (or file) to launch the browser with.
; Returns:
;   Sets @error to 1 on failure (Browser can't be found)
; ===================================================================
Func RunBrowser($szUrl)
    Local $szBrowser = RegRead("HKEY_CLASSES_ROOT\HTTP\shell\open\command", "")
    If StringLeft($szBrowser, 1) = '"' Then
        $szBrowser = StringTrimLeft($szBrowser, 1)
        Local $nChar = StringInStr($szBrowser, '"')
        If $nChar Then $szBrowser = StringTrimRight($szBrowser,  StringLen($szBrowser) - $nChar + 1)
    EndIf
    If StringLen($szBrowser) = 0 Then Return SetError(1)
    Run($szBrowser & " " & $szUrl)
EndFunc; RunBrowser()

Example:

RunBrowser("http://www.hiddensoft.com")

This should open the default browser to the Hiddensoft homepage.

Share this post


Link to post
Share on other sites

I'll give it a try, thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0