RacecarSoft Posted December 15, 2008 Share Posted December 15, 2008 (edited) This can be called a continuation of my previous thread, (http://www.autoitscript.com/forum/index.php?showtopic=85026).I am currently working on KeyPress v1.1 now.I made the UI with Koda v1.7.0.8 and modified it a bit in SCiTE.I want to make the OK button minimize KeyPress and then type the keys repeatedly(to stop, the user right-clicks the icon in task bar and clicks exit).The Exit button works, but the OK just gives me an error noise/nothing happens.I am using Windows XP SP3.Here is the source code:expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=beta #AutoIt3Wrapper_icon=My Pictures\KP.ico #AutoIt3Wrapper_outfile=KeyPress 1.1 WIN32.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Res_Comment=Made by Racecar 56 at www.racecar56.b3ta.org. #AutoIt3Wrapper_Res_Description=www.racecar56.b3ta.org #AutoIt3Wrapper_Res_Fileversion=1.1.0.0 #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Tidy=y #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.13.12 Author: Racecar56 Script Version: 1.1.0.0 Final Script Function: Press the specified keys numerous times. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Opt('MustDeclareVars', 1) Opt("GUICoordMode", 2) Local $foo main() Func main() Dim $myedit, $msg, $TYPEME, $OK $foo = "foo" GUICreate("RacecarSoft KeyPress"); will create a dialog box that when displayed is centered $OK = GUICtrlCreateButton("OK", 0, 100, 100) GUICtrlCreateLabel("Right-click tray icon and click Exit to exit.", 100, -120, 100) $myedit = GUICtrlCreateEdit("" & $foo, -300, -28, 200, 97, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() Send("{END}") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $OK pressKeys() EndSelect WEnd EndFunc ;==>main Func pressKeys() Dim $bar $bar = 0 While $bar <= 0 Send($foo) Sleep(05) WEnd EndFunc ;==>pressKeysNEWS: Version 1.1 out! Edited December 16, 2008 by RacecarSoft [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
jaberwacky Posted December 15, 2008 Share Posted December 15, 2008 The Exit button works, but the OK just gives me an error noise/nothing happens. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK Send($foo) <<<-- Send to where? -->>> Case $Exit Exit EndSwitch WEnd To what program are you going to send $foo? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted December 15, 2008 Share Posted December 15, 2008 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $foo = "Text to type." $Form1_1 = GUICreate("KeyPress v1.1", 633, 447, 192, 124) $Edit1 = GUICtrlCreateEdit("", 8, 8, 329, 129) GUICtrlSetData( $Edit1 , $foo ) GUICtrlCreateLabel("RacecarSoft KeyPress v1.1" & @CRLF & "Build Date: 2008/12/14", 352, 8, 268, 25) $OK = GUICtrlCreateButton("OK", 576, 408, 41, 25, 0) $Exit = GUICtrlCreateButton("Exit", 528, 408, 41, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK MsgBox( 0 , "" , $foo ) Case $Exit Exit EndSwitch WEnd I got this to work. (so far =D ) Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 To what program are you going to send $foo?Anything that just so happens to be open. [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 (edited) maybe: Send(GUICtrlRead($foo)) when you want to send the value of the control and also need to set the focus to the appropriate window first. Edited December 15, 2008 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...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 not really unless you don't want to use the Edit Control. 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...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 not really unless you don't want to use the Edit Control. I actually found out it is not fixed (other words your are right).How can I fix it now?By the way, I am using AutoIt beta. [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 I actually found out it is not fixed (other words your are right).How can I fix it now?By the way, I am using AutoIt beta.I gave the answer a few posts up. 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...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 I gave the answer a few posts up.It won't work. [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 Send(GUICtrlRead($Edit1)) 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...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 Send(GUICtrlRead($Edit1))That works but then if I type something else than 'Text to type.' in the dialog then it don't work. [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 That works but then if I type something else than 'Text to type.' in the dialog then it don't work.It will when implemented correcty. Have you tried to understand and debug your script?You need to show what you have before we can check why it doesn;t work as you expect. 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...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 It will when implemented correcty. Have you tried to understand and debug your script?You need to show what you have before we can check why it doesn;t work as you expect.I updated the source code on the first post. [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 this is wrong: $Edit1 = GUICtrlCreateEdit("", 8, 8, 329, 129) $Edit1 = GUICtrlSetData(-1, $foo) 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...
jaberwacky Posted December 15, 2008 Share Posted December 15, 2008 (edited) Does this work like you want? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1_1 = GUICreate("KeyPress v1.1", 633, 447, 192, 124) $Edit1 = GUICtrlCreateEdit("", 8, 8, 329, 129) GUICtrlCreateLabel("RacecarSoft KeyPress v1.1" & @CRLF & "Build Date: 2008/12/14", 352, 8, 268, 25) $OK = GUICtrlCreateButton("OK", 576, 408, 41, 25, 0) $Exit = GUICtrlCreateButton("Exit", 528, 408, 41, 25, 0) GUICtrlSetData( $Edit1 , "Text to type." ) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK $Edit1 = GuiCtrlRead( $Edit1 ) ConsoleWrite( "$Edit1: " & $Edit1 & @crlf ) Case $Exit Exit EndSwitch WEnd Edited December 15, 2008 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 (edited) Does this work like you want?I was trying to get the OP to think about it and figure it out....anyways: Your version will only work one time as you screw up the Edit control handle when Ok is pressed. Edited December 15, 2008 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...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 this is wrong: $Edit1 = GUICtrlCreateEdit("", 8, 8, 329, 129) $Edit1 = GUICtrlSetData(-1, $foo)Put $foo where $Edit1 is? [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2008 Developers Share Posted December 15, 2008 Put $foo where $Edit1 is?Nope. The variable $Edit1 contains the Handle to the Edit control. what happens when you perform GUICtrlSetData() ? 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...
jaberwacky Posted December 15, 2008 Share Posted December 15, 2008 I was trying to get the OP to think about it and figure it out....anyways: Your version will only work one time as you screw up the Edit control handle when Ok is pressed.Sorry! Thanks for letting me know about the bug in my code! I'm new to programming. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
RacecarSoft Posted December 15, 2008 Author Share Posted December 15, 2008 (edited) Nope. The variable $Edit1 contains the Handle to the Edit control. what happens when you perform GUICtrlSetData() ?Not enough parameters error.If I put "Text to type" in between those I get the same also. Edited December 15, 2008 by RacecarSoft [s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux. 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