Sign in to follow this  
Followers 0
JayHawkfl

Default to Enter Key

5 posts in this topic

There are two areas where I need my GUI to default to the "Enter/Submit/Total" buttons on their respective GUI's. I haven't found a way to make that happen. If I've missed something obvious, like a help file, please point me that direction. I've been stuck on this for a few days now and its the LAST feature request before I can lunch this. I tried to use _IsPressed to Cue the same commands, which is nasty looking and sloppy, but if that's the final answer and I've just done something wrong then that's fine too. I do plan on posting the full code on the example scripts for general use/review when I'm done. Thanks in advance for your time/help with this.

#region ### START Koda GUI section ### 
;Form=C:\Documents and Settings\Administrator\Desktop\Doug's AutoIT\Dev\TigerTool\TimeDateAdjust.kxf
    Local $TmpDate = _NowDate()
    Local $Hour = @HOUR
    If $Hour < 10 Then
        $Hour = String($Hour)
        $Hour = StringMid($Hour, "2", "1")
    EndIf
    Local $Minute = @MIN
    Local $AMorPM = "PM"
    $Form1 = GUICreate("Time", 275, 280, 192, 114)
    $MonthCal1 = GUICtrlCreateMonthCal($TmpDate, 24, 64, 225, 175)
    $HourInput = GUICtrlCreateCombo($Hour, 24, 24, 57, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12")
    $Label1 = GUICtrlCreateLabel("Hours", 24, 8, 32, 17)
    $MinuteInput = GUICtrlCreateCombo($Minute, 104, 24, 57, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "00|05|10|15|20|25|30|35|40|45|50|55")
    $Label2 = GUICtrlCreateLabel("Minutes", 104, 8, 41, 17)
    $Label3 = GUICtrlCreateLabel("AM/PM", 184, 8, 41, 17)
    $Combo9 = GUICtrlCreateCombo("AM", 184, 24, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "PM")
    $UpDown1 = GUICtrlCreateUpdown($HourInput)
    $UpDown2 = GUICtrlCreateUpdown($MinuteInput)
    $Button17 = GUICtrlCreateButton("Submit", 24, 245, 225, 25)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    Local $hDLL = DllOpen("user32.dll")
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                ExitLoop
            Case $Button17
                GUISetState(@SW_HIDE)
                $CapsLockTest = _GetCapsLock()
                If $CapsLockTest = 1 Then
                    Send("{CAPSLOCK OFF}")
                    $CapsLockReSet = 1
                EndIf
                $TmpHour = GUICtrlRead($HourInput)
                $TmpMinute = GUICtrlRead($MinuteInput)
                $TmpAMorPM = GUICtrlRead($Combo9)
                $TmpDate = GUICtrlRead($MonthCal1)
                $TmpDate = StringMid($TmpDate, "6", "2") & "-" & StringMid($TmpDate, "9", "2") & "-" & StringMid($TmpDate, "1", "4")
                If $TmpHour < 10 Then
                    $TmpHour = "0" & $TmpHour
                EndIf
                Sleep(50)
                Send($TmpDate & "---" & $TmpHour & ":" & $TmpMinute & " " & $TmpAMorPM & "--" & $TechName & "{ENTER}{ENTER}Hrs- {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{UP}{UP}")
                GUIDelete($Form1)
                If $CapsLockReSet = 1 Then
                    Send("{CAPSLOCK ON}")
                    $CapsLockReSet = 0
                EndIf
                ExitLoop
                If _IsPressed("0D", $hDLL) Then
                    ConsoleWrite("test test test test" & @CRLF)
                    GUISetState(@SW_HIDE)
                    $CapsLockTest = _GetCapsLock()
                    If $CapsLockTest = 1 Then
                        Send("{CAPSLOCK OFF}")
                        $CapsLockReSet = 1
                    EndIf
                    $TmpHour = GUICtrlRead($HourInput)
                    $TmpMinute = GUICtrlRead($MinuteInput)
                    $TmpAMorPM = GUICtrlRead($Combo9)
                    $TmpDate = GUICtrlRead($MonthCal1)
                    $TmpDate = StringMid($TmpDate, "6", "2") & "-" & StringMid($TmpDate, "9", "2") & "-" & StringMid($TmpDate, "1", "4")
                    If $TmpHour < 10 Then
                        $TmpHour = "0" & $TmpHour
                    EndIf
                    Sleep(50)
                    Send($TmpDate & "---" & $TmpHour & ":" & $TmpMinute & " " & $TmpAMorPM & "--" & $TechName & "{ENTER}{ENTER}Hrs- {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{UP}{UP}")
                    GUIDelete($Form1)
                    If $CapsLockReSet = 1 Then
                        Send("{CAPSLOCK ON}")
                        $CapsLockReSet = 0
                    EndIf
                EndIf
                ExitLoop
        EndSwitch
    WEnd

Thanks for your time

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,
I'm not sure to understand your issue, have you tried the HotKeySet function?

Ah, got it. thanks Melba :)

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

JayHawkfl,

There are several ways to get a button set to default to "Press on Enter" - the $BS_DEFPUSHBUTTON style, the $GUI_DEFBUTTON state, and linking it to an Accelerator key. :)

I seem to remember that you can only have one button styled as the default per GUI (or even script), so as you seem to want several instances you might want to look at the style or the Accelerator key options (I would use the latter myself). Give it a go and see what you can come up with - you know where we are if you run into difficulties. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You can just put this in right after declaring $Button17

Local $AccelKeys[1][2] = [["{enter}", $Button17]]
GUISetAccelerators($AccelKeys)

EDIT: I'm late to the party :P

Edited by danwilli

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you so much everyone, for the answer and the quick replies, means SO MUCH that I can get this pushed out to everyone today. I'll post the full script on the example boards later today :)

EDIT: Just had the oppurtunity to try it and that worked perfectly! THANK YOU THANK YOU THANK YOU :thumbsup:  

Edited by JayHawkfl

Thanks for your time

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • barkeeper
      By barkeeper
      Hi there, not sure if this is the right place, but I'm building a script for using premade answers in chat. It works and outputs the answers (stored in an ini file based on:  answer name = answer it also works with a new line if there is a tag <enter> in the answer text in the ini file. Now the problem is, that after the answer is pasted in the chat (you bring up the interface with ctrl+1) it gives an enter, thus sending the output straight away. I would like to be able to review the answer before sending it. can anyone help me by telling what's wrong in the script, I tried replacing the @crlf in the script with other options, no luck. Thanks in advance! 
      antwoorden.au3
      antwoorden.ini
    • zxtnt09
      By zxtnt09
      Hi again,
      i have one question ! ,
      how we can use a "inetread" without any changes in doc,
      it's meant : 
      for example in this address we have this source : (Address : http://example.com)
      <!doctype html> <!-- i have <br/> ( Enter ) --> <html> <!-- i have enter too --> <head> <!-- i have too --> <title>i am in autoit :) </title> <meta charset="utf-8"> </head> <body> <p> i want to go in autoit :( </p> <a href="http://autoitscript.com">autoit</a> </body> </html> in this source you see many "Enter", now how we can have this (source) by "inetread" or "inetget" or something like that,
      i try to use that with "inetread" but it have not any "enter"!
      thanks alot 
      *sorry for my many questions,