Hello, im new !here!
I need the pointer to be automatic moved to the window designed by the shortcript -
F1:: WinActivate, drw --> this must get the cursor wherever it is and point/select this window.
Pretty easy huh? Nocando.:/
Thanx in advance!
[Mod action: Moved topic to the v1 section since the short script shown is v1 code. The main section is for v2.]
Help With script. Topic is solved
Re: Help With script.
Welcome to this AutoHotkey forum!
If you are new to AHK, I recommend using its current version, which is v2, instead of this older deprecated version that is no longer developed.
Code: Select all
#Requires AutoHotkey v1.1.33.11
winTitle := "ahk_exe Notepad.exe"
#If WinExist(winTitle)
F1::
CoordMode Mouse
WinActivate
WinGetPos x, y
MouseMove x, y
Return
#If
Re: Help With script. Topic is solved
Or don’t change the CoordMode and just move to 0,0.
Re: Help With script.
Nice one!
Code: Select all
; Per boiler
#Requires AutoHotkey v1.1.33.11
winTitle := "ahk_exe Notepad.exe"
#If WinExist(winTitle)
F1::
WinActivate
MouseMove 0, 0
Return
#If
Re: Help With script.
Just to rechapter... thats my script for selecting characters for a game, btw... i need it to be set automatically to the window on press, and click on it ( or pass the coordinates to click) but the windows are never the same size... thats the problem... would be nice if i coulf make all the other windows, with the exception of F1 Key, to select the window, and the press a button automatically, like the ` button, for example.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Code: Select all
F1:: WinActivate, Character1
F2:: WinActivate, Character2
F3:: WinActivate, Character3
F4:: WinActivate, Character4
F5:: WinActivate, Character5
F6:: WinActivate, Character6
F7:: WinActivate, Character7
F8:: WinActivate, Character8
DetectHiddenWindows, On
Script_Hwnd := WinExist("ahk_class AutoHotkey ahk_pid " DllCall("GetCurrentProcessId"))
DetectHiddenWindows, Off
DllCall("RegisterShellHookWindow", "uint", Script_Hwnd)
OnMessage(DllCall("RegisterWindowMessage", "str", "SHELLHOOK"), "ShellEvent")
ShellEvent(wParam, lParam) {
if (wParam = 0x8006) HSHELL_FLASH
{
WinGet,descobre,ProcessName, ahk_id %lParam%
if(descobre = "DofusMod.exe")
WinActivate, ahk_id %lParam%
}
}
Re: Help With script.
Hmm. I have no idea what any of that means. What the script does:
Enjoy!
Just a tip for your latest script: unlabeled code following Return is unreachable and will never execute.I need the pointer to be automatic moved to the window designed by the shortcript -
F1:: WinActivate, drw
Enjoy!
Re: Help With script.
Basic it select the current character window by pressing the shortcut. Nevertless, still need to do what i said, the script must press a character, can be any letter on keyboard. So it will select the current character windows and pass its turn on game - as you can see, all the F1,F2.... etc. will select the window on the respective character, but i need it plus select window, it must press a keyboard button, just do pass the turn on the game.
Re: Help With script.
Still not sure what you’re looking for, but maybe this is close.
Code: Select all
#Requires AutoHotkey v1.1.33.11
F1::
F2:
F3::
F4::
F5::
F6::
F7::
F8::
WinActivate, % "Character " RegExReplace("A_ThisHotkey", "\D")
MouseMove, 0, 0
Send, ``
return
Re: Help With script.
@boiler & @mikeyww
Thanks for trying, its not what i need.
Let me try to explain, the code below, get the window name (character name ex. Willhood) and select the window, pop-in it up. Thats preety much it, just show, in the screen the window of the respective player, ok?
All I need is the code to plus select the window (done by the under function already), to press a letter on keyboard, like "~" or "`", so the player passa its turn on the game. Thats all!
@mikeyww
@boiler
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Thanks for trying, its not what i need.
Let me try to explain, the code below, get the window name (character name ex. Willhood) and select the window, pop-in it up. Thats preety much it, just show, in the screen the window of the respective player, ok?
All I need is the code to plus select the window (done by the under function already), to press a letter on keyboard, like "~" or "`", so the player passa its turn on the game. Thats all!
Code: Select all
F1:: WinActivate, Player1
F2:: WinActivate, Player2
DetectHiddenWindows, On
Script_Hwnd := WinExist("ahk_class AutoHotkey ahk_pid " DllCall("GetCurrentProcessId"))
DetectHiddenWindows, Off
DllCall("RegisterShellHookWindow", "uint", Script_Hwnd)
OnMessage(DllCall("RegisterWindowMessage", "str", "SHELLHOOK"), "ShellEvent")
ShellEvent(wParam, lParam) {
if (wParam = 0x8006) HSHELL_FLASH
{
WinGet,descobre,ProcessName, ahk_id %lParam%
if(descobre = "DofusMod.exe")
WinActivate, ahk_id %lParam%
}
}
@boiler
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Re: Help With script.
The closest I can come to figuring out what you want is to have a separate hotkey for activating each character’s window. Are you wanting the script to automatically identify the various character windows and create a set of hotkesy for activating each of them?
I don’t know why you keep showing that code. The lines below the hotkeys would never execute. You may think that code is doing something to help the hotkeys activate the windows or identify the various windows, but the way you have shown it, it does nothing. What is that part of the code supposed to do? Where did you get it? It looks like if it were to execute, it would activate each of the program’s windows as soon as they’re created. I don’t know what that has to do with the hotkeys and why that would be needed.
I don’t know why you keep showing that code. The lines below the hotkeys would never execute. You may think that code is doing something to help the hotkeys activate the windows or identify the various windows, but the way you have shown it, it does nothing. What is that part of the code supposed to do? Where did you get it? It looks like if it were to execute, it would activate each of the program’s windows as soon as they’re created. I don’t know what that has to do with the hotkeys and why that would be needed.
Re: Help With script.
--> Thats pretty much it. Well.. as you can see, F1 pop up the window of character1, F2 pop up the windows of character2 .. and so on... i just want that after i press the F1, F2 or FX button the script press a hotkey on keyboard, like ~ or ` (because its near F1, F2), quick to press. But with the ressalve, that one F1 must not pass the turn (must note have the hotkey associated to pass the turn on the game, just select the window, i will manually press to pass this character turn, because he will fight the monsters and kill all of then, if he cant kill and there are monsters left on the game, the other players will pass the turn automatically and will return to him (F1 - player 1).boiler wrote: ↑06 May 2024, 22:42The closest I can come to figuring out what you want is to have a separate hotkey for activating each character’s window. Are you wanting the script to automatically identify the various character windows and create a set of hotkesy for activating each of them?
I don’t know why you keep showing that code. The lines below the hotkeys would never execute. You may think that code is doing something to help the hotkeys activate the windows or identify the various windows, but the way you have shown it, it does nothing. What is that part of the code supposed to do? Where did you get it? It looks like if it were to execute, it would activate each of the program’s windows as soon as they’re created. I don’t know what that has to do with the hotkeys and why that would be needed.
Re: Help With script.
You say this as if we know what key is used to “pass the turn” or anything else. We don’t play the game. You choose what keys to send. If you want to send a keypress along with activating the window, then each hotkey just becomes a variant of these:drwill wrote: ↑ and so on... i just want that after i press the F1, F2 or FX button the script press a hotkey on keyboard, like ~ or ` (because its near F1, F2), quick to press. But with the ressalve, that one F1 must not pass the turn (must note have the hotkey associated to pass the turn on the game, just select the window,
Code: Select all
F1::
WinActivate, Character 1 ahk_exe mygame.exe
Send, `` ; this requires two ` to escape the special character
return
F2::
WinActivate, Character 2 ahk_exe mygame.exe
Send, 2
return
Just replace mygame.exe with the actual process name for your game and Character 1 and Character 2 with the actual tiles of those windows. And I don’t know how to choose what keys to send with each. You would just choose those. How you send certain keys might require certain things to be done like ` above, or like sending the Tab key would be Send, {Tab}, as described in the Send documentation.
Don’t put any of that other code you had at the bottom of the scripts you posted.
Re: Help With script.
Sorry im not an expert.
>"C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe" /ErrorStdOut "D:\Will\Lohar-2024 - Copia.ahk"
D:\Will\Lohar-2024 - Copia.ahk (2) : ==> Function calls require a space or "(". Use comma only between parameters.
Specifically: WinActivate, Willhood ahk_exe DofusMod.exe
>Exit code: 2 Time: 0.08647
Didnt work.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Code: Select all
F1::
WinActivate, Willhood ahk_exe DofusMod.exe
return
F2::
WinActivate, Will-shot ahk_exe DofusMod.exe
Send, ``
return
D:\Will\Lohar-2024 - Copia.ahk (2) : ==> Function calls require a space or "(". Use comma only between parameters.
Specifically: WinActivate, Willhood ahk_exe DofusMod.exe
>Exit code: 2 Time: 0.08647
Didnt work.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
Re: Help With script.
You are obviously trying to run AHK v1 code with AHK v2. Either use v1 or change the syntax to v2.
btw, please use code tags when posting code:
btw, please use code tags when posting code:
Re: Help With script.
Since you always posted v1 code in your posts above, I would expect that you have AHK v1 already installed (apparently along with AHK v2, which is fine) and used it before.
The shown error message seems to indicate that now you tried to run the script from an editor like eg SciTE4AHK; so make sure to select AHK v1 to run the script (in SciTE, there is a version selector button, if I remember correctly).
Trying to run it outside of an editor, the v2 launcher would probably suggest to install v1, if not already available. Adding #Requires AutoHotkey v1.1 should avoid any ambiguity for the AHK launcher, if there should be any.
Regarding the usage of code tags, I have posted an image. Code tags will add one of those fancy and helpful codeboxes everyone else uses (so far, we have edited all your posts containing code (see above) and added them for you). If you have specific questions about steps 1 or 2 shown in the image (or additional ones), please feel free to ask.
The shown error message seems to indicate that now you tried to run the script from an editor like eg SciTE4AHK; so make sure to select AHK v1 to run the script (in SciTE, there is a version selector button, if I remember correctly).
Trying to run it outside of an editor, the v2 launcher would probably suggest to install v1, if not already available. Adding #Requires AutoHotkey v1.1 should avoid any ambiguity for the AHK launcher, if there should be any.
Regarding the usage of code tags, I have posted an image. Code tags will add one of those fancy and helpful codeboxes everyone else uses (so far, we have edited all your posts containing code (see above) and added them for you). If you have specific questions about steps 1 or 2 shown in the image (or additional ones), please feel free to ask.
Re: Help With script.
@gregster
@boiler
@mikeyww
Hi guys, the code our friend boiler posted didnt work out for me, the F1 funtion its ok! But the F2 neither call the window of the program, like F1 does. And it should press the ` button too...
@boiler
@mikeyww
Hi guys, the code our friend boiler posted didnt work out for me, the F1 funtion its ok! But the F2 neither call the window of the program, like F1 does. And it should press the ` button too...
Code: Select all
F1::
WinActivate, Willhood ahk_exe DofusMod.exe
return
F2::
WinActivate, Will-shot ahk_exe DofusMod.exe
Send, ``
return
Re: Help With script.
Are you sure the title of that window is exactly Will-shot with that exact capitalization and a regular hyphen in it? I would also put only one space after the comma and before that title. It's also possible there are hidden characters in the title. It's best to copy the title directly from Window Spy.
Re: Help With script.
@boiler
Im so sorry, thats the character name!! Will from Willian (my name), shoot from archer... name.
Im so sorry, thats the character name!! Will from Willian (my name), shoot from archer... name.
Who is online
Users browsing this forum: No registered users and 46 guests