Jump to content

How to properly implement controlsend and wintitle into this simple macro to run it in the background - (Locked)


Recommended Posts

Posted

The macro:

HotKeySet("{F7}", "Pause")
HotKeySet("{ESC}", "Close")
Global $Pause = 1
While 1
    If $Pause = 0 Then
    MouseClick("right")
    EndIf
    Sleep(800)
WEnd

Func Pause()
    If $Pause = 0 Then
    $Pause = 1
    Else
    $Pause = 0
    EndIf
EndFunc

Func Close()
    Exit
EndFunc

Controlsend and Wintitleto run it in the background, how does this look like correctly? A complete layman asking

 

 

Posted (edited)
56 minutes ago, FrancescoDiMuro said:

Hi @codebegins:)
What's the real question? :D

P.S: You could short this

Func Pause()
    If $Pause = 0 Then
    $Pause = 1
    Else
    $Pause = 0
    EndIf
EndFunc

into this

Func Pause()
    $Pause = Not $Pause
EndFunc

:)

Hi! How to wrap this existing macro here into one that runs in the background?

Currently: This is only running in the foreground. Meaning when it runs and alt-tabbed out of that app/program, the macro continues to play out on the browser, desktop etc. How can this be exclusively run in the window of said program? Hence "in the background" while other work is done, in the foreground. This is my main request

My reference was something like this:

HotkeySet ("{END}", "Stop")
HotkeySet ("{HOME}", "Start")
Func Start ()
While True
IF WinActive ("ZSNESWIN") Then
ControlSend("ZSNESWIN", "", "", "{LEFT}");Presses the Left key 1 time
ControlSend("ZSNESWIN", "", "", "{RIGHT}");Presses the Right key 1 time
ControlSend("ZSNESWIN", "", "", "{LEFT}");Presses the Left key 1 time
ControlSend("ZSNESWIN", "", "", "{RIGHT}");Presses the Right key 1 time
ControlSend("ZSNESWIN", "", "", "{UP down}");Holds the Up key down
ControlSend("ZSNESWIN", "", "", "{x}");Presses the x key 1 time
ControlSend("ZSNESWIN", "", "", "{UP up}");Releases the Up key
EndIf
WEnd
EndFunc
While (1)
Sleep (1)
WEnd
Func Stop ()
        Exit 0
EndFunc

Which was corrected into

ControlSend("ZSNESWIN", "", "", "{LEFT}");Presses the Left key 1 time

but I have no idea how to translate this over to this macro here. Can here please be assisted?

Edited by codebegins
Posted (edited)
1 hour ago, FrancescoDiMuro said:

Show us the code where you use ControlSend() and so on :)

I do not know how to do it :( completely new to this. I am just puzzling it together by what I find researching on google so far

Reason why I asked how this will look like with this macro that I understood to write like that for the needs I need to meet on my work. Can you show me how to implement controlsend and to a window(title) please?

Edited by codebegins
Posted (edited)
57 minutes ago, FrancescoDiMuro said:

It dipends on what you are trying to automate.
Without seeing that, no one could really help you :)

Oh I thought it would be clear from the post. Isn't that so? The macro I've posted first

This one

HotKeySet("{F7}", "Pause")
HotKeySet("{ESC}", "Close")
Global $Pause = 1
While 1
    If $Pause = 0 Then
    MouseClick("right")
    EndIf
    Sleep(800)
WEnd

Func Pause()
    If $Pause = 0 Then
    $Pause = 1
    Else
    $Pause = 0
    EndIf
EndFunc

Func Close()
    Exit
EndFunc

It automates simply only rightclicks. That done while the window is in the background and other actions can be performed on other windows in the foreground. Started and stopped with F7. Would rightclick be "reserved" for that window in the background?

 

 

Edited by codebegins
Posted (edited)
10 minutes ago, FrancescoDiMuro said:

Can you provide some screenshots of the the Window(s) you are trying to automate?
Did you use the Au3Info tool?

it's just for a game. in which rightclick is bound to the hotbar 1-9 and instead of pressing 1-9, 1-9 is all assigned to rightclick. Is this information really necessary? I rarely like to go indepth because I am well aware of the human's psyche in BIAs'ing. Especially on the internet. It's nothing shady, nothing cryptic, just automating robotic processes to keep my humanity :)
Please just help me out with assigning ControlClick + WinTitle to the Macro above. Is this possible? I greatly appreciate it. Thank you for your understanding. If not, please let me know why not, why more information needs to be shared this way. Thanks again.

Edited by codebegins
Posted
1 minute ago, FrancescoDiMuro said:

Game automation is not allowed here.
Read the Forum rules ( in the signature ).

See, exactly that is why I did not want to go indepth. Again my bad for telling the truth and now I am stuck because I replied. Why did you do this?

Posted (edited)
34 minutes ago, FrancescoDiMuro said:

Because we are in a community where there are Rules which have to be followed :)

I have no idea what you or anyone have in mind what would be wrong with what I have asked. But if that is not allowed and further assistance not given, so be it. You have the free opportunity to help someone, which is generally the core concept and drive of a community. If that wants to be gated and declined by projecting ill-will on someone who has none of these intention, go live with it. That is not my life's approach.

Edited by codebegins
  • Moderators
Posted

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...