Jump to content

execute two command at the same time ?


Recommended Posts

welcome to the forums...

like what type of commands

Run("Notepad.exe", "", @SW_MAXIMIZE)
Run("Notepad.exe", "", @SW_MAXIMIZE)

this will run notepad twice.... very rapidly as if 2 at a time

8)

I would like : Run("Notepad.exe", "", @SW_MAXIMIZE) and Run("Notepad.exe", "", @SW_MAXIMIZE) on the same line :">
Link to comment
Share on other sites

i think what i showed you is as fast and as representative as you cant get... for what you want

8)

Sample :

For $x = 1 to $array[0]

RunWait ( @ComSpec & " /c program1 " & $array[$x] , "", @SW_HIDE )

RunWait ( @ComSpec & " /c program2 " & $array[$x] , "", @SW_HIDE )

Next

$array can go to 1000 values, thus y would like to save time in run process at the same time

Link to comment
Share on other sites

for only 3 posts you seem very sharp in what you want... however

runwait will stop your script as wriiten above

also

Sample :

For $x = 1 to $array[0]

Run ( @ComSpec & " " & $array[$x] , "", @SW_HIDE )

Next

will run those 1000 programs very very fast

.......... i dont think i like your direction, if you are going to run 1000 programs all hidden... you are going to have problems

or malware?

8)

NEWHeader1.png

Link to comment
Share on other sites

for only 3 posts you seem very sharp in what you want... however

runwait will stop your script as wriiten above

also

Sample :

For $x = 1 to $array[0]

Run ( @ComSpec & " " & $array[$x] , "", @SW_HIDE )

Next

will run those 1000 programs very very fast

.......... i dont think i like your direction, if you are going to run 1000 programs all hidden... you are going to have problems

or malware?

8)

lol

no malware, just requests SNMP

RunWait ( @ComSpec & " /c snmpwalk -v 1 -Oqn -c " & $community & "@" & $Vlan[$x] .........

I want to make a portmapper for cisco equipment, who comprises X vlan

Link to comment
Share on other sites

  • Moderators

I have been looking at this, and was going to offer a VMultiThread option, but I don't see the difference in

For $x = 1 to $array[0]
    RunWait ( @ComSpec & " /c program1 " & $array[$x] , "", @SW_HIDE )
    RunWait ( @ComSpec & " /c program2 " & $array[$x] , "", @SW_HIDE )
Next
or if this even worked
RunWait ( @ComSpec & " /c program1 " & $array[1] , "", @SW_HIDE ) And RunWait ( @ComSpec & " /c program2 " & $array[2] , "", @SW_HIDE )
Considering that you would still need to wait until the 1st one is ran for the 2nd one to run in either case.

Are you just wanting to run multiple applications/launches at the same time? I tested a VMultithread option and it worked, but RunWait seems kind of senseless in that case, because you don't want to "wait". Sorry, I might be misunderstanding you exact scenerio you "need/want" to happen.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I have been looking at this, and was going to offer a VMultiThread option, but I don't see the difference in

For $x = 1 to $array[0]
    RunWait ( @ComSpec & " /c program1 " & $array[$x] , "", @SW_HIDE )
    RunWait ( @ComSpec & " /c program2 " & $array[$x] , "", @SW_HIDE )
Next
or if this even worked
RunWait ( @ComSpec & " /c program1 " & $array[1] , "", @SW_HIDE ) And RunWait ( @ComSpec & " /c program2 " & $array[2] , "", @SW_HIDE )
Considering that you would still need to wait until the 1st one is ran for the 2nd one to run in either case.

Are you just wanting to run multiple applications/launches at the same time? I tested a VMultithread option and it worked, but RunWait seems kind of senseless in that case, because you don't want to "wait". Sorry, I might be misunderstanding you exact scenerio you "need/want" to happen.

I use runwait bus I write the result in a file :

For $x = 1 to $array[0] ; array 1 ~ 400

RunWait ( @ComSpec & " /c program1 field" & $array[$x] & " >> file1.txt", "", @SW_HIDE )

RunWait ( @ComSpec & " /c program2 field" & $array[$x] & " >> file2.txt", "", @SW_HIDE )

I seek to launch plusior command in simultaneous

If you have another solution I am taking :">

not obvious A to explain, therefore has to help

Edited by raclius
Link to comment
Share on other sites

  • Moderators

I'm still confused, but that's normal for me, I live in a state of confusion.

See if this helps any

$URL = 'http://www.autoitscript.com/donate.php'

_RunWaitExLine(@ComSpec & " /c Start " & $URL, '', @SW_HIDE)

Func _RunWaitExLine($sRunString, $vWorkingDir = @WorkingDir, $vFlag = @SW_SHOW)
    $iExecPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & _
            '"RunWait(' & "'" & $sRunString & "'," & "'" & $vWorkingDir & "'," & "'" & $vFlag & "')" & '"')
    Return $iExecPID ; Returns new launched PID
EndFunc
Warning... This will launch a new app/exe for each instance it is called.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

probably better than my idea

******* not tested

; Maybe.... compile this as RunMan.exe 

If $CMDLine[0] > 0 Then
    RunWait ( @ComSpec & " /c program1 field" & $CMDLine[1] & " >> " & $CMDLine[2], "", @SW_HIDE )
EndIf



; then in your script

$Runman = @TempDir & "\TempRun.exe"
FileInstall("C:\Program Files\AutoIt3\RunMan.exe", $Runman)


For $x = 1 to $array[0]; array 1 ~ 400
    Run($Runman & ' "' & $array[$x] & '" "' & "file1.txt" & '"')  
    Run($Runman & ' "' & $array[$x] & '" "' & "file2.txt" & '"')
; wait for the 2 processes to close
    While 1
        If Not ProcessExists("RunMan.exe") Then ExitLoop
        Sleep(20)
    WEnd
Next

8)

NEWHeader1.png

Link to comment
Share on other sites

While 1
  If Not ProcessExists("RunMan.exe") Then ExitLoop
  Sleep(20)
WEndoÝ÷ Ú,(ºW]¢+eGºÚ"µÍÚ[HØÙÜÑ^ÝÊ   ][ÝÔ[Ý^I][ÝÊHÔØÙÜÑ^ÝÊ   ][ÝÔ[^I][ÝÊHÛY

BÑ[

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

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