Sign in to follow this  
Followers 0
Wyldfire

Help this noob start his program.

5 posts in this topic

#1 ·  Posted (edited)

Hello guys, I have trouble getting my script started. It runs without error but it does nothing. It is a very simple click bot using my browser to automate some mouseclicks. I am not trying to do anything too fancy. Just be able to Run it and Pause it with a button and Quit.

I have made a working script before, but I've never used AU3Record before. I don't remember which tut I used long ago. I wish I did.

;============================GLOBAL DECLARATIONS===================================================
Global $Paused
HotKeySet('{HOME}', 'TogglePause') ;SCRIPT START
HotKeySet('{END}', 'Quit') ;SCRIPT QUIT
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
AU3RecordSetup()
;============================GLOBAL DECLARATIONS===================================================
;============================SCRIPT STARTED=======================================================
While 1
Sleep(100)
_WinWaitActivate("Start menu","All Programs")
MouseClick("left",37,573,1)
MouseClick("left",70,69,1)
MouseClick("left",89,77,1)
Sleep("1000")
MouseClick("right",435,80,1)
Sleep("1000")
MouseClick("left",476,111,1)
Sleep("1000")
;============================SITE 1=======================================================
_WinWaitActivate("Jamba Juice - Chromium","Jamba Juice")
MouseClick("left",492,768,1)
Sleep("1000")
MouseClick("left",639,747,1)
MouseMove(284,292)
Sleep("1000")
MouseDown("left")
MouseMove(255,765)
MouseUp("left")
Sleep("1000")
MouseClick("left",256,8,1)
;============================SITE 2=======================================================
_WinWaitActivate("Wise Foods - Chromium","Wise Foods")
MouseClick("left",380,546,1)
Sleep("1000")
MouseClick("left",353,544,1)
Sleep("1000")
MouseClick("left",487,643,1)
Sleep("1000")
MouseClick("left",487,643,1)
Sleep("1000")
MouseClick("left",487,643,1)
Sleep("1000")
MouseClick("left",357,8,1)
Sleep("1000")
;============================SITE 3=======================================================
_WinWaitActivate("Orville Redenbacher's - Chromium","Orville Redenbacher'")
MouseClick("left",375,465,1)
Sleep("1000")
MouseClick("left",463,8,1)
Sleep("1000")
Wend
;============================SITE 10=======================================================
;============================SITE 11=======================================================
;============================SITE 12=======================================================
;============================SITE 13=======================================================
;============================SITE 14=======================================================
;============================SITE 15=======================================================
;============================ SCRIPT ENDED =======================================================
;============================ START/PAUSE / FUNCTIONS =======================================================

Func TogglePause()
$Paused = Not $Paused
While $Paused
     Sleep(100)
     ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause

Func Quit()
Exit
EndFunc ;==>Quit
Edited by Wyldfire

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Your script is full of mistakes. I would recomend reading help files.

;============================GLOBAL DECLARATIONS===================================================
Global $Paused
HotKeySet('{HOME}', 'TogglePause') ;SCRIPT START
HotKeySet('{END}', 'Quit') ;SCRIPT QUIT
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
_AU3RecordSetup()
;============================GLOBAL DECLARATIONS===================================================
;============================SCRIPT STARTED=======================================================
While 1
Sleep(100)
_WinWaitActivate("Start menu","All Programs")
MouseClick("left",37,573,1)
MouseClick("left",70,69,1)
MouseClick("left",89,77,1)
Sleep(1000)
MouseClick("right",435,80,1)
Sleep(1000)
MouseClick("left",476,111,1)
Sleep(1000)
;============================SITE 1=======================================================
_WinWaitActivate("Jamba Juice - Chromium","Jamba Juice")
MouseClick("left",492,768,1)
Sleep(1000)
MouseClick("left",639,747,1)
MouseMove(284,292)
Sleep(1000)
MouseDown("left")
MouseMove(255,765)
MouseUp("left")
Sleep(1000)
MouseClick("left",256,8,1)
;============================SITE 2=======================================================
_WinWaitActivate("Wise Foods - Chromium","Wise Foods")
MouseClick("left",380,546,1)
Sleep(1000)
MouseClick("left",353,544,1)
Sleep(1000)
MouseClick("left",487,643,1)
Sleep(1000)
MouseClick("left",487,643,1)
Sleep(1000)
MouseClick("left",487,643,1)
Sleep(1000)
MouseClick("left",357,8,1)
Sleep(1000)
;============================SITE 3=======================================================
_WinWaitActivate("Orville Redenbacher's - Chromium","Orville Redenbacher'")
MouseClick("left",375,465,1)
Sleep(1000)
MouseClick("left",463,8,1)
Sleep(1000)
Wend
;============================SITE 10=======================================================
;============================SITE 11=======================================================
;============================SITE 12=======================================================
;============================SITE 13=======================================================
;============================SITE 14=======================================================
;============================SITE 15=======================================================
;============================ SCRIPT ENDED =======================================================
;============================ START/PAUSE / FUNCTIONS =======================================================
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Func Quit()
Exit
EndFunc ;==>Quit

Edit: If it is a web browser automatation then take a look at _IE functions in the help files

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you are running Internet Explorer I would suggest to have a look at the IE UDF which comes with AutoIt.

This makes your script much more reliable!

Edit: Just noticed that ileandros has given you the same advice.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

BTW:

Please use descriptive thread titles. Eveone on the General Helpd and Support forum is looking for help.

The better you describe your problem in the title the more people will be willing to open the thread ...


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

What everyone else said plus the addition of use [autoit][/autoit] tags when displaying AutoIt code in the Forum.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

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  
Followers 0