Aceguy Posted January 18, 2008 Share Posted January 18, 2008 Do sleep(100) until 1=0 for $c=1 to 9 hotkeyset($c,"need_to_call_different_func_for_$c") Next Func need_to_call_different_func_for_$c() MsgBox(0,"","Please help",0) EndFunc so for expample if i press 1 mshgbox says i pressed 1 ect... i would like to try and avoid.... hotkeyset(1,"") hotkeyset(2,"") hotkeyset(3,"") ect. [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 Look at the @HotkeyPressed Macro, it returns the key pressed. Link to comment Share on other sites More sharing options...
Aceguy Posted January 18, 2008 Author Share Posted January 18, 2008 AHHH, dont know how to use it. sorry [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Aceguy Posted January 18, 2008 Author Share Posted January 18, 2008 OK. done it TY. for $c=1 to 5 hotkeyset($c,"hot") Next Do sleep(100) until 1=0 Func hot() MsgBox(0,"",@HotKeyPressed,0) EndFunc Is this right. but 1 more thing..... i doesnt register the key on my application/game ARRRRGGGGHHHHH [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 (edited) Yes, that's correct, you could use it like this: Func hot() Switch @HotkeyPressed Case "1" ; do something Case "2" ; do something Case "3" ;and so on EndSwitch EndFuncoÝ÷ Øy¦Ê¬k+ajØv¬mè"²×«a{,(®J.¶ÈzØ^©nëg¢Ø§¶ jgv+X¢çÚ"ø§×¥¢l)¶¬{-y§H¶§+e¢,æz¶®¶sevÆR 6ÆVW¥tVæ Edited January 18, 2008 by FreeFry Link to comment Share on other sites More sharing options...
Aceguy Posted January 18, 2008 Author Share Posted January 18, 2008 thanks for swift reply yes, it works fine outside the game. [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 (edited) Ok, then it might be the game that blocks the hotkeys, or removes them. Alternatively, you could try setting the hotkeys AFTER the game window is activated and see if they work. Edit: Something like this: Dim $Set = False Dim $WindowTitle = "Game title here" While 1 If WinActive($WindowTitle) And Not $Set Then _SetHotKeys(1) $Set = True ElseIf Not WinActive($WindowTitle) And $Set Then _SetHotKeys(0) $Set = False EndIf Sleep(100) WEnd Func hot() Switch @HotkeyPressed Case "1" MsgBox(0, "", @HotKeyPressed) Case "2" MsgBox(0, "", @HotKeyPressed) Case "3" MsgBox(0, "", @HotKeyPressed) EndSwitch EndFunc Func _SetHotKeys($State) If $State Then For $i = 1 To 5 HotKeySet($i, "hot") Next Else For $i = 1 To 5 HotKeySet($i) Next EndIf EndFunc Edited January 18, 2008 by FreeFry Link to comment Share on other sites More sharing options...
Aceguy Posted January 18, 2008 Author Share Posted January 18, 2008 (edited) thanks. i will try that. Edit - no joy, damn, there goes my idea. taken me 3years to get my wife to play this game, all i wanted is a prog to detect when she used a game macro, CTRL+1 for eg. and to notify her when she can use it again. yes the game has macros but cancel each other out when a new macro is pressed.... was just a aid for her. NVM. thanks to all that replyed. Edited January 18, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 Edited post above, have a look. Link to comment Share on other sites More sharing options...
Aceguy Posted January 18, 2008 Author Share Posted January 18, 2008 NO JOY [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 18, 2008 Share Posted January 18, 2008 (edited) Hmm, I'm sad to hear that. :/There might be other ways to be able to sense when a key is pressed though...The_IsPressed() function perhaps works... But that has to be called quite repeatedly, and quickly to detect key presses..Edit:To use that function you'll probably have use of this webpage: http://msdn2.microsoft.com/en-us/library/m...540(VS.85).aspx it shows the key codes for the keys you can check.Here's how you could use it:#Include <Misc.au3> Dim $WindowTitle = "Game title here" Dim $aKeys[5] = [31, 32, 33, 34, 35] ; 1,2,3,4 & 5 Dim $iDllHandle = DllOpen("user32.dll") While 1 If WinActive($WindowTitle) Then _CheckKeys() EndIf Sleep(10) WEnd Func _HandleKey($iKey) Switch $iKey Case 31 ; 11 ; Key 1 code here.. Case 32 ; 2 ; Key 2 code here.. Case 33 ; 3 ; and so on... EndSwitch Sleep(250) EndFunc ;==>_HandleKey Func _CheckKeys() For $element In $aKeys If _IsPressed($element, $iDllHandle) Then _HandleKey($element) EndIf Next EndFunc ;==>_CheckKeysSorry for the slow response, been away from the computer. :/ Edited January 18, 2008 by FreeFry Link to comment Share on other sites More sharing options...
Aceguy Posted January 19, 2008 Author Share Posted January 19, 2008 (edited) thanks FreeFry. I really Appreciate you taking the time helping me. Edited January 19, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 20, 2008 Share Posted January 20, 2008 No problem. Did that last method work? Other than that I only know one more method to detect key strokes... Link to comment Share on other sites More sharing options...
Aceguy Posted January 20, 2008 Author Share Posted January 20, 2008 YAY, YES IT DID.... TY. Will post full script when done. [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 20, 2008 Share Posted January 20, 2008 Hurray! Link to comment Share on other sites More sharing options...
martin Posted January 20, 2008 Share Posted January 20, 2008 Hurray! if you set a hotkey then when your script detects it the key ii is not available to another process. So if you want to detect it and let the other process see it you need something like this. Hot() if @HotKey = "{F1}" then;maybe add 'And winactive($someTitle)' HotKeySet("{F1}") send("{F1}") ;do something maybe HotKeySet("{F1}", "Hot") endif endfunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
FreeFry Posted January 20, 2008 Share Posted January 20, 2008 The one method that works doesn't use HotKey's, it just checks if the key is down or not, and only does so if the game window is active.. Link to comment Share on other sites More sharing options...
martin Posted January 20, 2008 Share Posted January 20, 2008 The one method that works doesn't use HotKey's, it just checks if the key is down or not, and only does so if the game window is active..Yes, I saw the _IsPressed version, but I just thought I'd add a note about why the HotKey versions weren't working. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Aceguy Posted January 20, 2008 Author Share Posted January 20, 2008 (edited) thanks to all here especially firefly. Here is a 75% complete but working version. bah uppload failed, will try later Edited January 20, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
FreeFry Posted January 21, 2008 Share Posted January 21, 2008 (edited) Yes, I saw the _IsPressed version, but I just thought I'd add a note about why the HotKey versions weren't working.Well the issue is not that his game can't see that the keys are pressed, it's that his own program doesn't detect the keypresses(the hotkey's aren't triggered) when his application has focused.Edit:Aceguy, you can just attach the code here inside code tags if you want. Unless it has some pictures or something. Edited January 21, 2008 by FreeFry 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