redhotchillisfan Posted September 7, 2015 Share Posted September 7, 2015 Hello fellow internet friends, I am garage programmer and don't really have real educated programming degree or such things. I do love to program though. I found this nifty scripting language we call Autoit and have fallen in love with its possibilities. I am having trouble with three things. Two of the three things I believe may be related. I will ask for the problem that I believe are related and will work on the other problem myself as to not waste times for you all. The problem is that s1 and s2 are supposed to collect some text or numbers and put it on the notepad. I have found this on google and constructed my code with this in mind:For some reason though when it shoots the info on notepad, S1 will be equal to S2 and will be the value of the last collected clipboard value (which is S2). But the weirder part about this is, at some rare times, the proper values are extracted and put on notepad. So I am wondering then, is this a clipboard to variable issue or is it that the process is going so fast its having trouble keeping up? Thank you all for looking into this, I have tried to explain it so it won't be hard for the people who are helping to look into this. Thank you all again. - Your fave red hot chilli peppers fanexpandcollapse popupAutoItSetOption('MouseCoordMode', 0) sleep(500) WinSetState ( "EnerVista UR Setup", "", @SW_MAXIMIZE) while ExtractingSettingname () sleep (5000) WEnd $s1 &= ClipGet() ProcessWait (ExtractingSettingname) while ExtractingProductSetup() sleep (5000) WEnd $s2 = ClipGet() while ConfirmSettings () sleep (5000) WEnd ;;PROGRAM END Func StopURS () Exit EndFunc Func ExtractingSettingname () MouseClick ('primary', 63, 395, 1, 0) sleep(1000) MouseClick ('primary', 114, 45, 1, 0) sleep(1000) send("{down 4}") sleep(1000) send("{enter}") sleep(1000) Send("^C") sleep(1000) send("{tab 2}") sleep(1000) send("{enter}") EndFunc Func ExtractingProductSetup() MouseClick ('primary', 63, 395, 1, 0) sleep(1000) send("{right}") sleep(1000) send("{down 2}") sleep(1000) send("{right}") sleep(1000) send("{down 4}") sleep(1000) send("{right}") sleep(1000) send("{down 2}") sleep(1000) send("{enter}") sleep(1000) MouseClick ('primary', 613, 196, 1, 0) sleep(1000) Send("^C") sleep(1000) MouseClick ('primary', 289, 43, 1, 0) sleep(1000) send("{down 3}") sleep(1000) send("{enter}") sleep(5000) EndFunc Func ConfirmSettings () run("notepad.exe") sleep(1000) winwait("Untitled - Notepad") WinSetState ( "Untitled - Notepad", "", @SW_MAXIMIZE) sleep(1000) send($s1) sleep (1000) send(@lf) sleep (1000) send($s2) EndFunc Link to comment Share on other sites More sharing options...
Jfish Posted September 8, 2015 Share Posted September 8, 2015 Some questions / comments ...1. When you maximize that window do you see the keystrokes you are sending working? (if not try winactivate)2. Have you tried to identify the controls you want to read instead of sending keystrokes? That approach would be much more reliable3. What is the same value you see for $s1 and $s2? Maybe a screenshot of the app with that info would be helpful.4. Error checking. You should put some in your code to isolate the issue.5. You don't need the while loops. You could just call the functions like this:ExtractingSettingname () sleep (5000); probably not needed $s1 &= ClipGet(); could move into the function after sending ctrl+c ExtractingProductSetup() sleep (5000); probably not needed $s2 = ClipGet(); could move into the function after sending ctrl+c ConfirmSettings () sleep (5000); probably not needed6. I don't think you need this either because you are using it with your function. From the help fileProcess names are executables without the full path, e.g., "notepad.exe" or "winword.exe":ProcessWait (ExtractingSettingname) Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
redhotchillisfan Posted September 14, 2015 Author Share Posted September 14, 2015 Hi Jfish, Thank you for your help. The problem happened when I tried my code on a type of window within the software I am trying to automate that doesn't allow you to do anything unless you close the window first. Thank you for letting me know how to make my code shorter. I will attempt to close this topic as I realized my biggest issue in my project here is that I am having trouble acquiring specific window handles. I will make a topic on just this as to abide by rules. Thank youRHCP FAN 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