milos83 Posted January 22, 2018 Author Share Posted January 22, 2018 41 minutes ago, Earthshine said: I just tested the workaround 1 that was posted above. I commented out the first line and added a declaration for the dummy. Works!! ;~ $gGUIDummy = GUICreate("") Local $gGUIDummy Run("notepad.exe") $HWND = WinWait("Untitled - Notepad") WinActivate($gGUIDummy) ConsoleWrite("Sending..." & @CRLF) ;~ ControlSend($HWND, "", "", "!f") ;control Id 0 is the issue here WinMenuSelectItem($hWnd,"","&File","&Save") ConsoleWrite("sent..." & @CRLF) I think as long as you use a valid dummy variable (not defined on the fly, EVER) it seems to work. no errors. Can any of you mod's please move this topic to the development forum? Earthshine 1 Link to comment Share on other sites More sharing options...
Earthshine Posted January 22, 2018 Share Posted January 22, 2018 yeah, I think you were just feeding it garbage and not a null variable, so this actually makes sense. Did you check the @error? and extended error info when you don't allocate a variable before using it? This is probably not a bug IMO. You can't feed things garbage memory locations and expect things to work in any language. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Developers Jos Posted January 22, 2018 Developers Share Posted January 22, 2018 36 minutes ago, milos83 said: Can any of you mod's please move this topic to the development forum? Why? This looks like an AutoIt3 discussion. Jos Earthshine 1 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...
Earthshine Posted January 22, 2018 Share Posted January 22, 2018 (edited) i think this is working properly. You can't throw out an un-allocated memory address (pointer) at a function and not expect problems. that variable is just a pointer to memory somewhere. Edited January 22, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
milos83 Posted January 22, 2018 Author Share Posted January 22, 2018 1 hour ago, Jos said: Why? This looks like an AutoIt3 discussion. Jos Well, people tend to do a "Here, I fixed it..." instead of discussing is it a bag or not Link to comment Share on other sites More sharing options...
milos83 Posted January 22, 2018 Author Share Posted January 22, 2018 1 hour ago, Earthshine said: yeah, I think you were just feeding it garbage and not a null variable, so this actually makes sense. Did you check the @error? and extended error info when you don't allocate a variable before using it? This is probably not a bug IMO. You can't feed things garbage memory locations and expect things to work in any language. Actually, if you look at my original post, I am sending a zero, not a variable. You are right, we can't expect everything to work no matter what we trow at it. I just wanted to point out an observation. Nothing critical. Regards Link to comment Share on other sites More sharing options...
Earthshine Posted January 22, 2018 Share Posted January 22, 2018 (edited) good luck with your scripting. BrewMan had the correct answer first. You just had to WinActivate your Notpad instance and your original code works great. $gGUIDummy = GUICreate("") ;~ MsgBox(1, "", "GUI Windows Handle is: " & $gGUIDummy) Run("notepad.exe") $HWND = WinWait("Untitled - Notepad") WinActivate($gGUIDummy) WinActivate($HWND) ControlSend($HWND, "", 0, "!f") ;control Id 0 is the issue here GUICreate was giving us a valid handle, checked it. Edited January 22, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
milos83 Posted January 23, 2018 Author Share Posted January 23, 2018 4 hours ago, Earthshine said: good luck with your scripting. BrewMan had the correct answer first. You just had to WinActivate your Notpad instance and your original code works great. $gGUIDummy = GUICreate("") ;~ MsgBox(1, "", "GUI Windows Handle is: " & $gGUIDummy) Run("notepad.exe") $HWND = WinWait("Untitled - Notepad") WinActivate($gGUIDummy) WinActivate($HWND) ControlSend($HWND, "", 0, "!f") ;control Id 0 is the issue here GUICreate was giving us a valid handle, checked it. On 1/17/2018 at 5:30 PM, milos83 said: That code is showing how in certain condition the ControlSend is blocking further script execution. You can't remove a part of code and say "Here! It doesn't block anymore!" XD Link to comment Share on other sites More sharing options...
Earthshine Posted January 23, 2018 Share Posted January 23, 2018 I didn’t remove anything this time. this is your error My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
milos83 Posted January 23, 2018 Author Share Posted January 23, 2018 5 hours ago, Earthshine said: I didn’t remove anything this time. this is your error Have a beer. 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