SimpleC Posted December 27, 2012 Share Posted December 27, 2012 I honestly have no idea why this isn't working. It should be simple! This is just a brief example of what I'm trying to do. #include <array.au3> dim $test[5] $test[0] = 55 $test[1] = 59.25 $test[3] = 65 $test[4] = 65.45 mouseclick("left", 410, 203, 1) sleep(100) for $i = 0 to 3 send($test[$i]) sleep(50) send("{enter}") sleep(50) next The problem is the the loop doesn't get past the decimal. Any help would be awesome. All its trying to do is write that array to an open notepad Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 27, 2012 Moderators Share Posted December 27, 2012 (edited) Hi, SimpleC. To begin with, can you explain why you declare your array with 5 elements, and then skip [2]? Is this just a type, or is this how it is in your actual script? Beyond adding the missing element, it all worked just fine for me. Edit: Notice too that you have 5 elements in your array, but only loop through 4 of them, so you'll only get 4 outputs. This works fine and prints out [0], [1], [2], and [3] #include <array.au3> dim $test[5] $test[0] = 55 $test[1] = 59.25 $test[2] = 60.31 $test[3] = 65 $test[4] = 65.45 mouseclick("left", 410, 203, 1) sleep(100) for $i = 0 to 3 send($test[$i]) sleep(50) send("{enter}") sleep(50) next Edited December 27, 2012 by JLogan3o13 "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...
Xandy Posted December 27, 2012 Share Posted December 27, 2012 (edited) local $testmax= 5, $test[$testmax] You have 4 elements, but you skip index [2] when you define them. If the don't skip 2 you might have 5 elements I would loop through the array like this to simplify things for myself. for $i= 0 to $testmax-1; Your example prints decimals just fine. Edited December 27, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Andreik Posted December 27, 2012 Share Posted December 27, 2012 As JLogan3o13 said you made some strange things, commented below. #include <array.au3> dim $test[5] $test[0] = 55 $test[1] = 59.25 ;<<--- Skipped ?? $test[3] = 65 $test[4] = 65.45 mouseclick("left", 410, 203, 1) sleep(100) for $i = 0 to 3 ;<<--- maybe to 4? send($test[$i]) sleep(50) send("{enter}") sleep(50) next When the words fail... music speaks. Link to comment Share on other sites More sharing options...
SimpleC Posted December 27, 2012 Author Share Posted December 27, 2012 (edited) Just a typo here on the forums. It's right in the script. There's no error message either. You say it works for you? Hmm. Maybe I should go try it on another computer. Here's the actual code dim $test[5] $test[0] = 59 $test[1] = 59.55 $test[2] = 59 $test[3] = 59 click(410, 203) for $i = 0 to 4 send($test[$i]) sleep(100) send("{enter}") Next if I take out the 59.55 and just put 59 without the decimal it works fine. Edited December 27, 2012 by SimpleC Link to comment Share on other sites More sharing options...
Xandy Posted December 27, 2012 Share Posted December 27, 2012 (edited) You say it works for you? Hmm. Maybe I should go try it on another computer.Na, when was your last reformat?It's probably the code dude, do an exact copy, somebody will solve this for you.edit: I mis-read you. I thought you said maybe you should buy another computer. Oops, yeah try it on another machine. Edited December 27, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 27, 2012 Moderators Share Posted December 27, 2012 (edited) Just a typo here on the forums. It's right in the script. There's no error message either. You say it works for you? Hmm. Maybe I should go try it on another computer. Here's the actual code dim $test[5] $test[0] = 59 $test[1] = 59.55 $test[2] = 59 $test[3] = 59 click(410, 203) for $i = 0 to 4 send($test[$i]) sleep(100) send("{enter}") Next if I take out the 59.55 and just put 59 without the decimal it works fine. That cannot be the "actual code" as click is not a function. When I change it back to Mouseclick, it prints out the 4 numbers, with decimals, just fine. However, as you are declaring 5 elements, and looping 5 times, but only have 0-3 defined, there will be a couple of blank lines. Edit: I am going to hazard a wild and crazy guess that you're not actually trying to print this stuff into Notepad. Why not fill us in on the name of the application you're trying to work with? There are probably ways of accomplishing what you want that are 10x easier than using MouseClick and Send. Edited December 27, 2012 by JLogan3o13 "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...
SimpleC Posted December 27, 2012 Author Share Posted December 27, 2012 I've been using autoit for years. I've coded literally thousands of lines of code in it. I use it everyday at work. It has to be something other then the script. Ok.. just tested it on another computer and it works fine. So yeah, I'm not sure why it wouldn't be working on this machine. Link to comment Share on other sites More sharing options...
SimpleC Posted December 27, 2012 Author Share Posted December 27, 2012 (edited) That cannot be the "actual code" as click is not a function. When I change it back to Mouseclick, it prints out the 4 numbers, with decimals, just fine. However, as you are declaring 5 elements, and looping 5 times, but only have 0-3 defined, there will be a couple of blank lines.Most of my scripts have a custom function to shorten mouseclick func click($x, $y, $clicks = 1) mouseclick("left", $x, $y, $clicks)endfuncAlso this is just a test to figure out why my actual code isn't working. A quick throw together array to see where the problem is.Thanks for the help though guys. I might try a complete uninstall and reinstall and see what happens. If I can't get it I'll just switch to one of my other computers. Edited December 27, 2012 by SimpleC Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 27, 2012 Moderators Share Posted December 27, 2012 (edited) That may be, but when you use MouseClick in the first post, and then your custom click function in another, without letting us in on the secret, you make it difficult to assist you Edit: Not to mention skipping or omitting elements in your array, and changing the number of elements you loop through Edited December 27, 2012 by JLogan3o13 "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...
water Posted December 27, 2012 Share Posted December 27, 2012 Can you please explain what you try to achieve? Do you try to solve a real problem or do you just "play" with AutoIt? If we know what you try to do we might provide a much simpler solution. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
SimpleC Posted December 27, 2012 Author Share Posted December 27, 2012 It's fairly simple. The loop ends when it gets to the decimal. If the decimal isn't there the loop runs fine. If I replace 59.55 with 59, it completes the loop. As soon as I put in 59.55 the script ends. Link to comment Share on other sites More sharing options...
water Posted December 27, 2012 Share Posted December 27, 2012 What I mean is: Which application do you try to automate? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
SimpleC Posted December 27, 2012 Author Share Posted December 27, 2012 All this is doing is writing that array to an open notepad. Which that exact code works on a different computer just not this one. It's weird. Link to comment Share on other sites More sharing options...
water Posted December 27, 2012 Share Posted December 27, 2012 (edited) This might be caused by different screen resolutions so notepad might be on different screen coordinates or many other reasons. But again: Is this a real task you need to solve or do you just play (means: is it worth the effort)? Edited December 27, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
SimpleC Posted December 27, 2012 Author Share Posted December 27, 2012 (edited) Nope, this is actually something for work. I'll keep at it and report back when I figure out what's actually going on.Solved!I'm a noobHaha... Ok. I had my terminate hotkey set to period.HotKeySet(".", "terminate")func terminate() exit 0EndFuncSo yeah... thanks for the help though everyone. Edited December 27, 2012 by SimpleC Link to comment Share on other sites More sharing options...
water Posted December 27, 2012 Share Posted December 27, 2012 I suggest to use something like this to send data to notepad: Global $test[5] = [59, 59.55, 59, 59] WinActivate("Unbenannt - Editor") ; <== Replace with the window title of your notepad for $i = 0 to 4 send($test[$i]) send("{enter}") Next My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 27, 2012 Share Posted December 27, 2012 Solved!I'm a noobHaha... Ok. I had my terminate hotkey set to period.Please, if you post a problem the next time add the complete script!Without a complete script it is impossible to help you. And - more important - wastes our and your time! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 27, 2012 Moderators Share Posted December 27, 2012 Nothing like expecting people to guess at wtf you're doing... "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...
SimpleC Posted December 28, 2012 Author Share Posted December 28, 2012 Please, if you post a problem the next time add the complete script!Without a complete script it is impossible to help you. And - more important - wastes our and your time!Will do. Thanks again though! 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