Jump to content

Background automation possible?


Recommended Posts

It is a little bit hard to describe my question, although it must be the most common one.

I don't like that I cannot use any other application while an Auto-It script is running. It is because if I do, the keyboard commands are written into another application (the one which is in the foreground and has focus) and not into the one they are inteded for!

Lets assume I want to automate mIRC (no flooding). This should be automated: joining channels, writing some commands, change to another channel and so on. While it does this, I want to use another programs on the same computer without disturbing the Auto-It script.

I've seen no solution for this in the Auto-It tutorials. This is where I would expect such a documentation in the first place. The automation needs to be independend of which application is in foreground, so that I, as the user, can use any application while the script is running.

I hope you understood the problem I tried to describe and the solution I am searching for and most of all that there is a solution for this.

Link to comment
Share on other sites

It is a little bit hard to describe my question, although it must be the most common one.

I don't like that I cannot use any other application while an Auto-It script is running. It is because if I do, the keyboard commands are written into another application (the one which is in the foreground and has focus) and not into the one they are inteded for!

Lets assume I want to automate mIRC (no flooding). This should be automated: joining channels, writing some commands, change to another channel and so on. While it does this, I want to use another programs on the same computer without disturbing the Auto-It script.

I've seen no solution for this in the Auto-It tutorials. This is where I would expect such a documentation in the first place. The automation needs to be independend of which application is in foreground, so that I, as the user, can use any application while the script is running.

I hope you understood the problem I tried to describe and the solution I am searching for and most of all that there is a solution for this.

check out ControlSend() and Mirc has it's own scripting that is pretty versatile too.
Link to comment
Share on other sites

Well, it's documented in the helpfile, it's just a matter of finding it. Not too hard though :

AutoIt -> Function Reference -> Window Management -> Controls -> ...

There you got ControlClick, ControlSend, ControlSetText etc etc...

Link to comment
Share on other sites

I was happy too early.

Basically it works. But it still requires me to have that application in front. If it is in background, the ControlSend commands go into nirvana. Why?

I already tried:

Opt("SendKeyDelay", 0)

Opt("SendKeyDownDelay", 0)

And with different values. But same effect.

"ControlFocus" didn't work too for my purpose.

Any ideas?

Link to comment
Share on other sites

Show the code you used as well as the information about the window you're working with, by using "AutoIt Window Info".

Also, explain what unwanted actions which occur.... What kind application is this ? We need information to be able to help

you, and telling us that it just didn't work isn't too informing.

Link to comment
Share on other sites

; You need to start mIRC and connect it to a server first.
; Then minimize mIRC and run this script.
; Or maximize mIRC, run the script and then switch to another program while script is running.
; The script only works if mIRC is maximized and user doesn't switch program.
; Solution?

Opt("SendKeyDelay", 1)

Dim $controlID = 32921

Sleep(5000)
sendMessages()

Func sendMessages()
  sendMessageToChannels("0")
  sendMessageToChannels("1")
  sendMessageToChannels("2")
  sendMessageToChannels("3")
  sendMessageToChannels("4")
  sendMessageToChannels("5")
  sendMessageToChannels("6")
  sendMessageToChannels("7")
  sendMessageToChannels("8")
  sendMessageToChannels("9")
EndFunc

Func sendMessageToChannels($message)
  ControlFocus("", "", $controlID)
  ControlSend("", "", $controlID, "/join -x {#}alpha11{ENTER}")
  sendMessage($message)
  
  ControlFocus("", "", $controlID)
  ControlSend("", "", $controlID, "/join -x {#}beta22{ENTER}")
  sendMessage($message)
EndFunc

Func sendMessage($message)
  Sleep(100)
  ControlFocus("", "", $controlID)
  ControlSend("", "", $controlID, $message & "{ENTER}")
EndFunc

Link to comment
Share on other sites

Lets assume I want to automate mIRC (no flooding). This should be automated: joining channels, writing some commands, change to another channel and so on. While it does this, I want to use another programs on the same computer without disturbing the Auto-It script.

Out of curiosity could you explain why this is a good thing? I mean, how will other participants in the canal benefit from a bot like this?
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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