Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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...

Posted

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.

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
×
×
  • Create New...