Pls. check my last post under:
http://www.autohotke...5305.html#85305
(for some reason my post didn't bubble to the top of the post stack, maybe there is a bug when multiple pages under the post exist)
TO: not-logged-in-daonlyfreez :) Quick question
Started by
Andrews
, Oct 22 2006 11:05 PM
8 replies to this topic
#1
-
Posted 22 October 2006 - 11:05 PM
Or can someone please see how this can work (to answer my question at the bottom of the other link) Best regards
#2
-
Posted 23 October 2006 - 06:49 AM
Or can someone please see how this can work (to answer my question at the bottom of the other link)
Find the following part on that script:
Gui, 2: +LastFound DllCall("SetParent", "uint", WinExist(), "uint", mainGuiHandle)
Insert a line in between, like
Gui, 2: +LastFound [color=green]GUI2_ID := WinExist()[/color] DllCall("SetParent", "uint", WinExist(), "uint", mainGuiHandle)
Now to ControlSend characters you may do it like:
ControlSend,, {TAB}, ahk_id %GUI2_ID%
Hope I was clear...
#3
-
Posted 23 October 2006 - 07:02 AM
Very clear and perfect Thank you! I had one related question I hope to work off of. What is the technique for determining which GUI is 'clicked on' or active at any given moment? What I hope to do is set some var x to 0 or 1 depending if GUI 1 is clicked, or GUI 2 is clicked, and use that VAR elsewhere in a IF then type routine. Hopefully my explanation and wish is understandable. Thank you for helping me.
#4
-
Posted 24 October 2006 - 02:03 AM
What is the technique for determining which GUI is 'clicked on' or active at any given moment? What I hope to do is set some var x to 0 or 1 depending if GUI 1 is clicked, or GUI 2 is clicked, and use that VAR elsewhere in a IF then type routine.
I find the question a bit tricky! When you click a regular control ( like a button/text/picture etc ) AutoHotkey's built-in variable A_Gui will contain the GUI number!
But you cannot determine which GUI ( or none of them ) is active without clicking a control. A_GUI will be null then. I know of a way to automatically set a variable with the GUI number, which I have preserved for my TipsNTricks and I doubt whether anyone would really need it!
Please clarify your actual requirement!
#5
-
Posted 24 October 2006 - 08:32 AM
Let's say you have
gui, 1:
....
gui, 2:
....
gui, 3:
....
In my scenario, if someone clicks on a GUI control , and then issues a hotkey command, like:
Esc::
If GUI1 = clicked
{
do something
}
If GUI2 = clicked
{
do something
}
If GUI3 = clicked
{
do something
}
Return
It would work in the above sort-of-theory, or something like it to achieve the effect :?:
gui, 1:
....
gui, 2:
....
gui, 3:
....
In my scenario, if someone clicks on a GUI control , and then issues a hotkey command, like:
Esc::
If GUI1 = clicked
{
do something
}
If GUI2 = clicked
{
do something
}
If GUI3 = clicked
{
do something
}
Return
It would work in the above sort-of-theory, or something like it to achieve the effect :?:
#6
-
Posted 24 October 2006 - 03:06 PM
GUI, 1:Show, x10 y10 w300 h300, GUI #1 GUI, 2:Show, x320 y10 w300 h300, GUI #2 GUI, 3:Show, x630 y10 w300 h300, GUI #3 GUI# := 3 OnMessage(0x06, "WM_ACTIVATE") Return ^F2::MsgBox, 64, Active GUI, Active GUI: %GUI#% WM_ACTIVATE(wParam) { Global GUI# GUI# := A_GUI IfWinNotActive, % "ahk_pid " DllCall("GetCurrentProcessId") GUI# := 0 GoSub, Routine Return } Routine: /* Your if statements go here If (Gui# = 1) ......... If (Gui# = 2) ......... If (Gui# = 3) ......... */ Return GuiClose: 2GuiClose: 3GuiClose: ExitApp Return
Active-GUI status will be always available in variable named GUI# which you can view by pressing ^F2
As said earlier, I had saved this for my TipsNTricks, but decided to post it here!
Regards,
#7
-
Posted 24 October 2006 - 03:13 PM