Jump to content
Sign in to follow this  
mentosan

make a script based on a running task process

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

Share this post


Link to post
Share on other sites
FireFox

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


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
mentosan

I'm making a script which sends keys to a command prompt window. I want to insert a condition: the keys will be send only when cmd.exe is present in Task Manager.

Edited by mentosan

Share this post


Link to post
Share on other sites
youknowwho4eva

prcessexists()?


Giggity

Share this post


Link to post
Share on other sites
Valuater

Example...

While 1
    If ProcessExists("cmd.exe") Then
        ; do stuff
        MsgBox(4096, "Test", "The cmd.exe process is running     ", 3)
    EndIf
    Sleep(20)
WEnd

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
FireFox

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


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
mentosan

It's OK .

Thanks a lot !

Share this post


Link to post
Share on other sites
mentosan

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.

Share this post


Link to post
Share on other sites
youknowwho4eva

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

Share this post


Link to post
Share on other sites
mentosan

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

Share this post


Link to post
Share on other sites
youknowwho4eva

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

Share this post


Link to post
Share on other sites
mentosan

Oh, I'm so....... :o It looks now quite simple.

Thank you very much for your hints !

:) and :D

Share this post


Link to post
Share on other sites
youknowwho4eva

Oh, I'm so....... :o It looks now quite simple.

Thank you very much for your hints !

:) and :D

That's the "why didn't I think of that?" moment I was looking for lol.


Giggity

Share this post


Link to post
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
Sign in to follow this  

×