rockin-john Posted December 10, 2016 Share Posted December 10, 2016 HI, I am having trouble getting the variables to work with the mouseclick, its keeps sending the mouse to 0,0 Top left of screen, I am new to autoit and only used basic from the days of the comodores, this seems correct to me. what have i missed out?. Local $x Local $y If loop = 0 Then $x = 500 & $y = 500 Mouseclick("Left", $x, $y) (Rest of program) Next Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted December 10, 2016 Developers Share Posted December 10, 2016 This shown script is full with syntax errors. Install the Full SciTE4AutoIt3 installer which will then run au3check automatically when pressing F5/Run. Just a couple of pointers: a variable starts with teh dollar sign ($) so loop is not considered to be a variable. There is a Next without a For statement. Open the helpfile for more proper syntax help and start reading While you are in reading mode: Also have a look at our forum rules. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rockin-john Posted December 10, 2016 Author Share Posted December 10, 2016 Hi, I have now cut & pasted the part of the code, removing the $ sign from the loop, but when checking with syntaxcheck prod (ctrl & F5) it errors until the $ is put back, but the point i was trying to make was the $x and $y varibles are causing the fault, on adding the message box when the count reaches 1 on the Variables they are false or not being assigned, Local $x Local $y For $L = 0 To 3 If $L = 1 Then $x = 915 & $y = 497 MsgBox($MB_SYSTEMMODAL, "", "Count down!" & @CRLF & $L & " " & $x) MouseClick ("Left",$x,$y) Sleep (1000) MouseClick ("Left",813,475) Sleep (1000) Next Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 10, 2016 Moderators Share Posted December 10, 2016 Try this instead: If $L = 1 Then $x = 915 $y = 497 EndIf Also, please put your code in code tags (<> symbol when posting), as it makes it far easier to read. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 10, 2016 Developers Share Posted December 10, 2016 (edited) This will not result in what you are expecting: If $L = 1 Then $x = 915 & $y = 497 Check the values of both $x and $x after this statement and you will understand. Jos EDIT: See @JLogan3o13 already gave the answer away Edited December 10, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rockin-john Posted December 10, 2016 Author Share Posted December 10, 2016 Hi, TY, it is now working, although i do not why it could not work the way I tried. John. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 10, 2016 Moderators Share Posted December 10, 2016 rockin-john, Quote although i do not why it could not work the way I tried Because you were using the wrong syntax. You cannot expect AutoIt to read your mind, you have to tell it exactly what you want it to do - and syntax is, as in all computer languages, how you do this. M23 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 10, 2016 Developers Share Posted December 10, 2016 That is simple... Run this: $L = 1 $x=0 $y=0 If $L = 1 Then $x = 915 & $y = 497 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $y = ' & $y & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $x = ' & $x & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndIf It will return the values for $x and $y in the SciTE output pane: @@ Debug(6) : $y = 0 >Error code: 0 @@ Debug(7) : $x = False >Error code: 0 So $x is set to : 915 & $y = 497 915 & 0 = 497 9150 = 497 False $y is not set at all so remain 0 Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rockin-john Posted December 10, 2016 Author Share Posted December 10, 2016 TY again, I see now, all is running ok now. Close topic. John 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