Notepad Posted December 29, 2009 Posted December 29, 2009 so im wanting t make a macro creator script but not like mouse record one a little different i can't really explain the problem better than this.. (19) : ==> Missing separator character after keyword.: FileWriteLine($file, "MouseClick("left"," & $3 & ", $1, 1, 0)") FileWriteLine($file, "MouseClick("left^ ERROR heres the script #Include <Timers.au3> HotKeySet("{lctrl}", "_lclick") HotKeySet("{lshift}", "_mousemove") HotKeySet("{lalt}", "_rclick") $thing = 1 While If $thing = 1 Then _Timer_Init() Else WEnd Func _lclick() _Timer_Diff($iTimeStamp) $file = FileOpen("bot.au3", 1) $thing = 0 $1 = MouseGetPos() FileWriteLine($file, "Sleep(" & $iTimeStamp & ")" FileWriteLine($file, "MouseClick("left"," & $3 & ", $1, 1, 0)") $thing = 1 FileClose($file) EndFunc Func _rclick() _Timer_Diff($iTimeStamp) $file = FileOpen("bot.au3", 1) $thing = 0 $2 = MouseGetPos() FileWriteLine($file, "Sleep(" & $iTimeStamp & ")" FileWriteLine($file, "MouseClick("right"," & $3 & ", $2, 1, 0)") $thing = 1 FileClose($file) EndFunc Func _mousemove() _Timer_Diff($iTimeStamp) $file = FileOpen("bot.au3", 1) $thing = 0 $3 = MouseGetPos() FileWriteLine($file, "Sleep(" & $iTimeStamp & ")" FileWriteLine($file, "MouseMove(" & $3 & ", 0)") $thing = 1 FileClose($file) EndFunc please help me! all i need is an au3 wizard :scorcerer: Hi.
Moderators Melba23 Posted December 30, 2009 Moderators Posted December 30, 2009 Notepad,I think you need to read the Help file a bit more carefully! 1. You cannot use the Alt, Ctrl, Shift, Win keys as HotKeys - as the Help file says: These are the modifier keys themselves! I have set the HotKeys to q, a, z at the moment - over to you to set them to any other valid keys you want.2. MouseGetPos returns an array, so you need to use the different elements to get your coordinates into the FileWrite lines.A couple of other points:The built-in timer functions are good enough here - there is no need to use the Timers UDF.It is also a good idea to open the file just once rather than every time you want to write - but then you need an exit function to close it.I have modified the script quite a bit, as you can see: expandcollapse popup;#include <Timers.au3> HotKeySet("q", "_lclick") HotKeySet("a", "_mousemove") HotKeySet("z", "_rclick") HotKeySet("{ESC}", "On_Exit") ;$thing = 1 Global $file = FileOpen("bot.au3", 1) Global $iBegin = TimerInit() While 1 Sleep(10) ;If $thing = 1 Then ; _Timer_Init() ;EndIf ; Else WEnd Func _lclick() $iTimeStamp = Int(TimerDiff($iBegin)) ;_Timer_Diff($iTimeStamp) ;$file = FileOpen("bot.au3", 1) ;$thing = 0 $1 = MouseGetPos() FileWriteLine($file, "Sleep(" & $iTimeStamp & ")") FileWriteLine($file, 'MouseClick(" left",' & $1[0] & ", " & $1[1] & ", 1, 0)") $iBegin = TimerInit() ;$thing = 1 ;FileClose($file) EndFunc ;==>_lclick Func _rclick() $iTimeStamp = Int(TimerDiff($iBegin)) ;_Timer_Diff($iTimeStamp) ;$file = FileOpen("bot.au3", 1) ;$thing = 0 $2 = MouseGetPos() FileWriteLine($file, "Sleep(" & $iTimeStamp & ")") FileWriteLine($file, 'MouseClick(" right",' & $2[0] & ", " & $2[1] & ", 1, 0)") $iBegin = TimerInit() ;$thing = 1 ;FileClose($file) EndFunc ;==>_rclick Func _mousemove() $iTimeStamp = Int(TimerDiff($iBegin)) ;_Timer_Diff($iTimeStamp) ;$file = FileOpen("bot.au3", 1) ;$thing = 0 $3 = MouseGetPos() FileWriteLine($file, "Sleep(" & $iTimeStamp & ")") FileWriteLine($file, "MouseMove(" & $3[0] & ", " & $3[1] & ")") $iBegin = TimerInit() ;$thing = 1 EndFunc ;==>_mousemove Func On_Exit() FileClose($file) Exit EndFunc ;==>On_ExitBut I hope this now works as you intended - please ask if anything is unclear. M23P.S. By the way, when you post code it is much easier to read if you use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
smashly Posted December 30, 2009 Posted December 30, 2009 (edited) Hi,Sorry to say it's not FileWriteLine() being stupid...Your missing an end bracket on the FileWriteLine($file, "Sleep(" & $iTimeStamp & ")"There are many things your script is just plain written wrongly.Can list them if you like..I'd suggest you start at the very beginning of your script and use the help file on each line of your script and step through the problems.Start with HotKeySet("{lctrl}", "_lclick")...Reading the help file tells me The following hotkeys cannot be set:Alt, Ctrl, Shift, Win These are the modifier keys themselves!Moving on to your While loop, While what?While <expression>expression If the expression is true the following statements up to the WEnd statement are executed. This loop continues until the expression is false.Moving on into your While loop..If $thing = 1 Then_Timer_Init()Else..........I could step through your code and correct every problem, but I feel that if you read the help file and took the time to try an debug your code issues then you'd feel better about it yourself.Not to mention you'd probably pick up a thing or two along the way.Cheers Edited December 30, 2009 by smashly
Notepad Posted December 30, 2009 Author Posted December 30, 2009 Thanks for the help! I haven't been using autoit for about a year i just got started up again so thanks again! Hi.
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