Jump to content
Sign in to follow this  
pecsenye

Hide IE browser forever

Recommended Posts

pecsenye

Hello,

I have a script, its working well.

When I start running the script the random website is loading and then the browser is hiding. (That's OK for me.)

Then the script is sleeping for a random time. (That's OK for me.)

 

My problem is:

After the next website is loading, then the browser is visible again. I can see the browser for a few moments. (until the website is finish the loading.)

 

My question is:

How can I solve this problem? (Hide IE browser forever :))

 

Code:

                        Global $var[4]
                        $var[1] = "http://google.com"
                        $var[2] = "http://google.com"
                        $var[3] = "http://google.com"
                        $x = Random(1, 3, 1)
                        ShellExecute($var[$x])
                        Local $hWnd = WinWait("[CLASS:IEFrame]", "Google", 10)
                        WinSetState($hWnd, "", @SW_HIDE)
                        Sleep(Random(5000, 8000, 1))

                      Global $var[4]
                        $var[1] = "http://google.com"
                        $var[2] = "http://google.com"
                        $var[3] = "http://google.com"
                        $x = Random(1, 3, 1)
                        ShellExecute($var[$x])
                        Local $hWnd = WinWait("[CLASS:IEFrame]", "Google", 10)
                        WinSetState($hWnd, "", @SW_HIDE)
                        Sleep(Random(5000, 8000, 1))

 

Thanks for  helping!

 

Share this post


Link to post
Share on other sites
pecsenye

I can see that, but problem is the same.

Example script?

Share this post


Link to post
Share on other sites
BrewManNH

You could use the IE functions in the IE.au3 UDF.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
jvds

hi, to test the script and see what happens set $iVisible  = 1, to hide just set it to 0, if you want it to loop then enable the disabled 'while 1' and 'wend' or use any other loop methods like 'do until', or 'for to next'

#include <IE.au3>

$iTryAttach = 0
$iVisible  = 0
$iWait  = 1
$iTakeFocus  = 0

;create a new hidden iexplore window because of $iVisible=0
$oIE  = _IECreate("about:blank",$iTryAttach,$iVisible,$iWait,$iTakeFocus)


;~ while 1
    Global $var[4]
    $var[1] = "http://google.com"
    $var[2] = "http://google.com"
    $var[3] = "http://google.com"
    $x = Random(1, 3, 1)

    ;navegate to one of the random urls
    _IENavigate($oIE,$var[$x],$iWait) ;----> ShellExecute($var[$x]) not needed because _IENavigate navegates to your targed url
    ;Local $hWnd = WinWait("[CLASS:IEFrame]", "Google", 10) ;----> no need for this, because _IENavigate's $iWait is active and it will wait to completly load before it continue
    ;WinSetState($hWnd, "", @SW_HIDE) ;---->  no need for this because _IENavigate wont unhide, _IECreate already disable visiility with $iVisible=0
    Sleep(Random(5000, 8000, 1))
;~ WEnd

;quit explorer window after done
_IEQuit($oIE)

 

Share this post


Link to post
Share on other sites
pecsenye

Oh, thank you for helping! Thank you!!!!!

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  

  • Similar Content

    • BlazerV60
      By BlazerV60
      Hello all,
      I've written the code below which launches chrome in incognito mode and then proceeds to go to the autoit website.
      From my understanding, the Run() command is also supposed to output the PID number related to the application that got launched from the Run command.
      However when I run the below lines, it outputs a PID number that is different from the newly launched chrome browser's PID number, does anyone know why and possibly explain how I could retrieve the accurate PID number associated with the newly launched browser?
      Global $iPid = Run(@ComSpec & ' /c start chrome.exe https://www.autoitscript.com/forum/ -incognito' ,"", "") msgbox(0,"",$iPid) Thank you,
      Brian
    • BlazerV60
      By BlazerV60
      Hello all,
      I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods:
      ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried:
      ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried:
      RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir)  
      But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? 
      Bonus points if you know how to make it launch chrome hidden and make it go to https://www.autoitscript.com
       
      Thank you,
      Brian
    • BOUNCER
      By BOUNCER
      I'm trying to get the output data from https://www.guilded.gg but it uses a web app that generates that output on the fly and this doesn't show up in the page source.
      Only in web inspector of each browser does this data show up. How do I read this data in autoit (equivalent to the web inspector)
       
      thank you
    • ur
      By ur
      We can select elements in IE using their IDs as below.
      Local $oDiv = _IEGetObjById($oIE, "x-auto-16-input") But to one button in the webpage, there is no ID to it.
      In selenium we have option to select this element using the CssSelector and clicked the button using below code in c# selenium.
      driver.FindElement(By.CssSelector("button.x-btn-text")).Click(); What is the alternative for this in AUtoIT?
    • whiskas
      By whiskas
      Hi all,
      I just upgraded to windows 10 and am using Edge as my browser now. Updated my scripts, but I can not unhide a minimized Edge window with the script anymore.
      WinSetState ( "titlle","", @SW_MAXIMIZE ) works fine, but not if it is minimized. Tried same with SW_SHOW, doesn't work.
      WinExists("title","") -> returns 1, so it is finding my window.
       
              WinWait($title,$text,$timeout)
              If Not WinActive($title,$text) Then WinActivate($title,$text)
              WinWaitActive($title,$text,$timeout)
      Doesn't work also, so I think I tried all but cant get the window back
      Any help would be appreciated
       
×