On XP everything works fine for me. What are your system?I'm trying to use HotKey.au3 to use Win-L to lock the computer and run the screen saver based on a post from Lej.
After pressing Win-L the computer locks and the screen saver runs. The problem is after I unlock the computer the keyboard locks up until I hit a modifier key (shift, ctrl, alt, or win).
Try this to recreate:
- Have Notepad open when running the script
- Run the script
- Press Win-L
- Unlock the computer
- Try typing in Notepad
- Typing "l" the first time will allow all the alphanumeric keys to work. Typing "l' the second time will lock the computer without pressing the Win key.
#include "HotKey.au3" #include "vkConstants.au3" HotKeySet("{Esc}", "_Quit") _HotKeyAssign(BitOr($CK_WIN, $VK_L), "ScreenSaver") While 1 Sleep(10) WEnd Func ScreenSaver() Local Const $SC_SCREENSAVE = 0xF140 DllCall('user32.dll', 'int', 'LockWorkStation') _SendMessage(_WinAPI_GetDesktopWindow(), $WM_SYSCOMMAND, $SC_SCREENSAVE, 0) EndFunc ;==>ScreenSaver Func _Quit() Exit EndFunc ;==>_Quit
The problem isn't specific to Win-L. The same thing happens when I change the script to use Win-K (hitting "k" the second time will lock the computer)
Any ideas on what I'm doing wrong?
--Jeff
HotKey UDF
#41
Posted 17 August 2009 - 03:54 PM
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

#42
Posted 17 August 2009 - 04:49 PM
I just tried running the same script in a Virtual PC running a clean build of XP Profession with Service Pack 2 and had the same problem. Same problem after compiling with 3.3.1.1 and even after rebooting.
No I'm really confused. Is anyone else able to duplicate the problem?
--Jeff
#43
Posted 17 August 2009 - 05:07 PM
Yes, I caught this bug. I think that is to blame Lock Workstation. Apparently stops working hook or something like that. I would think.I'm using AutoIt 3.3.0.0 (the latest non-beta version) and XP Professional with Service Pack 3.
I just tried running the same script in a Virtual PC running a clean build of XP Profession with Service Pack 2 and had the same problem. Same problem after compiling with 3.3.1.1 and even after rebooting.
No I'm really confused. Is anyone else able to duplicate the problem?
--Jeff
EDIT:
When I wrote this UDF, I not thought that it could be used for this purpose.
Edited by Yashied, 17 August 2009 - 05:13 PM.
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

#44
Posted 17 August 2009 - 07:39 PM
#Include 'HotKey.au3' #Include 'vkConstants.au3' HotKeySet('{Esc}', '_Quit') _HotKeyAssign(BitOR($CK_WIN, $VK_L), 'ScreenSaver') While 1 Sleep(10) WEnd Func ScreenSaver() Local Const $SC_SCREENSAVE = 0xF140 Local $Timer = TimerInit() DllCall('user32.dll', 'int', 'LockWorkStation') Do Sleep(10) If TimerDiff($Timer) > 1000 Then Return EndIf Until _IsWorkstationLocked() _SendMessage(_WinAPI_GetDesktopWindow(), $WM_SYSCOMMAND, $SC_SCREENSAVE, 0) While _IsWorkstationLocked() Sleep(10) WEnd DllCall('user32.dll', 'int', 'keybd_event', 'int', $VK_L, 'int', 0, 'int', 2, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', $VK_LWIN, 'int', 0, 'int', 2, 'ptr', 0) DllCall('user32.dll', 'int', 'keybd_event', 'int', $VK_RWIN, 'int', 0, 'int', 2, 'ptr', 0) EndFunc ;==>ScreenSaver Func _IsWorkstationLocked() Local Const $DESKTOP_SWITCHDESKTOP = 0x0100 Local $Result = False $hDesktop = DllCall('user32.dll', 'hwnd', 'OpenDesktop', 'str', 'Default', 'int', 0, 'int', 0, 'int', $DESKTOP_SWITCHDESKTOP) If Not @error Then $Result = DllCall('user32.dll', 'int', 'SwitchDesktop', 'hwnd', $hDesktop[0]) $Result = Not $Result[0] DllCall('user32.dll', 'int', 'CloseDesktop', 'hwnd', $hDesktop[0]) EndIf Return $Result EndFunc ;==>_IsWorkstationLocked Func _Quit() Exit EndFunc ;==>_Quit
EDIT:
This, incidentally, solves the Lej problem.
Edited by Yashied, 17 August 2009 - 08:02 PM.
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

#45
Posted 17 August 2009 - 10:07 PM
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

#46
Posted 17 August 2009 - 11:18 PM
--Jeff
#47
Posted 18 August 2009 - 04:52 AM
#48
Posted 18 August 2009 - 05:35 AM
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

