Jump to content

[Solved] AutoIt Stops


Recommended Posts

Shouldn't AutoIt stop running the scripts once it reach the end unless you code it to repeat scripts if it's reach the end of script? I tried LoopEnd, but that doesn't stop it.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

Show what you tried. Because if there no loop then in practice the script should end.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I will only post the functionality of it; the top portion is confidential info.

While 1
If WinActive($Title) Then
     ControlClick($Title,"","MozillaWindowClass1","Left",1,85,60)
     Send($Username,1)
Send("{TAB}")
     ControlClick($Title,"","MozillaWindowClass1","Left",1,85,83)
     Send($Password,1)
     Send("{ENTER}")
Exit
EndIf
Sleep(2000)
ExitLoop
WEnd

This code works the way I want it, but it does not stop the script. Was hoping if there's a code to auto close it process in task manager if it reaches the end of Send Enter.

EDIT:

Oh great, now I have to think about the process that I kill too. If the process is killed; the browser also kill itself.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

asianqueen,

Was hoping if there's a code to auto close it process in task manager if it reaches the end of Send Enter.

Can you give more details about what you are trying to do? If your code finds the window it is looking for it will do the send's and controlclick's and then end. If it does not find the window it will wait for 2 seconds and exit the while loop.

What does any of this have to do with Task Manager or terminating a process?

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

This script will auto login me into a website. Once it fully enter the website; i want it to kill itself so that it doesn't loop. If I don't kill the process and open another website that asking for user/pass; it will automatic type the user/pass with the credential I specified.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

asianqueen,

Once it fully enter the website; i want it to kill itself so that it doesn't loop.

The "exit" in the while loop should be doing just that.

If I don't kill the process and open another website

This is where you are loosing me. Your code will exit the while loop if the window you are looking for is not found. The script will continue to run. If you want to know anything beyond this then we need more code or more detailed explanation.

kylomas

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

This is very basic needs. Just an auto login script. As soon as you login; just terminate itself so it doesn't loop. Thing is it still loop; thats the issue.

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

As stated before, the Exit command in your while loop will exit the script, it will not keep running, it will not keep looping, it will not keep logging you into any websites, it will exit the script.

If the active window doesn't have the title that matches the string in $title, then it will pause 2 seconds and then exit the While loop. Whatever is after the While loop, which you didn't show, might be what is keeping the script going.

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

Link to comment
Share on other sites

As stated before, the Exit command in your while loop will exit the script, it will not keep running, it will not keep looping, it will not keep logging you into any websites, it will exit the script.

If the active window doesn't have the title that matches the string in $title, then it will pause 2 seconds and then exit the While loop. Whatever is after the While loop, which you didn't show, might be what is keeping the script going.

You're right. The script is already working. What I did was remove

;*****************************************
;Server.au3 by AQHmoob
;Created with ISN AutoIt Studio v. 0.92 BETA
;*****************************************
#include <AutoPunch.isf>

and also compile with AutoIT instead of ISN AutoIT Studio Compiler.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

If you've specified 'Exit' it will exit and the process will be terminated...

If you've specified 'ExitLoop', it will take itself at to the line after the current loop's 'WEnd'. If there is no code after the WEnd, it will act as if there was 'Exit'.

If it is still running, that means that 'Exit' was never reached or the end of file hasn't been reached yet, and there's something keeping it from exiting.

I think you may be either delusional, or there's additional code after the fact, or you didn't mention it's wrapped in a function and it returns somewhere we didn't know about...

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Exit in a loop is bad coding practice, so is return (if the loop is in a function.)

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thats all the code... Above the code that I shown, it's only to tell autoit which site to go and what $username =, $password...

Like mention; it's a simple code just to logon to site and exit.

But for some reason ISN Compiler is giving me a hard time. After remove the line I mention and compile with the original autoit program; it works like a charm.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

I'm having a similar issue. AutoIt won't exit property, except when the exit button is pressed in this script. If pressing any other button, the script sits in the system tray after the function is executed and eats memory.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Open Docs", 468, 231, 262, 194)
GUISetIcon("C:\Doc.ico", -1)
GUISetBkColor(0xC0DCC0)

GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Choose Document Function", 125, 24, 244, 28)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$Cre8ID = GUICtrlCreateButton("Create Doc", 18, 76, 75, 25)
GUICtrlSetOnEvent($Cre8ID, "OnCre8")
$SHAREDID = GUICtrlCreateButton("Shared", 105, 76, 75, 25)
GUICtrlSetOnEvent($SHAREDID, "OnSHARE")
$SCANID = GUICtrlCreateButton("Scanned", 192, 76, 75, 25)
GUICtrlSetOnEvent($SCANID, "OnSCAN")
$PDFID = GUICtrlCreateButton("PDF", 284, 76, 75, 25)
GUICtrlSetOnEvent($PDFID, "OnPDF")
$DOCSID = GUICtrlCreateButton("My Docs", 374, 76, 75, 25)
GUICtrlSetOnEvent($DOCSID, "OnDOCS")
$SEARCHID = GUICtrlCreateButton("Search Docs", 150, 127, 177, 33)
GUICtrlSetOnEvent($SEARCHID, "OnSearch")
$ExitID = GUICtrlCreateButton("Exit", 190, 180, 91, 33)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
     Case $GUI_EVENT_CLOSE
         Exit
Case $Cre8ID
         OnCre8()
         GUIDelete($Form1)
         Exit
     Case $SCANID
         OnSCAN()
         GUIDelete($Form1)
Case $PDFID
         OnPDF()
         GUIDelete($Form1)
Case $DOCSID
         OnDOCS()
         GUIDelete($Form1)
Case $SEARCHID
         OnSearch()
         GUIDelete($Form1)
Case $SHAREDID
         OnSHARE()
         GUIDelete($Form1)
         Exit
     Case $ExitID
         Exit
EndSwitch
WEnd
Func OnCre8()
Run("X:\OFFICE11\WINWORD.EXE")
EndFunc ;==>OnCr8
Func OnSHARE()
Run("C:\Windows\explorer.exe \\NAS\Docs")
EndFunc ;==>OnSHARE
Func OnSCAN()
Run("C:\Windows\explorer.exe \\NAS\Scan")
EndFunc ;==>OnSCAN
Func OnPDF()
Run("C:\Windows\explorer.exe X:\PDF")
EndFunc ;==>OnPDF
Func OnDOCS()
Run("C:\Windows\explorer.exe X:\LocalDocs")
EndFunc ;==>OnDOCS
Func OnSearch()
run("X:\Find\docfind.cmd")
EndFunc ;==>OnSearch
Exit

Any help would be appreciated.

Link to comment
Share on other sites

copyleft,

Because you delete the gui but do not terminate the script. What do you want the script to do?

kylomas

edit: It might have been better to open your own topic...

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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