Jump to content

Hiding Dos Windows


Recommended Posts

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?

Link to comment
Share on other sites

  • Developers

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

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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.

Link to comment
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...

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...