Jump to content

make a script based on a running task process


 Share

Recommended Posts

@mentosan

Hi

I want to setup a condition in my au3 script based on a running Windows process (which i see it in Task Manager).

Any ideas ?

Thx

I dont understand your question, can you post some examples ?

Cheers, FireFox.

Link to comment
Share on other sites

Hi

I want to setup a condition in my au3 script based on a running Windows process (which i see it in Task Manager).

Any ideas ?

Thx

ProcessList()?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

@mentosan

Opt("WinTitleMatchMode", 2)

While 1
    If ProcessExists("cmd.exe") Then
        If WinActive("cmd.exe") Then
            ; do stuff
            Send("test / ")
            TrayTip("WinActive", "cmd.exe process is running !", 0, 1)
        Else
            TrayTip("WinUnactive", "cmd.exe process is running !", 0, 1)
            WinActivate("cmd.exe")
        EndIf
    Else
        TrayTip("test", "cmd.exe process isnt running !", 0, 1)
    EndIf
    Sleep(20)
WEnd

Cheers, FireFox.

Link to comment
Share on other sites

Hello! I'm back again with one more wish.

Here is a part of my code:

CODE

If ProcessExists("cmd.exe") Then

WinActivate("cmd")

WinWaitActive("cmd")

While 1

Send("{ESC}")

ControlSend ("cmd","","",$callnumber[1] & "{Enter}")

Sleep ($timer[1])

WEnd

Else

TrayTip("Command prompt inactive", "Please launch the application", 0, 1)

EndIf

Sleep(7000)

The problem is ,because $timer (which will read from a txt file) is a very high value (like 30 minutes=1800000miliseconds) I must wait all this period until loop will start again. If in the meantime the process "cmd.exe" is started, the script will still wait for this counter. I want to keep the $timer counter and to modify somehow the code that if process "cmd.exe" is started (let's say manually) the script will start to loop from beginning.

I hope I'm clear in my state above, sorry because I'm not native english.

Link to comment
Share on other sites

If ProcessExists("cmd.exe") Then

WinActivate("cmd")

WinWaitActive("cmd")

While 1

If ProcessExists("cmd.exe") Then Exitloop

Send("{ESC}")

ControlSend ("cmd","","",$callnumber[1] & "{Enter}")

Sleep ($timer[1])

WEnd

Else

TrayTip("Command prompt inactive", "Please launch the application", 0, 1)

EndIf

Sleep(7000)

Giggity

Link to comment
Share on other sites

If ProcessExists("cmd.exe") Then

WinActivate("cmd")

WinWaitActive("cmd")

While 1

If ProcessExists("cmd.exe") Then Exitloop

Send("{ESC}")

ControlSend ("cmd","","",$callnumber[1] & "{Enter}")

Sleep ($timer[1])

WEnd

Else

TrayTip("Command prompt inactive", "Please launch the application", 0, 1)

EndIf

Sleep(7000)

Hi !

It's is not ok. It is OK if this command would exist :

CODE

If ProcessExists("cmd.exe") Then

WinActivate("cmd")

WinWaitActive("cmd")

While 1

If ProcessExists("cmd.exe") Then Exitloop

Send("{ESC}")

ControlSend ("cmd","","",$callnumber[1] & "{Enter}")

If ProcessNOTExists("cmd.exe") Then Exitloop

Sleep ($timer[1])

WEnd

Else

TrayTip("Command prompt inactive", "Please launch the application", 0, 1)

EndIf

Sleep(7000)

Edited by mentosan
Link to comment
Share on other sites

Ah it was a miss wording in your phrasing

If ProcessExists("cmd.exe") Then
WinActivate("cmd")
WinWaitActive("cmd")

While 1
Send("{ESC}")
ControlSend ("cmd","","",$callnumber[1] & "{Enter}")
If not ProcessExists("cmd.exe") Then Exitloop
Sleep ($timer[1])
WEnd

Else
TrayTip("Command prompt inactive", "Please launch the application", 0, 1)
EndIf
Sleep(7000)

and to give you a "why didn't I think of that?" moment

If ProcessExists("cmd.exe") Then 
else
Exitloop
endif
Edited by youknowwho4eva

Giggity

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