Jump to content

Can I run the same script twice simultaneously?


Recommended Posts

There's no reason why the same script can't be running as many times as you want while other instances of the same script are also active. If you are using global send commands, they will overlap with other active scripts. However, if you are using ControlSend, then this shouldn't be a problem.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

10x, Pek, but I think u r wrong...

Let me prove it :D

Open 2 text files using notepad. Save the first as a.txt and the second as 2.txt.

Don't close the files.

Create 2 autoit files. a.au3 and b.au3

Paste the code for a.au3

Sleep (5000)
For $i=1 to 100
    For $x=1 to 300
  $message=$message & "a"
    Next
    WinActivate ("a.txt")
    send ($message)
    Send ("{ENTER}")
    Sleep (5000)
Next

Sleep (5000)
For $i=1 to 100
    For $x=1 to 300
  $message=$message & "b"
    Next
    WinActivate ("b.txt")
    send ($message)
    Send ("{ENTER}")
    Sleep (5000)
Next

Run the forst one and right after the second. You'll see that when to instances of 'Send' are running, it doesn't write all the " aaaaa" to the a window and vice versa.

Link to comment
Share on other sites

Actually, that is excatally what I said would happen. Please look up the ControlSend function in the helpfile. A Send is a global send, and it will happen globally (as if you were typing it.) If you want to control text to two windows at the same time, you need to use ControlSend to prevent the key presses from interfering with the 2nd script, as you saw in your example.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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...