Guest seb80 Posted October 8, 2004 Share Posted October 8, 2004 Hi everybody. Heres is my problem. In my company, we use a proxy for web connexion, wich makes my life a hell. I've got a list a web site authorised for every users. The problem is, many of these sites have popups from other (and then non-authorised) sites, which makes the proxy sending a window for authentification. I made a little script in V2 (I'm an old V2 user) which is scanning the title of the web pages, killing the authentification windows and terminating when the main web page closes. Fine. But i've got to spend a huge time in searching for the page titles, and some smart asses like to change these titles every week. I am looking for a different approach with the V3 : scanning the iexplore.exe process launched and basically kill all the authentification windows while the process exists. This is my first script : Opt("WinTitleMatchMode", 2) Run ( "c:\program files\internet explorer\iexplore.exe http://www.voyages-sncf.com" ) $sortie=0 $PID = ProcessExists("iexplore.exe") while $sortie=0 if winexists("Mot de passe réseau") then winkill("Mot de passe réseau") endif if ProcessExists($PID) then $sortie=0 else $sortie=1 endif wend Works fine, but it exits only when the FIRST iexplore.exe process quits. If there are more than one process, it runs forever as long as the first process still exists. So i've decided to check all the current iexplore processes, and waiting for the last one to terminate. Here is the script : Opt("WinTitleMatchMode", 2) ;//////// Launching the Internet Explorer with the correct URL Run ( "c:\program files\internet explorer\iexplore.exe http://www.voyages-sncf.com" ) winwaitactive("www.voyages-sncf.com") ;//////// Variables Dim $PID[500] Dim $procs = ProcessList(2) $compt=0 $sortie=0 ;//////// Retrieving the Iexplore process For $i = 1 To $procs[0] $processCheck = StringInStr ( $procs[$i], "iExplore" ) If $processCheck <> 0 Then $compt=$compt+1 $PID[$compt]= $procs[$i] $PID[$compt]=stringtrimleft($PID[$compt],14) filewriteline("test.txt", $compt&" "&$PID[$compt]) EndIf Next ;//////// The variable OK contains the number of the last Iexplore process $OK=$PID[$compt] while $sortie=0 if winexists("Mot de passe réseau") then winkill("Mot de passe réseau") endif if ProcessExists($OK) then exitloop else $sortie=1 endif wend I've tested lots of things, it simply acts as the process doesn't exits (the ProcessExists returns an error) so it passes only once the while...wend loop, and then the script exits. I've tried to leave the full name and so, nothing works. If I force the loop forever, it works nicely, but I want it to stop when the Internet page is closed. If anyone can help before I shoot myself (or better : shoot the guy who asked me to do this job) it would be VERY appreciated. Thanx for reading such a long thing Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 8, 2004 Share Posted October 8, 2004 (edited) So what you are wanting is when IExplorer.exe is no longer in the process list for the above script to exit? Edit: Also which part of that code are you actually using, so I may be able to instruct you on where to put the code I am thinking would be useful if the above is true. JS Edited October 8, 2004 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
ezzetabi Posted October 8, 2004 Share Posted October 8, 2004 (edited) AFAIK every Iexplore window you call is a separed process, so why not use: Opt("WinTitleMatchMode", 2) $Pid = Run("c:\program files\internet explorer\iexplore.exe http://www.voyages-sncf.com") $SORTIE = 0 While $SORTIE = 0 If WinExists("Mot de passe réseau") Then WinKill("Mot de passe réseau") EndIf If ProcessExists($PID) Then $SORTIE = 0 Else $SORTIE = 1 EndIf Wend Edited October 8, 2004 by ezzetabi Link to comment Share on other sites More sharing options...
Guest seb80 Posted October 11, 2004 Share Posted October 11, 2004 Stupid me Of course, the exitloop was a test and it was supposed to be $sortie=0 instead. But the problem was in another place : I wa trimming a character that was not supposed to be trimmed : the "-" before the digit. Here is the fully functionnal code : Opt("WinTitleMatchMode", 2) ;//////// Launching the Internet Explorer with the correct URL Run ( "c:\program files\internet explorer\iexplore.exe http://www.voyages-sncf.com" ) winwaitactive("www.voyages-sncf.com") ;//////// Variables Dim $PID[500] Dim $procs = ProcessList(2) $compt=0 $sortie=0 ;//////// Retrieving the Iexplore process For $i = 1 To $procs[0] $processCheck = StringInStr ( $procs[$i], "iExplore" ) If $processCheck <> 0 Then $compt=$compt+1 $PID[$compt]= $procs[$i] ;;//////// trimming 13 characters instead of 14... $PID[$compt]=stringtrimleft($PID[$compt],13) EndIf Next ;//////// The variable OK contains the number of the last Iexplore process $OK=$PID[$compt] while $sortie=0 if winexists("Mot de passe réseau") then winkill("Mot de passe réseau") endif if ProcessExists($OK) then $sortie=0 else $sortie=1 endif wend Alleluyahhh !!! It works ! My script exits when I decide to close this specific window !!! Thanx for help folks ! Link to comment Share on other sites More sharing options...
JSThePatriot Posted October 11, 2004 Share Posted October 11, 2004 Glad you got it working properly. I was glad to be of any assistance at all... JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now