#49
Posted 18 August 2009 - 06:18 AM
It Is : RIGHT ARROW key (VK_RIGHT (0x27))What is "RIGHT"?
However, my problem is with "Alt" key using
Edited by grega, 18 August 2009 - 06:26 AM.
#50
Posted 18 August 2009 - 06:30 AM
OS: Windows 7 - 64bit - Ultimate, AutoIt Version: 3.3.8.1, AutoIt Editor: SciTE, Website: http://www.funk.eu, My unsolved Questions: Get default Window Size and Position,
#51
Posted 18 August 2009 - 07:03 AM
I know thisAccording to UDF help-file for _ispressed() ALT = 12 => $VK_MENU = 0x12. msdn says "VK_MENU (0x12) (ALT key)".
Bat : _HotKeyAssign(BitOR($VK_MENU, $VK_RIGHT), 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) does not want to work
_HotKeyAssign(BitOR($СK_MENU, $VK_RIGHT), 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) too.
Can you give example for the use of Buttons' Alt ', together with any button ?
#52
Posted 18 August 2009 - 07:52 AM
_HotKeyAssign(0x12+0x27, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL))
OS: Windows 7 - 64bit - Ultimate, AutoIt Version: 3.3.8.1, AutoIt Editor: SciTE, Website: http://www.funk.eu, My unsolved Questions: Get default Window Size and Position,
#53
Posted 18 August 2009 - 08:00 AM
Still not workingMaybe something like this?
_HotKeyAssign(0x12+0x27, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL))
#54
Posted 18 August 2009 - 08:05 AM
_HotKeyAssign(BitOR(0x27, $CK_ALT),'message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL))
OS: Windows 7 - 64bit - Ultimate, AutoIt Version: 3.3.8.1, AutoIt Editor: SciTE, Website: http://www.funk.eu, My unsolved Questions: Get default Window Size and Position,
#55
Posted 18 August 2009 - 08:18 AM
HotKeys 'Ctrl' and 'Shift' working only with : $CK_CONTROL and $CK_SHIFT (bat no working with $VK_CONTROL and $VK_SHIFT )
#56
Posted 18 August 2009 - 08:18 AM
Still not workingMaybe something like this?
_HotKeyAssign(0x12+0x27, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL))
By the way :
HotKeys 'Ctrl' and 'Shift' working only with : $CK_CONTROL and $CK_SHIFT (bat no working with $VK_CONTROL and $VK_SHIFT )
#57
Posted 18 August 2009 - 08:34 AM
I suggest you read VERY CAREFULLY the documentation for _HotKeyAssign() within a UDF.Still not working
By the way :
HotKeys 'Ctrl' and 'Shift' working only with : $CK_CONTROL and $CK_SHIFT (bat no working with $VK_CONTROL and $VK_SHIFT )
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

#59
Posted 11 September 2009 - 10:07 AM
And here's how I do it now.
It works but i want to know is there a better way to do this?
$iFlag = BitOR($iFlag, $HK_FLAG_EXTENDEDCALL) Assign("HotkeyFunc" & $iKey, $sFunc, 2) _HotKeyAssign($iKey, "HotkeyDouble", $iFlag) Func HotkeyDouble($iKey) if $iPriorKey = $iKey and TimerDiff($iPriorKeyTime) < 250 then Call(Eval("HotkeyFunc" & $iKey)) $iPriorKey = $iKey $iPriorKeyTime = TimerInit() EndFunc
#60
Posted 11 September 2009 - 05:32 PM
I would have done the following:Hi, I want to create a double click hotkey with your hotkeyset
And here's how I do it now.
It works but i want to know is there a better way to do this?
$iFlag = BitOR($iFlag, $HK_FLAG_EXTENDEDCALL) Assign("HotkeyFunc" & $iKey, $sFunc, 2) _HotKeyAssign($iKey, "HotkeyDouble", $iFlag) Func HotkeyDouble($iKey) if $iPriorKey = $iKey and TimerDiff($iPriorKeyTime) < 250 then Call(Eval("HotkeyFunc" & $iKey)) $iPriorKey = $iKey $iPriorKeyTime = TimerInit() EndFunc
#Include <HotKey_17_beta.au3> Global Const $VK_F12 = 0x7B Global $Timer = 0 _HotKeyAssign($VK_F12, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL, $HK_FLAG_POSTCALL)) While 1 Sleep(10) WEnd Func Message($iKey) If $iKey > 0 Then If ($Timer) And (TimerDiff($Timer) < 250) Then MsgBox(0, 'Hotkey Test Message', 'Hotkey has been pressed!') $Timer = 0 Return EndIf $Timer = TimerInit() EndIf EndFunc ;==>Message
HotKey_17_beta.au3 you can download here.
iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper
Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | IconChooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | AITray UDF Library

0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




