Sign in to follow this  
Followers 0
AcidAlchamy

Focus Screen from CheckBox

5 posts in this topic

Thanks to Zedna I figured out how to use a checkbox function quiet well.

But I have another question.

How can I implement a function to Focus a specific window?

Im trying to do this

(in GUI)

When "~~~" is CHECKED

to Focus Client "Clients Name"

how can I go about that, any suggestions?

Thanks again AutoIT Forums!

~Acid Alchamy~

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Zenda, How come its only letting ONE of the functions (the top one) out of my three to actually work. None of the other ones (the other two) work when activated, I changed the order of them and the top one still is the only one that works regardless of what the top one is.

What is causing this, or is there a certain way I need to form multiple checkbox commands to make em all work?

Another question,

Func rolescale()

MouseClick("Left",0,2000)

WinWaitActive("[notepad]")

Send("{Enter}")

Send("/rolescale 1{Enter}")

EndFunc ;==>rolescale

I need it to only input this ONCE in my window and it spams it over and over, any ideas?

Please revise this and get back to me, thanks again!

Appreciate the help still Zenda,

~Acid Alchamy~

#include
GUICreate("Acid Alchamy", 300, 200)
GUICtrlCreateButton("CPH", 0, 0, 300)
GUICtrlCreateLabel("Press Alt + 1 To Closes", 50, 25, 300)
GUISetState(@SW_SHOW)
$rolescale = GUICtrlCreateCheckbox("/rolescale 1", 10, 90, 130, 20)
$f1spam = GUICtrlCreateCheckbox("Spam F1", 10, 50, 60, 20)
$getcords = GUICtrlCreateCheckbox("GtCords: 891:543", 10, 70, 130, 20)

Func rolescale()
MouseClick("Left",0,2000)
WinWaitActive("[notepad]")
Send("{Enter}")
Send("/rolescale 1{Enter}")
EndFunc ;==>rolescale

While 1
If IsChecked($rolescale) Then rolescale()
WEnd ;==> GUICheck rolescale

Func f1spam()
Sleep(1000)
Send("{F1}")
EndFunc ;==>f1spam
While 1
If IsChecked($f1spam) Then f1spam()
WEnd ;==>GUICheck f1spam

Func script()
Send("{F2}")
EndFunc ;==>script
while 1
HotKeySet("{numpad0}", "script")
If IsChecked($getcords) Then Send("{numpad0 1}") ;==>GUICheck getcords
WEnd ;==>GUICheck getcords

Func IsChecked($getcords)
Return BitAND(GUICtrlRead($getcords), $GUI_CHECKED) = $GUI_CHECKED
Return BitAND(GUICtrlRead($f1spam), $GUI_CHECKED) = $GUI_CHECKED
Return BitAND(GUICtrlRead($rolescale), $GUI_CHECKED) = $GUI_CHECKED
EndFunc ;==>IsChecked
Edited by AcidAlchamy

Share this post


Link to post
Share on other sites

Here is fixed your GUI part.

Anyway you can|t use Send() this way because in that time your GUI is active and keys are sent to your GUI and not to target application.

Use ControlSend() instead of Send to avoid this.

#include <GUIConstantsEx.au3>

GUICreate("Acid Alchamy", 300, 200)
GUICtrlCreateButton("CPH", 0, 0, 300)
GUICtrlCreateLabel("Press Alt + 1 To Closes", 50, 25, 300)
$rolescale = GUICtrlCreateCheckbox("/rolescale 1", 10, 90, 130, 20)
$f1spam = GUICtrlCreateCheckbox("Spam F1", 10, 50, 60, 20)
$getcords = GUICtrlCreateCheckbox("GtCords: 891:543", 10, 70, 130, 20)
GUISetState(@SW_SHOW)

HotKeySet("{numpad0}", "script")

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit

    If IsChecked($rolescale) Then rolescale()
    If IsChecked($f1spam) Then f1spam()
    If IsChecked($getcords) Then Send("{numpad0 1}") ;==>GUICheck getcords
WEnd ;==> GUICheck rolescale

Func rolescale()
    MouseClick("Left", 0, 2000)
    WinWaitActive("[notepad]")
    Send("{Enter}")
    Send("/rolescale 1{Enter}")
EndFunc   ;==>rolescale

Func f1spam()
    Sleep(1000)
    Send("{F1}")
EndFunc   ;==>f1spam

Func script()
    Send("{F2}")
EndFunc   ;==>script

Func IsChecked($control)
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>IsChecked

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Whats the correct way of using this?

If I have to use ControlFocus can someone show me the right way of using that as well along with this next fuction

My programs name im trying to Focus and input txt upon is "[HC]"

Func rolescale()
ControlSend("[CLASS:[HC]", "", "", "{Enter}/rolescale 1{Enter}")
EndFunc ;==>rolescale

or

Func rolescale()
ControlSend("[CLASS:[HC]]", "", "", "{Enter}/rolescale 1{Enter}")
EndFunc ;==>rolescale

or

Func rolescale()
ControlSend("[CLASS:[HC]", "", "", "{Enter}/rolescale 1{Enter}")
EndFunc ;==>rolescale

or

Func rolescale()
ControlSend("[HC]", "", "", "{Enter}/rolescale 1{Enter}")
EndFunc ;==>rolescale

Or how?

Because it says to have a ControlID but I checked the ID of the window on another PC and the ID on the same program comes up different and I want it to be universal of course.

my goal is to get focus of the window [HC] and input the command and txt "{Enter}/rolescale 1{Enter}"

Again, thanks a lot everyone for helping out.

Edited by AcidAlchamy

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0