abdulrahmanok Posted November 18, 2016 Share Posted November 18, 2016 (edited) Welcome To all Brothers, I have Func to start IE and Automate login And I want to stop this running func by another button or hotkey but I couldn't do this and I tried to by button exit whole program ... Is there is any way to stop running IE func ? I found old Threads talking about this but i couldn't match it with my program My code: expandcollapse popup#include <IE.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $asd = "I have another variables and this is just Example" $MyGui = GUICreate("QU Job Calculator Hours", 650, 484, -1, -1, -1, -1) $start = GUICtrlCreateButton("Start", 234, 15, 165, 30, -1, -1) GUICtrlSetOnEvent($start, "Start") $stop = GUICtrlCreateButton("Stop", 234 + 30, 15 + 30, 165, 30, -1, -1) GUICtrlSetOnEvent($stop, "Stopfunc") GUISetState(@SW_SHOW, $MyGui) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() Global $EraseTemp = FileOpen(@ScriptDir & "\Temp.qu", 2) Global $EraseTemp2 = FileWrite($EraseTemp, "") If ProcessExists("iexplore.exe") Then ;The process that you want to check ProcessClose("iexplore.exe") ;The process that you want to close EndIf $sAnswer = InputBox("Question", "Your Qu ID ?", "", "") If Not IsDeclared($sAnswer) Then Global $sAnswer $hFO2 = FileOpen(@ScriptDir & "/info.qu", 2) FileWrite($hFO2, $sAnswer) FileWrite($hFO2, @CRLF) FileClose($hFO2) $sPasswd = InputBox("Your Password", "Password here", "", "*") $hFO3 = FileOpen(@ScriptDir & "/info.qu", 3) FileWriteLine($hFO3, $sPasswd) FileWrite($hFO3, @CRLF) FileClose($hFO3) $opennew = @ScriptDir & "/info.qu" Local $readQuId = FileReadLine($opennew, 1) Local $readPass = FileReadLine($opennew, 2) Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/twbkwbis.P_WWWLogin") ;*************************************************************************** User Login - Internet Explorer Do ToolTip("Input Username And Password", 0, 0) If WinWait("User Login - Internet Explorer", "", 2) = 0 Then ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ToolTip("Your Connection Is to Slow !", 0, 0) Else ExitLoop EndIf Until WinWaitActive("User Login - Internet Explorer", "", 2) = 1 $oForms = _IEFormGetCollection($oIE) $Index = 0 For $oForm In $oForms $oFormElements = _IEFormElementGetCollection($oForm) Next If IsObj($oFormElements) Then $IndexElement = 0 EndIf For $oElement In $oFormElements Next $oForm2 = _IEFormGetObjByName($oIE, "loginform") $oElement = _IEFormElementGetObjByName($oForm2, "sid") _IEFormElementSetValue($oElement, $readQuId) $oElement = _IEFormElementGetObjByName($oForm2, "PIN") _IEFormElementSetValue($oElement, $readPass) _IEFormSubmit($oForm2) ;*************************************************************************** "Student Services Do ToolTip("Student Services", 0, 0) If WinWait("Main Menu - Internet Explorer", "", 3) = 0 Then ToolTip("Your Connection Is to Slow !", 0, 0) Else ExitLoop EndIf Until WinWaitActive("Main Menu - Internet Explorer", "", 2) = 1 Local $sMyString = "Student Services" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next EndFunc ;==>_Start Func Stopfunc() MsgBox(0, "", "Finally Stopped") Exit 0 EndFunc ;==>Stopfunc Edited November 25, 2016 by abdulrahmanok Link to comment Share on other sites More sharing options...
mLipok Posted November 18, 2016 Share Posted November 18, 2016 Please TIDY your code in SciTE4AutoIt (just press CTRL+T ), and edit your posted AutoIt script snippet. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
abdulrahmanok Posted November 19, 2016 Author Share Posted November 19, 2016 @mLipok Thanks for reply Thats it: expandcollapse popup#include <IE.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $asd = "I have another variables and this is just Example" $MyGui = GUICreate("QU Job Calculator Hours", 650, 484, -1, -1, -1, -1) $start = GUICtrlCreateButton("Start", 234, 15, 165, 30, -1, -1) GUICtrlSetOnEvent($start, "Start") $stop = GUICtrlCreateButton("Stop", 234 + 30, 15 + 30, 165, 30, -1, -1) GUICtrlSetOnEvent($stop, "Stopfunc") GUISetState(@SW_SHOW, $MyGui) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() Global $EraseTemp = FileOpen(@ScriptDir & "\Temp.qu", 2) Global $EraseTemp2 = FileWrite($EraseTemp, "") If ProcessExists("iexplore.exe") Then ;The process that you want to check ProcessClose("iexplore.exe") ;The process that you want to close EndIf $sAnswer = InputBox("Question", "Your Qu ID ?", "", "") If Not IsDeclared($sAnswer) Then Global $sAnswer $hFO2 = FileOpen(@ScriptDir & "/info.qu", 2) FileWrite($hFO2, $sAnswer) FileWrite($hFO2, @CRLF) FileClose($hFO2) $sPasswd = InputBox("Your Password", "Password here", "", "*") $hFO3 = FileOpen(@ScriptDir & "/info.qu", 3) FileWriteLine($hFO3, $sPasswd) FileWrite($hFO3, @CRLF) FileClose($hFO3) $opennew = @ScriptDir & "/info.qu" Local $readQuId = FileReadLine($opennew, 1) Local $readPass = FileReadLine($opennew, 2) Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/twbkwbis.P_WWWLogin") ;*************************************************************************** User Login - Internet Explorer Do ToolTip("Input Username And Password", 0, 0) If WinWait("User Login - Internet Explorer", "", 2) = 0 Then ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ToolTip("Your Connection Is to Slow !", 0, 0) Else ExitLoop EndIf Until WinWaitActive("User Login - Internet Explorer", "", 2) = 1 $oForms = _IEFormGetCollection($oIE) $Index = 0 For $oForm In $oForms $oFormElements = _IEFormElementGetCollection($oForm) Next If IsObj($oFormElements) Then $IndexElement = 0 EndIf For $oElement In $oFormElements Next $oForm2 = _IEFormGetObjByName($oIE, "loginform") $oElement = _IEFormElementGetObjByName($oForm2, "sid") _IEFormElementSetValue($oElement, $readQuId) $oElement = _IEFormElementGetObjByName($oForm2, "PIN") _IEFormElementSetValue($oElement, $readPass) _IEFormSubmit($oForm2) ;*************************************************************************** "Student Services Do ToolTip("Student Services", 0, 0) If WinWait("Main Menu - Internet Explorer", "", 3) = 0 Then ToolTip("Your Connection Is to Slow !", 0, 0) Else ExitLoop EndIf Until WinWaitActive("Main Menu - Internet Explorer", "", 2) = 1 Local $sMyString = "Student Services" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next EndFunc ;==>_Start Func Stopfunc() MsgBox(0, "", "Finally Stopped") Exit 0 EndFunc ;==>Stopfunc Link to comment Share on other sites More sharing options...
abdulrahmanok Posted November 25, 2016 Author Share Posted November 25, 2016 I'm still waiting for you suggestions ...... Link to comment Share on other sites More sharing options...
abdulrahmanok Posted November 25, 2016 Author Share Posted November 25, 2016 I found this but i don't know how to apply it with my code.. Link to comment Share on other sites More sharing options...
abdulrahmanok Posted November 28, 2016 Author Share Posted November 28, 2016 OK It seems Impossible to Stop Running IE Func After all searches I Only found way to Exit program completely but can't ever Interrupt IE Func. Link to comment Share on other sites More sharing options...
spudw2k Posted November 28, 2016 Share Posted November 28, 2016 Disrupting an executing _IE function...you're right...probably not going to happen unless you tailor the UDF. Can you elaborate more on what you are looking to accomplish? Which IE func are you looking to interrupt? At what point should the interrupt occur (point of no return or anytime)? What should happen when after the interruption? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
abdulrahmanok Posted November 29, 2016 Author Share Posted November 29, 2016 @spudw2k Ty very much for your reply , Actually I want to Interrupt whole IE which in my script (start) Func Because Some users write a mistake username or password so they will can stop IE Func and back to Gui to write correct User and password Easy to figure but hard to apply it If you need any more explaining please tell me . Link to comment Share on other sites More sharing options...
spudw2k Posted November 29, 2016 Share Posted November 29, 2016 Ok, if you look at the example on post #3 in the thread you linked to, notice the variable $running. The scripter is using that as a flag to determine if his process/loop should continue. What you need to do is find a breaking point to check to see if the $running var is still set correctly, and if not return from the function. For an example I liberally applied a "break check" to your script (untested): expandcollapse popup#include <IE.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $bRunning = False $asd = "I have another variables and this is just Example" $MyGui = GUICreate("QU Job Calculator Hours", 650, 484, -1, -1, -1, -1) $start = GUICtrlCreateButton("Start", 234, 15, 165, 30, -1, -1) GUICtrlSetOnEvent($start, "Start") $stop = GUICtrlCreateButton("Stop", 234 + 30, 15 + 30, 165, 30, -1, -1) GUICtrlSetOnEvent($stop, "Stopfunc") GUISetState(@SW_SHOW, $MyGui) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() $bRunning = True Global $EraseTemp = FileOpen(@ScriptDir & "\Temp.qu", 2) Global $EraseTemp2 = FileWrite($EraseTemp, "") If ProcessExists("iexplore.exe") Then ;The process that you want to check ProcessClose("iexplore.exe") ;The process that you want to close EndIf $sAnswer = InputBox("Question", "Your Qu ID ?", "", "") If Not IsDeclared($sAnswer) Then Global $sAnswer $hFO2 = FileOpen(@ScriptDir & "/info.qu", 2) FileWrite($hFO2, $sAnswer) FileWrite($hFO2, @CRLF) FileClose($hFO2) $sPasswd = InputBox("Your Password", "Password here", "", "*") $hFO3 = FileOpen(@ScriptDir & "/info.qu", 3) FileWriteLine($hFO3, $sPasswd) FileWrite($hFO3, @CRLF) FileClose($hFO3) $opennew = @ScriptDir & "/info.qu" Local $readQuId = FileReadLine($opennew, 1) Local $readPass = FileReadLine($opennew, 2) Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/twbkwbis.P_WWWLogin") ;*************************************************************************** User Login - Internet Explorer Do ToolTip("Input Username And Password", 0, 0) If WinWait("User Login - Internet Explorer", "", 2) = 0 Then ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ToolTip("Your Connection Is to Slow !", 0, 0) Else ExitLoop EndIf ;====>Break Check If Not $bRunning Then Return 0 Until WinWaitActive("User Login - Internet Explorer", "", 2) = 1 $oForms = _IEFormGetCollection($oIE) $Index = 0 For $oForm In $oForms $oFormElements = _IEFormElementGetCollection($oForm) ;====>Break Check If Not $bRunning Then Return 0 Next If IsObj($oFormElements) Then $IndexElement = 0 EndIf ;===not sure what this loop is doing here o.O For $oElement In $oFormElements Next ;===not sure what this loop is doing here o.O $oForm2 = _IEFormGetObjByName($oIE, "loginform") $oElement = _IEFormElementGetObjByName($oForm2, "sid") _IEFormElementSetValue($oElement, $readQuId) $oElement = _IEFormElementGetObjByName($oForm2, "PIN") _IEFormElementSetValue($oElement, $readPass) _IEFormSubmit($oForm2) ;*************************************************************************** "Student Services Do ToolTip("Student Services", 0, 0) If WinWait("Main Menu - Internet Explorer", "", 3) = 0 Then ToolTip("Your Connection Is to Slow !", 0, 0) Else ExitLoop EndIf ;====>Break Check If Not $bRunning Then Return 0 Until WinWaitActive("Main Menu - Internet Explorer", "", 2) = 1 Local $sMyString = "Student Services" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks ;====>Break Check If Not $bRunning Then Return 0 Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next EndFunc ;==>_Start Func Stopfunc() $bRunning = False MsgBox(0, "", "Finally Stopped") ;Exit 0 EndFunc ;==>Stopfunc Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
abdulrahmanok Posted November 29, 2016 Author Share Posted November 29, 2016 Nice Idea I understood it but unfortunately it's not working because in start() func $bRunning = True so it will start and when check If Not $bRunning Then Return 0 will find it true and start loop so it's can't repsonse to Stopfunc() to read stop line $bRunning = False and that's why it doesn't work thank you for efforts i felt that's I'm near to the solution Link to comment Share on other sites More sharing options...
spudw2k Posted November 30, 2016 Share Posted November 30, 2016 (edited) Not sure if I understand you right, but you say it's not working? It probably has something to do with the fact that I haven't tried executing it, mainly because I see it is dependent on access to a particular website. In theory though, this "running flag" should work; I know others have used and do use this method to break a function. I assumed since you were using OnEvent mode (though still using GetMSG for some reason), clicking stop "should" interrupt the start function to display the msgbox and set the flag. Now interrupting in this fashion and using a blocking function (something that waits for input, i.e. msgbox, arraydisplay) could crash the script. It's just something to keep in mind and likely you'll have to play with and figure out the right order of operations. I'd recommend having your stop function only set the running flag, then save your user alert for the actual end of the escaped start function. Hope that helps edit: just to demo this method, here's a link to something I made that uses this approach to "pause" and animation. I know there is a lot of code (mostly not relevant to your need), so search for the $bIsPlaying variable. You find the global near the top, the check in the main loop and the _PlayToggle function that toggles it. Edited November 30, 2016 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
abdulrahmanok Posted December 1, 2016 Author Share Posted December 1, 2016 Thank you for your sharing , I detected The problem from pervoius Code #10 : I just was need to Delete "Do" , "Until" because script was stucking in this and didn't check for flag , anyway I also tried to add checking flag in "Do" Statement and it didn't work. Final Tested Code: expandcollapse popup#include <IE.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $bRunning = False $asd = "I have another variables and this is just Example" $MyGui = GUICreate("QU Job Calculator Hours", 650, 484, -1, -1, -1, -1) $start = GUICtrlCreateButton("Start", 234, 15, 165, 30, -1, -1) GUICtrlSetOnEvent($start, "Start") $stop = GUICtrlCreateButton("Stop", 234 + 30, 15 + 30, 165, 30, -1, -1) GUICtrlSetOnEvent($stop, "Stopfunc") GUISetState(@SW_SHOW, $MyGui) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() $bRunning = True Global $EraseTemp = FileOpen(@ScriptDir & "\Temp.qu", 2) Global $EraseTemp2 = FileWrite($EraseTemp, "") If ProcessExists("iexplore.exe") Then ;The process that you want to check ProcessClose("iexplore.exe") ;The process that you want to close EndIf If Not $bRunning Then Return 0 $sAnswer = InputBox("Question", "Your Qu ID ?", "", "") If Not IsDeclared($sAnswer) Then Global $sAnswer $hFO2 = FileOpen(@ScriptDir & "/info.qu", 2) FileWrite($hFO2, $sAnswer) FileWrite($hFO2, @CRLF) FileClose($hFO2) $sPasswd = InputBox("Your Password", "Password here", "", "*") $hFO3 = FileOpen(@ScriptDir & "/info.qu", 3) FileWriteLine($hFO3, $sPasswd) FileWrite($hFO3, @CRLF) FileClose($hFO3) $opennew = @ScriptDir & "/info.qu" Local $readQuId = FileReadLine($opennew, 1) Local $readPass = FileReadLine($opennew, 2) Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/twbkwbis.P_WWWLogin") ;*************************************************************************** User Login - Internet Explorer If Not $bRunning Then Return 0 ToolTip("Input Username And Password", 0, 0) If WinWait("User Login - Internet Explorer", "", 2) = 0 Then ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ToolTip("Your Connection Is to Slow !", 0, 0) Else EndIf ;====>Break Check If Not $bRunning Then Return 0 $oForms = _IEFormGetCollection($oIE) $Index = 0 For $oForm In $oForms $oFormElements = _IEFormElementGetCollection($oForm) ;====>Break Check If Not $bRunning Then Return 0 Next If IsObj($oFormElements) Then $IndexElement = 0 EndIf ;===not sure what this loop is doing here o.O For $oElement In $oFormElements Next ;===not sure what this loop is doing here o.O $oForm2 = _IEFormGetObjByName($oIE, "loginform") $oElement = _IEFormElementGetObjByName($oForm2, "sid") _IEFormElementSetValue($oElement, $readQuId) $oElement = _IEFormElementGetObjByName($oForm2, "PIN") _IEFormElementSetValue($oElement, $readPass) _IEFormSubmit($oForm2) ;*************************************************************************** "Student Services If Not $bRunning Then Return 0 ToolTip("Student Services", 0, 0) If WinWait("Main Menu - Internet Explorer", "", 3) = 0 Then ToolTip("Your Connection Is to Slow !", 0, 0) Else EndIf ;====>Break Check If Not $bRunning Then Return 0 Local $sMyString = "Student Services" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks ;====>Break Check If Not $bRunning Then Return 0 Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next EndFunc ;==>_Start Func Stopfunc() $bRunning = False MsgBox(0, "", "Finally Stopped") Exit 0 EndFunc ;==>Stopfunc The Only issue is it takes about 5 or 6 to stop script. 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