Jump to content

Search the Community

Showing results for tags 'hotkey'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 21 results

  1. Hi everyone, I would like to share a simple snippet where I use for my hotkey script. I was searching for a solution whereby pressing a same key, I could have different outcome according to the way the key is being pressed. 1) Double tap/press fast (like double click the mouse) - outcome A 2) Long press or HOLD for awhile (2-4 sec) - outcome B #Include <Timers.au3> Global $interval_timer, $counter HotKeySet("{F10}", "_terminate") While 1 Sleep(10) WEnd Func _terminate() Local $itv_timer $itv_timer = _Timer_Diff($interval_timer) $interval_timer = _Timer_Init() ;ConsoleWrite($itv_timer & @CRLF) ;to review the timer difference so I can decide the range to capture double tap sequence If $itv_timer > 100 And $itv_timer < 250 Then $counter = 0 $interval_timer = _Timer_Init() MsgBox("","","double tap detected") Elseif $counter >= 25 Then $counter = 0 $interval_timer = _Timer_Init() MsgBox("","","long press detected") ElseIf $itv_timer < 50 Then $counter = $counter + 1 ConsoleWrite($counter & @CRLF) Else $counter = 0 EndIf EndFunc The trick here is to collect and use the frequency of the hotkey is called, and the time difference between each time the hotkey is being called. My coding style is not efficient and can be such a mess most of the time, any suggestion or better coding are welcome. I hope you find this one helpful.
  2. Hi Here is a UDF which has the much requested hotkeys for mouse clicks. Autoit's hotkeyset doesn't support mouse clicks. one of the main differences with AHK (i think). ; This UDF extends AutoIT HotKeySet by adding the much requested Mouse Button Clicks ; HotKeySet (autoIT) only does KEYBOARD ; HotKeySetEx Does both KEYBOARD and MOUSE! simple interface HotKeySetEx("{RCLICK}", "myfun") ; Right Click mouse hot key HotKeySetEx("{RDCLICK}", "myfun") ; Right double click mouse hot key HotKeySetEx("{F1}", "myfun") ; normal hot key ; new function call replaces @HotKeyPressed ; getLastHotKey() = eg {RCLICK} or {F1} See MouseTrapEvent for supported events. ; single clicks ; LClick - left button click (Primary) ; MClick - middle button click (Wheel click) ; RClick - right button click (Secondary) ; XClick1 - Xtra button 1 click (usually 'back navigaton') ; XClick2 - Xtra button 2 click (usually 'forward navigaton') ; double clicks ; LDClick - left button (Primary) ; MDClick - middle button (Wheel click) ; RDClick - right button (Secondary) ; XDClick1 - Xtra button 1 (usually 'back navigaton') ; XDClick2 - Xtra button 2 (usually 'forward navigaton') ; psuedo double clicks ('chords') - ; XClick12 - Xtra button 1&2 pressed at the same time. ; ; OTHER EVENTS you'll have to work out yourself eg mouse wheel scroll - see code. This UDF is based on MouseTrapEvent which is based on MouseSetEvent. New events for scroll and drag could be added see MouseTrapEvent code. enjoy Version two fixed left and middle double, click. Note there is a bug if you set a double click, you should set a single click as it get blocked (my apols). HotKeySetExV2.zip HotKeySetEx.zip
  3. Hello everybody Greetings! I am checking in the script below to see if the user has input a specific term (such CAT/cat) in a window (Notepad) #include <Misc.au3> If WinActivate("Untitled - Notepad") Then While 1 If _IsPressed("43") And _IsPressed("41") And _IsPressed("54") Then ConsoleWrite("CAT is typed" & @LF) EndIf Sleep(250) WEnd EndIf The only problem is that it will only highlight CAT written in one sitting, not CAT written over time. If the user takes the time to type CAT, it needs to be highlighted that cat was entered after they type C-A-T at T. This is a project for a playground for kids. I'm constructing for the students. Any alternative approach is welcome. Thanks!
  4. This script will make it so you can press Alt + "+" in Windows Explorer to select all files with the current file extension. This is something that I wanted for a long time and it should be a feature in Windows, but it's not. The only way to get close is to use the search thing (but then it shows the results excluding everything else) or to group by that type, but I don't want it grouped. You can press Alt + Enter right after to open properties on those files or you can press delete to delete only files of that type. You need the "Automating Windows Explorer" pack here: https://www.autoitscript.com/forum/topic/162905-automating-windows-explorer/ #include "Includes\AutomatingWindowsExplorer.au3" #include <Array.au3> Opt( "MustDeclareVars", 1 ) HotKeySet("!=", "SelectTypes") Func SelectTypes() ; Windows Explorer on XP, Vista, 7, 8 Local $hExplorer = WinGetHandle("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Explorer", "Could not find Windows Explorer.") Return EndIf $hExplorer = WinActive("[REGEXPCLASS:^(Cabinet|Explore)WClass$]") If Not $hExplorer Then MsgBox(0, "Explorer", "Windows Explorer is not in focus.") Return EndIf ; Get an IShellBrowser interface GetIShellBrowser($hExplorer) If Not IsObj($oIShellBrowser) Then MsgBox(0, "Explorer", "Could not get an IShellBrowser interface.") Return EndIf ; Get other interfaces GetShellInterfaces() ; Get selected files with full path ;GetFiles( $fSelected = False, $fFullPath = False, $fPidl = False, $iMax = 0 ) Local $aAllFiles = GetItems(False, False) Local $aFiles = GetItems(True, False) Local $sExt Local $i If UBound($aFiles) = 1 Then ;MsgBox(0, "Selected", $aFiles[0]) $sExt = StringRight($aFiles[0], StringLen($aFiles[0]) - StringInStr($aFiles[0], ".", 0, -1)) ;MsgBox(0, "Selected", $sExt) For $i = 0 To UBound($aAllFiles) - 1 If StringInStr($aAllFiles[$i], ".") > 0 Then If StringRight($aAllFiles[$i], StringLen($aAllFiles[$i]) - StringInStr($aAllFiles[$i], ".", 0, -1)) = $sExt Then SetSelectedItem($i) EndIf EndIf Next Else MsgBox($MB_ICONWARNING, "Error", "None or multiple items selected!") EndIf EndFunc While 1 GUIGetMsg() Wend
  5. I've been trying to use the hotkey but it doesn't seem to work. The console log says "AU3 Check ended" thing everytime I run the script, it annoys the hell out of me. I'm quite new to AutoIt. Any help would be greatly appreciated. HotKeySet("a", "notepad") HotKeySet("b", "notepad") HotKeySet("c", "notepad") HotKeySet("d", "notepad") HotKeySet("e", "notepad") HotKeySet("f", "notepad") HotKeySet("g", "notepad") HotKeySet("h", "notepad") HotKeySet("i", "notepad") HotKeySet("j", "notepad") HotKeySet("k", "notepad") HotKeySet("l", "notepad") HotKeySet("m", "notepad") HotKeySet("n", "notepad") HotKeySet("o", "notepad") HotKeySet("p", "notepad") HotKeySet("q", "notepad") HotKeySet("r", "notepad") HotKeySet("s", "notepad") HotKeySet("t", "notepad") HotKeySet("u", "notepad") HotKeySet("v", "notepad") HotKeySet("w", "notepad") HotKeySet("x", "notepad") HotKeySet("y", "notepad") HotKeySet("z", "notepad") HotKeySet("{[}", "notepad") HotKeySet("{]}", "notepad") HotKeySet("{'}", "notepad") HotKeySet("{;}", "notepad") HotKeySet("{,}", "notepad") HotKeySet("{/}", "notepad") HotKeySet("{?}", "notepad") HotKeySet("{.}", "notepad") HotKeySet("{<}", "notepad") HotKeySet("{>}", "notepad") HotKeySet("{}}", "notepad") HotKeySet("{\}", "notepad") HotKeySet("{{}", "notepad") HotKeySet("{|}", "notepad") HotKeySet("{=}", "notepad") HotKeySet("{+}", "notepad") HotKeySet("{-}", "notepad") HotKeySet("{_}", "notepad") HotKeySet("{(}", "notepad") HotKeySet("{)}", "notepad") HotKeySet("{*}", "notepad") HotKeySet("{&}", "notepad") HotKeySet("{^}", "notepad") HotKeySet("{%}", "notepad") HotKeySet("{$}", "notepad") HotKeySet("{#}", "notepad") HotKeySet("{@}", "notepad") HotKeySet("{!}", "notepad") HotKeySet("{`}", "notepad") HotKeySet("{~}", "notepad") HotKeySet("{1}", "notepad") HotKeySet("{2}", "notepad") HotKeySet("{3}", "notepad") HotKeySet("{4}", "notepad") HotKeySet("{5}", "notepad") HotKeySet("{6}", "notepad") HotKeySet("{7}", "notepad") HotKeySet("{8}", "notepad") HotKeySet("{9}", "notepad") HotKeySet("{0}", "notepad") Func notepad() Run("notepad.exe") EndFunc
  6. Hi, here is a configurable HotKey Gui script, which i wrote for my current Project: #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <String.au3> #include <WindowsConstants.au3> #include <Array.au3> Global $snip_inifile = @ScriptDir & "\" & "hotkeygui.ini" ;If $HKSTRING is changed, make sure to adjust the $z number in the SetHotkeyKeys function. Local $HKSTRING = "[;][#;Win][!;Alt][+;Shift][^;Ctrl][0;0][1;1][2;2][3;3][4;4][5;5][6;6][7;7][8;8][9;9][a;a][b;b][c;c][d;d][e;e][f;f][g;g][h;h][i;i][j;j][k;k][l;l][m;m][n;n][o;o][p;p][q;q][r;r][s;s][t;t][u;u][v;v][w;w][x;x][y;y][z;z][{PAUSE};Pause][{BREAK};Break][{HOME};Home/Pos1][{END};END][{PGUP};Page UP][{PGDN};Page Down][{F1};F1][{F2};F2][{F3};F3][{F4};F4][{F5};F5][{F6};F6][{F7};F7][{F8};F8][{F9};F9][{F10};F10][{F11};F11][{F12};F12][{SPACE};Space]" Local $HKT = _StringBetween($HKSTRING, "[", "]") Global $HK, $HKS Global $h_HotkeyTestInput Dim $HK[0][2] ;Hotkey keys+names Dim $HKS[6] ;Hotkey (ini)settings 0-3 combo boxes, 4 = Redirect the hotkey test to the input box, 5=Current Hotkey Set. For $x = 0 To UBound($HKT) - 1 ;Make an array including the text from HKSTRING _ArrayAdd($HK, $HKT[$x], 0, ";") Next $HKT = "" $HKSTRING = "" SetHotkeyKeys(0) ;Set the initial hotkey SetHotkeyKeys(1) ;Open the config-gui while 1 ;Test the hotkey. Output is in the console. Exit through traymenue. sleep (10) WEnd Func SetHotkeyKeys($showgui = 0) ;$showgui 0 = Set the saved hotkeys, 1 = Show gui to change the settings Local $a, $b, $c, $z $z=4 ;$z of the text from $HK will go in to c1-c3, the rest goes to c4 $HKS[0] = IniRead($snip_inifile, "hotkey", "0", "4") $HKS[1] = IniRead($snip_inifile, "hotkey", "1", "0") $HKS[2] = IniRead($snip_inifile, "hotkey", "2", "0") $HKS[3] = IniRead($snip_inifile, "hotkey", "3", "12") $HKS[4] = 0 $HKS[5] = $HK[$HKS[0]][0] & $HK[$HKS[1]][0] & $HK[$HKS[2]][0] & $HK[$HKS[3] + $z + 1][0] If $showgui = 1 Then $HKS[4] = 1 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Hotkey Config", 317, 79, -1, -1, $WS_POPUP + $WS_CAPTION) $C1 = GUICtrlCreateCombo("", 4, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $C2 = GUICtrlCreateCombo("", 82, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $C3 = GUICtrlCreateCombo("", 161, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $C4 = GUICtrlCreateCombo("", 239, 50, 72, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $Label1 = GUICtrlCreateLabel("Please set a hotkey to use. Note: Not all combos may work.", 4, 30, 300, 17) $Button1 = GUICtrlCreateButton("Set + Save", 4, 4, 70, 23) $h_HotkeyTestInput = GUICtrlCreateInput("Test", 82, 5, 150, 21) $Button2 = GUICtrlCreateButton("Exit", 239, 5, 72, 23) _GUICtrlComboBox_SetMinVisible($C4, 60) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### For $x = 0 To UBound($HK) - 1 If $x <= $z Then _GUICtrlComboBox_AddString($C1, $HK[$x][1]) _GUICtrlComboBox_AddString($C2, $HK[$x][1]) _GUICtrlComboBox_AddString($C3, $HK[$x][1]) Else _GUICtrlComboBox_AddString($C4, $HK[$x][1]) EndIf Next _GUICtrlComboBox_SetCurSel($C1, $HKS[0]) _GUICtrlComboBox_SetCurSel($C2, $HKS[1]) _GUICtrlComboBox_SetCurSel($C3, $HKS[2]) _GUICtrlComboBox_SetCurSel($C4, $HKS[3]) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button2 GUIDelete($Form1) ExitLoop Case $Button1 $HKS[0] = _GUICtrlComboBox_GetCurSel($C1) ;Read the combo - boxes $HKS[1] = _GUICtrlComboBox_GetCurSel($C2) $HKS[2] = _GUICtrlComboBox_GetCurSel($C3) $HKS[3] = _GUICtrlComboBox_GetCurSel($C4) HotKeySet($HKS[5]) ;Clear the Old Hotkey $HKS[5] = $HK[$HKS[0]][0] & $HK[$HKS[1]][0] & $HK[$HKS[2]][0] & $HK[$HKS[3] + $z +1][0] ;Assemble the hotkey string, use $z+1 ! If HotKeySet($HKS[5], "DoHotkey") = 0 Then MsgBox(0, "Hotkey", "Err: Could not set. " & $HKS[5]) ;Set the hotkey or display a message IniWrite($snip_inifile, "hotkey", "0", $HKS[0]) ;Save the hotkey to the ini file IniWrite($snip_inifile, "hotkey", "1", $HKS[1]) IniWrite($snip_inifile, "hotkey", "2", $HKS[2]) IniWrite($snip_inifile, "hotkey", "3", $HKS[3]) EndSwitch WEnd EndIf If $HKS[4] = 0 Then ;Function was called with 0 $HKS[5] = $HK[$HKS[0]][0] & $HK[$HKS[1]][0] & $HK[$HKS[2]][0] & $HK[$HKS[3] + $z + 1][0] If HotKeySet($HKS[5], "DoHotkey") = 0 Then MsgBox(0, "Hotkey", "Err: Could not set. " & $HKS[5]) Else $HKS[4] = 0 EndIf EndFunc ;==>SetHotkeyKeys Func DoHotkey() If $HKS[4] = 0 Then ;Main function ConsoleWrite("PRESS" & @CRLF) Else ;Gui test code: GUICtrlSetData($h_HotkeyTestInput, "Hotkey ! " & @hour & ":" & @min & ":" & @SEC) EndIf EndFunc ;==>DisplayActiveProcess This script uses only 1 hotkey, and saves it into an ini file. To load and use the saved Hotkey from the ini use: SetHotkeyKeys(0) And to open the configuration window, use SetHotkeyKeys(1). Have fun.
  7. I need to mute an ongoing call on Microsoft teams without activating the window. Teams allows us to mute using shortcut key Ctrl+Shift+m but only when the window is active. # Used set option as ongoing call can be with any person which leads to change in Title Name. AutoItSetOption ( "WinTitleMatchMode", 2 ) # I am not clear with the control ID which will be good to use here and also the key combination of ^M ControlSend ( "Microsoft Teams", "", "[CLASS:Intermediate D3D Window; INSTANCE:1]", "{ctrl down}") Can anyone help...!!!
  8. Hi Guis, I need to create keyboard shortcut to navigate the tabs and activate them, but I could not use the code below: #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <GUIConstantsEx.au3> HotKeySet("^{TAB}", "_TabRight") HotKeySet("^+{TAB}", "_TabLeft") $gui = GUICreate("test",450, 300) $Tab1 = GUICtrlCreateTab(20, 24, 425, 201) $TabSheet1 = GUICtrlCreateTabItem("Tabsheet 1") $lbContagemGrupos2 = GUICtrlCreateLabel("aaaa", 50, 50) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateTabItem("") $TabSheet2 = GUICtrlCreateTabItem(" ") $TabSheet3 = GUICtrlCreateTabItem(" ") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _TabRight() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos + 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Func _TabLeft() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos - 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Exit can you help me?
  9. Screenshot program that can upload/FTP to website/storage with hotkey. Features GUI to display programmable keys. Set the hotkeys with this function to use, and display hotkeys. ; hotkey_set() Parameters: ; ----------------------------------------------------------- ; $aHotkey -                The array hotkeys are stored in. This function sets the values of this array[hotkey_id][$hotkey_data] ; $dHotkey_id -             The enum for this hotkey index ; $sHotkey_description -     The label displayed to the user to represent function of hotkey ; $sHotkey_name -            The hotkey it'self.  Whatever name string you want to give the key ; $dHotkey_key -             The _IsPressed keycode ;    Keycodes AT: https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm ; $dHotkey_shift -             Shift flag 0 or 1 Default off ; $dHotkey_ctrl -             Ctrl flag 0 or 1 Default off ; $dHotkey_alt -             Alt flag 0 or 1 Default off Func hotkey_set(ByRef $aHotkey, $dHotkey_id, $sHotkey_description, $sHotkey_name, $dHotkey_key, $dHotkey_shift = 0, $dHotkey_ctrl = 0, $dHotkey_alt = 0)     $aHotkey[$dHotkey_id][$eHotkey_data_key_description] = $sHotkey_description     $aHotkey[$dHotkey_id][$eHotkey_data_key_name] = $sHotkey_name     $aHotkey[$dHotkey_id][$eHotkey_data_key] = $dHotkey_key     $aHotkey[$dHotkey_id][$eHotkey_data_shift] = $dHotkey_shift     $aHotkey[$dHotkey_id][$eHotkey_data_ctrl] = $dHotkey_ctrl     $aHotkey[$dHotkey_id][$eHotkey_data_alt] = $dHotkey_alt EndFunc   ;==>hotkey_set ; You can set your hotkeys here ; Please visit the hotkey_set() function for parameter information hotkey_set($aHotkey, $eHotkey_screenshot_ftp, "Selected Window to FTP", "F12", "7B", 0, 1, 0); F12 hotkey_set($aHotkey, $eHotkey_screenshot_disk, "Selected Window to Disk", "S", "53", 1, 1, 1); S hotkey_set($aHotkey, $eHotkey_clipboard_send, "Send Clipboard keystrokes", "F10", "79", 1, 1, 1); F10 Configure settings dialog: Screenshot Filename and Screenshot Counter, are used to create simple unique filenames that can cycle. Copy URL to clipboard option. - For linking your screenshots. The screenshot file type is for local copy only. App always uses .JPG for FTP right now, but I could add FTP screenshot file type specification. Any suggestions? Did I break anything, what did I miss? Package uses TTS.au3 by Beege: FTP_Screen.zip File includes: - FTP_Screen.au3 - FTPScreen.ico - TTS.au3 - by Beege
  10. Hello everyone, I am trying to setup a GUI accelerator to close the utility as soon as esc is pressed. It works fine with hotkey but I want to make sure that the utility only exits if its window was active when esc was pressed. My utility has 2 buttons, Backup and Restore. The exit function checks if the button clicked was Backup or Restore and then displays an error message accordingly. If pressed backup, $button = 1 if pressed restore, $button = 2 the value of $button is set inside backup() or restore() functions Opt("GUIOnEventMode", 1) Opt("GUICoordMode", 1) $Form1 = GUICreate("Form1", 419, 124, 238, 194, $WS_DLGFRAME) $B_backup = GUICtrlCreateButton("Backup", 48, 40, 145, 41) $B_restore = GUICtrlCreateButton("Restore", 224, 40, 145, 41) ;================ > HotKeySet('{ESC}', "terminate") GUICtrlSetOnEvent($B_backup, "Backup") GUICtrlSetOnEvent($B_restore, "Restore") GUISetState(@SW_SHOW) Dim $accelKey[1][2] = [["{ESC}", terminate()]] GUISetAccelerators($accelKey) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd Exit function: func terminate() Do     $msg = GUIGetMsg() Until $msg <> 0 While 1         If $button = 1 Then             ProcessClose("robocopy.exe")             MsgBox(16, "Abort!", "Backup Aborted!")             exit         ElseIf $button = 2 Then             ProcessClose("robocopy.exe")             MsgBox(16, "Abort!", "Restore Aborted!")             exit         Else             While 1                 For $i = 3 To 1 Step -1                     SplashTextOn("Closing Utility...", $i, 130, 54, -1, -1, 0, "Calibri", "", 900)                     Sleep(1000)                 Next                 ExitLoop             WEnd             SplashOff()             Exit Endif WEnd What am I doing wrong here? The utility closes as soon as it launches with Splash text.
  11. Hi All, Could someone please PLEASE tell me what I'm doing wrong here? I feel like I'm close to figuring this out, I think I've identified what is causing the issue. Whenever I try to use the hotkey CTRL+SHIFT+T (or any other letter other than T for that matter) to paste the text to notepad, my CTRL and SHIFT keys are held down *IF* I release them *WHILE* the raw text is being written. It seems to be that if I release the CTRL+SHIFT keys: Before the Send Raw text starts to write to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good During the Send Raw text being written to the screen: the CTRL and SHIFT keys ARE held down perpetually until I physically press them on the keyboard, this is bad After the Send Raw text has written all text to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good This is also the case if I were to use the Windows Key as the hot key instead of the CTRL+SHIFT, I would need to tap the WIN key physically on my keyboard if I released it while the raw tet was being sent to the screen (eg, WIN+T). This issue also happens no matter which program I try to write the text to. Here's some example code: (I've put a bunch of "a's" in there to give enough time to test releasing the CTRL+SHIFT before/during/after the writing of them) HotKeySet("^+t", "WriteTxt") Func WriteTxt() WinWaitActive("Untitled - Notepad") $var = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" send($var, 1) EndFunc While 1 Sleep(500) WEnd Thanks guys!
  12. So currently I have some code waiting for a status to change(there is different indicators to check if this status has changed) Func oneRow($count) $globaltimer = _Timer_SetTimer($gui, 60000*10, "reset") $errTimer = TimerInit() While (1)         If PixelGetColor(1117, 326) = 0xC6C6C6 Then ExitLoop (1)         Sleep(500)         MouseClick("right")         Sleep(600)         If PixelGetColor(1117, 326) = 0xC6C6C6 Then ExitLoop (1)         If TimerDiff($errTimer) > 5000 Then             If PixelGetColor(1100, 310) = 0x707070 Or PixelGetColor(901, 305) = 0xE0E0E0 Or PixelGetColor(1043, 383) = 0xC6C6C6 Then                 Sleep(100)                 Send("{esc}")                 Sleep(1000)             EndIf         EndIf     WEnd .... EndFunc   ;==>oneRow The two timers is for error checking. This works just fine the problem comes when I go into the while 1 loop, my hotkeys at the top of the program seems to stop working, for an example HotKeySet("{f1}", "stop") Func stop() Exit EndFunc ;==>stop Does not work at all after the while loop. The globaltimer is never called even though i tried setting the delay all the way down to 3 seconds. So I thought that maybe one of the function I use is blocking so the timer would never be called/the hotkey wouldn't work? if i make an delay just before the while loop the hotkey works just fine. Oh and the errTimer is supossed to not reset after 5 seconds but should keep making the check it does if five seconds have passed
  13. Hi, is there a function or a UDF for parsing a hotkey definition string like "^a" or "+!{F1}" ? I´d like to create a settings GUI where users are able to define their custom hotkeys for a specific function and then save it to an ini. Of course, at the next start of the program, these settings have to read and not only the HotkeySet() command needs to be fed with it but also the settings GUI. As I do not want to present the user just the hotkey string but a rather user-friendly display (like checkboxes for the separate modifier keys and a drop down list of supported trigger keys), I need to fiddle on the saved string. I would envision a function that takes a hotkey string and returns for example an array like this: [isCtrl][isAlt][isShift][isWin][triggerKey][isTriggerVirtual]. And of course, there needs to be a function decoding the array back to the respective string representation. Thanks for your hints!
  14. I watch alot of anime and stuff and some sites don't have navigation to go to the next or previous episode or it's inconvenient. To resolve my delima, I created a script to change episodes at the press of a hotkey. It will work with any site that tracks the episode via url, in sequential order, and isn't also tracked by another identifier. Sites like Hulu and Crunchyroll won't work (tho their navigations is anything but inconvient). No this is for more obscure websites that have a simple url layout like www.example.com/video/bleach-024-engligh-dub. To start up it will give you instructions. Hover over the first digit of the episode in the url(in the above example, you would put your mouse over the 0) and press Ctrl+Insert to set the coordinates. From now on, when you press Ctrl+Left/Right, you will go forward or back an episode based on which button you pressed. It clicks the url, copies the ep number only, changes the ep number in variable, format it for leading 0 to match the source, and paste back in and submit, all in half a sec. It also attempts to exit full screen by pressing esc. Here is the source. You don't need to do anything special to compile it. All of my works are open source and licensed with GPLv3. Enjoy =D Global $x = "656";some default coordinates to load on start Global $y = "44" ;^ Opt("WinTitleMatchMode", -2);Case insensitive ANYWHERE match mode HotKeySet("^{ins}", "GetCoord") HotKeySet("^{left}", "SeekPrev") HotKeySet("^{right}", "SeekNext") MsgBox(0, "How To Use", "Move your mouse under the first digit in the url that keeps track of which episode you are on, then press Ctrl+Insert.") While 1;idle when not in use Sleep(1000) WEnd Func SeekPrev() Seek("Left") EndFunc ;==>SeekPrev Func SeekNext() Seek("Right") EndFunc ;==>SeekNext Func Seek($direction) ClipPut("");Erase contents of clipboard. Select ;First one that is true is the only one that gets used. If you have other browsers running, you may need to reorder this list. Case ProcessExists("iexplorer.exe") = True ;If iexplorer.exe is running then... $wintitle = "Internet Explorer";Use internet explorer. Case ProcessExists("MicrosoftEdge.exe") = True $wintitle = "Microsoft Edge" Case ProcessExists("opera.exe") = True $wintitle = "Opera" Case ProcessExists("firefox.exe") = True $wintitle = "Firefox" Case ProcessExists("chrome.exe") = True $wintitle = "Chrome" Case Else;Throws an error message incase you used a browser that is not set up. MsgBox(0, "Incompatible browser used.", "Unable to find a compatible browser to manipulate. Please use one of the follow browsers and try again: Chrome, Firefox, Opera, Microsoft Edge, Internet Explorer." & @CRLF & "You could also add an entry for your own browser. See Lines 24-33.") Exit EndSelect WinActivate($wintitle);Activate the window if it wasn't focused ControlSend($wintitle, "", "", "{esc}");Exit fullscreen (Note: ESC does not exit fullscreen on some sites) Sleep(50);give your browser some time to exit fullscreen. ControlClick($wintitle, "", "", "left", 2, $x, $y);Click where you set the coordinates. Do ControlSend($wintitle, "", "", "^c");Copy selected text to clipboard. $clipboard = ClipGet();Get the contents of the clipboard and store it in a string variable. Until StringLen($clipboard) > 0 ;Error Check Function, Make sure something was copied into the clipboard, else it waits until something is copied. It should be the value of the current ep you are on. $format = '%0' & StringLen($clipboard) & 'd'; Set the text format to be the same length as the original, padded with any 0's the original had. If $direction = "Left" Then ;If launched with Seek("Left") then decrease ep counter $clipboard = $clipboard - 1 Else;Else Increase it $clipboard = $clipboard + 1 EndIf $clipboard = StringFormat($format, $clipboard);format updated clipboard variable ClipPut($clipboard);write to clipboard the contents of $clipboard ControlSend($wintitle, "", "", "^v");paste clipboard, replacing the old ep in the url with tne new one. Sleep(50);Some browsers need to wait a moment after pasting, else it won't submit the correct request to the requested page. ControlSend($wintitle, "", "", "{enter}");Submit request to website. EndFunc ;==>Seek Func GetCoord();This function sets the coordinates to be used in Seek() Local $coord = MouseGetPos();Get mouse Coordinates $x = $coord[0];Rewrites previous global variable $y = $coord[1];Rewrites previous global variable MsgBox(0, "Coordinates Updated", "X = " & $x & "." & @CRLF & "y = " & $y & "." & @CRLF & @CRLF & "Press Ctrl+Left to Seek Back" & @CRLF & "Press Ctrl+Right to Seek Forward") EndFunc ;==>GetCoord
  15. I know there is a simple way to do this, but I can't remember and can't find the proper way.. I just need to set a hotkey that is only active while the GUI is up. When the GUI is minimized or no longer in focus, I need it to release the bound key. I have the enter key bound for barcode scanning and when the app is minimized, it holds on to the enter key. I know there is a simple way to fix this, but I don't recall how.. I cant post the app because its massive and wont start if you try to use it outside our environment. Here is my little test script.. Any ideas are greatly appreciated! #include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("Form1", 318, 118, 192, 124) GUISetState(@SW_SHOW) HotKeySet("{ENTER}", "HotKeyPressed") Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("12", $hDLL) Then _IsKeyPressed() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func HotKeyPressed() TrayTip("HotKey", "I see the Enter key using the HotKeySet function.", 10, 1) EndFunc ;==>HotKeyPressed Func _IsKeyPressed() TrayTip("_IsKeyPressed", "I see the Alt button using the _IsKeyPressed function.", 10, 1) EndFunc ;==>_IsKeyPressed
  16. Let start with some examples: 1. (As seen in another topic: '?do=embed' frameborder='0' data-embedContent>> ). Script copied from that topic Interrupt function can be any hotkey/event/adlib/callback. If-check inside interrupted function/script ; HotKeySet, or any function that can cause script interrupt HotKeySet("{Delete}", "RemoveSelectedControl") ;... Dim $InfoAboutControls[4096] Global $HandleForCurrentControl ;... While 1 $msg = GuiGetMsg() ;.... ;---Code to process moving a control (drag-n-drop)--- ; If check in MAIN LOOP (interruptible function). If $HandleForCurrentControl > 0 Then;Make sure we have a valid control handle ; ***** oops user pressed Delete key and we get pre-empted ; ***** user removed the selected control. ; ***** Returning from the RemoveSelectedControl function and resuming here: GuiCtrlSetPos($InfoAboutControls[$HandleForCurrentControl], $newLeftPosition, $newTopPosition) EndIf WEnd Func RemoveSelectedControl() $HandleForCurrentControl = -1 EndFunc 2. If-check inside interrupt function Hotkey only. Flag is set right after if check. It's possible or not this function print twice or more? HotKeySet("{Delete}", "_TestHotkey") Func _TestHotkey() Static $bFlag = True If ($bFlag) Then ; ***** Right here, user pressed Delete key ; ***** bFlag is currently not set ; ***** And the script will execute this function twice or more times, instead of just once $bFlag = False ConsoleWrite("This should be printed only ONCE") EndIf EndFunc 3. Same as 2, but with global flag The question is: can I rely on if-checking with a flag, to ensure that my script doesn't do any strange things, as describe in the above examples?
  17. Hello, I want to share with you all something that I have just found recently and now it becomes my everyday companion in working with my computer. First, some introductions about StrokesPlus. Basically, this lightweight, free and portable program is a mouse gesture and hotkey management, so it can provide users with their own ways to interact with any applications. StrokesPlus already has a built-in Lua scripting and able to call external .dll with that alone S+ has became the most flexible mouse gesture and hotkey management. However, Lua scripting is not as convenient as AutoIt that we love when dealing with complex functions. So combined with AutoIt, StrokesPlus becomes one of the best apps to increase our productivity. Example: Hold Right mouse button while scrolling up to increase volume. There is a program that I know that could do this, however with that program it means the gesture (Right mouse button + wheel) is already taken for volume only. With StrokesPlus users could determine the gesture for which window, controls, and even parts of the screen. For example, upper left part of the screen for volume, upper center for screen brightness, etc. Look at the pictures in below link to know what I mean: http://www.strokesplus.com/forum/topic/496/dyk-running-different-scripts-by-a-single-gesture I'm sure advanced users could find other creative ways to work with StrokesPlus. I think that's enough about the introductions. Now to have a communication between StrokesPlus and AutoIt, one way is by using sendMessage from StrokesPlus to AutoIt. It's very easy. First we determine a gesture to test, then set it for global, or app specific, or window title or win class specific. Then in the Lua script: acSendMessage(acFindWindowByTitleRegex("GetTheGesture"), 273, 1, 1)GetTheGesture = title of our AutoIt window that will received the message from StrokesPlus 273 = WM_COMMAND 1 = wParam 1 = the lParam Then in the AutoIt script: GUICreate("GetTheGesture") Global Const $WM_COMMAND = 0x0111 GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 Sleep(100) WEnd Func MY_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $Param1 = Dec(StringTrimLeft ($wParam, 2 ));LoWord Local $Param2 = Dec(StringTrimLeft ($lParam, 2 )) ConsoleWrite(" "&$Param1&"_"&$Param2&" ") End Func Now, each time we fire the gesture that we set to do sendMessage, the AutoIt script could receive it and start doing the works. To make it more flexible, we could make the AutoIt script to get the window's control of where we do the gesture, instead sending the number for the app, send gsx, gsy from StrokesPlus. gsx, gsy represent the initial mouse position when we started the gesture. It depends of the users how they want to use it. This is one way that I know how to make connection, I believe there are other ways. I can't believe I just recently know about this wonderful program. So, that's why I want to give you all some introductions. I'm sure many have heard about StrokeIt, however there has been no further release after 2010. While StrokesPlus is continously being developed. So, if anyone has any ideas or suggestions related, feel free to contact the author. The author would be very happy to hear it from you as he wants to create the most flexible but robust mouse gesture and hotkey management app. Thank you for reading.
  18. Runner is general purpose event trigger system structured for expandability - Triggers - (Almost) any keyboard or mouse button combinations pressed from (almost) anywhere during a Windows session- The current system time can trigger a event (see limitations)- Macros can sample variables from Windows, or file system then react to comparison. So if a macro is running, it can also be an event trigger.- Events- Run/open a file path or command line drag and drop (browse on 64bit operating systems) music/picture/any folders, or programs [*]- Launch a url in default browser[*]- The basic media functions can be assigned as hotkey functions media back, forwardplay, pause, stopsystem volume -, +Runner can be set to play music files internally meaning no external app will be launched and interrupt your computer experienceinternally playing music:controlled by play, pause, and stop Runner media optionsplaylists are not yet built into the internal Runner media playerthere is no gui for the player [*]- Computer voice output custom data with fully customizable voice narratorspeak the time of day [*]- Start your custom macros- Macros, a list of (almost) unlimited commands create your custom macros with 39 command types (expandable)commands are configurable with variable and constant data programmable by the userCommand types include: sending keystrokes to focused application, or window title control_idmove/click the mouse, or window title control_idrun file paths or command line stringssave specified screen area to incrementing filecall other saved macrostarget, move, set window mode, of window titlesacquire variables, return values to udv (User Defined Variable) return mouse_x and yreturn pixel colors, int, hex, r, g, breturn a window title’s position (x, y)return contents of clipboardreturn a specified file line or whole filevariables can be used in almost any logical macro commandI could be here for the next week. I’m pretty sure this is useful, and easy enough for anyone to use. Runner is looking for users. I will always offer free keys to forum members joining before 2012. Tell me the user_number songersoft has assigned you and I will send back a key code that will enable Runner forever. (use the forum mail) If Runner doesn't detect a valid license key (at startup). It requests you to submit some hardware information to songersoft.com. This information is required to log your 30 trail and provide you with a unique key. songersoft.com does not collect any personal information about you or what you do with the software. Basically this is all traceable back to me, I have Songersoft LLC and website. My goal was to write useful software that the world could use. In order to put time into it, I need a return profit. That means I need to maintain a reputable reputation as a trustworthy software provider and not goto jail for doing shady things. All clear? If you have a license key. Runner operates without an internet connection. I am a programmer and I like this forum very much. If you're in bad standing with this forum or compromise my member status I cannot help you. If you are thinking about making a post read the forum rules, if your post violates the rules you will not get help from me if you post it. More about Runner on the download page: http://www.songersoft.com/runner/runner_about/runner_about.html ‘toggel audio device win_XP', macro create and edit example preview (video coming soon) This post has been modified for completeness
  19. I've been trying to add a hotkey to a script but I only started out earlier today and I am already struggling with the basics (not a big surprise for starting new) anyway I was hoping someone could give me an example on how to make a simple On/Off Hotkey #include <Misc.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d $dll = DllOpen("user32.dll") Dim $coord[3] Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause While 1 If _IsPressed("1[", $dll) Then ExitLoop For $i = 0 To 1024 Step 1 $coord = PixelSearch( 0, 0, $i, 768, 0xFF0000, 10 ) If Not @error Then MouseMove($coord[0],$coord[1]) EndIf If _IsPressed("1[", $dll) Then ExitLoop Next WEnd
  20. I defined several hotkeys sh+F1 - sh+F9 and Ctrl+F1 but there is a problem with it. About 4 out of 10 times the Shift or Ctrl seems to stay pressed after executing the hotkey. This is not a HW problem since its on more then 5 keyboard. After i press shift or Ctrl again the key stays so to say up. Who cab help me with this? In the example $F9 is Exit. The hotkeys are programmed to function in Putty Hotkey: HotKeySet("+{F9}", "_F9") Fuction: Func _F9() $state = WinGetState("[CLASS:PuTTY]", "") If BitAnd($state, 8) Then Send($F9 & "{ENTER}") EndIf EndFunc
  21. Hey everyone, I am making a program which acts like a clipboard, but it also does a number of alterations to the data, like removing certain elements from HTML that has been copied. One problem I have come up against, is that I cannot send the keystroke CTRL+V when hotkeyset is specifying that that hotkey points to the paste function. The only way I have found around this (Other than using another hotkey for pasting, Ctrl+Shift+V which pastes straight from the windows clipboard anyway), is to input the data with the send command. The problem with this however, is that as I am sending thousands of letters at a time, it is taking forever to type it all out. Does anybody know a way around this? I am aware that there is a Hotkey UDF. Does anybody know if this addresses this problem? Thanks.
  • Create New...