Jooshxp

How to Running Program on a background

9 posts in this topic

#1 ·  Posted (edited)

Hello,

Sorry for the past.

i want to know how to running program on a background.

so i can running another program again.

so like this :
Run "Notepad"
Send ("Hello")

but, i want to running it and still can browsing on a website.

also, how to WinWait or WinExist or WinActive if a program can't detected with autoit.
i make like this :

#include <MsgBoxConstants.au3>

example ()

Func Example ()
Run (""C:\Program Files\Mozilla Firefox\firefox.exe"")

WinWait ( "Mozilla Firefox", "", 10 )

If WinExists ( "Mozilla Firefox") Then
   MsgBox($MB_SYSTEMMODAL, "", "Mozilla Firefox is Running")
Else
   MsgBox($MB_SYSTEMMODAL, "", "Mozilla Firefox Not Running")
EndIf

EndFunc

But, when i try to Running it, msgbox is always showing Mozilla Firefox not Opened.

 

can anyone help ?

Thank's

Edited by Jooshxp

Share this post


Link to post
Share on other sites



"Mozilla Firefox(x86)"

isn't a path to a runable EXE, also the syntax of the run function is wrong. I suggest to study helpfile for getting basic understanding of the AutoIt syntax.

Share this post


Link to post
Share on other sites
10 minutes ago, AutoBert said:
"Mozilla Firefox(x86)"

isn't a path to a runable EXE, also the syntax of the run function is wrong. I suggest to study helpfile for getting basic understanding of the AutoIt syntax.

it just an example. :D and i already edit it... :D

Share this post


Link to post
Share on other sites

ControlSend and ControlClick. If you're wanting to do stuff on the web in the background then look at The FireFox UDF, Chrome UDf, or IE UDF.

Share this post


Link to post
Share on other sites
10 minutes ago, Jooshxp said:

it just an example. :D and i already edit it... :D

The current path&program in the run() statement is still wrong as it contains 2 double quotes at start and end which gives you an error.
What about you first try the script and try correcting it before posting other questions?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

21 hours ago, Jos said:

The current path&program in the run() statement is still wrong as it contains 2 double quotes at start and end which gives you an error.
What about you first try the script and try correcting it before posting other questions?

Jos

already make it,

lol

can i have another question here ?? :D
So, if i'm make infinite loop, and after 5 minutes it will do another things like this :

Func Start ()
    While 1 = 1
    MouseMove ( 1024, 768 )
    MouseClick ("Left", 1024, 768)
    Sleep (5000)
    WEnd
EndFunc

So, after the Func Start is Running, then after 5 minutes later it do another.

it can ? lol :D

Sorry if i can't ask here or ask that :D

 

21 hours ago, InunoTaishou said:

ControlSend and ControlClick. If you're wanting to do stuff on the web in the background then look at The FireFox UDF, Chrome UDf, or IE UDF.

Can it using for Mouse Movement and Click ? :D

Edited by Jooshxp

Share this post


Link to post
Share on other sites

Using a timer you can dictate how long a function can run, like this example.

Global Const $TIMEOUT = 1 ; Timeout in minutes

Example()
Func Example()
    Local $iTimeoutInMilis = ($TIMEOUT * 60) * 1000 ; Multiple timeout by 60 to get the seconds, then by 1000 to the miliseconds. Since the difference returned from TimerDiff is miliseconds
    Local $iDifference = 0
    Local $iTimer = TimerInit()
    While ($iDifference < $iTimeoutInMilis)
        $iDifference = TimerDiff($iTimer)
        Local $iMilis = ($iTimeoutInMilis - $iDifference)
        Local $iSecsRemain = Mod($iMilis / 1000, 60)
        Local $iMinsRemain = Mod($iMilis / 1000 / 60, 60)
        ToolTip("Current in loop for " & StringFormat("%02i:%02i:%02i", Floor($iDifference / 60000), Floor($iDifference / 1000), Mod($iDifference, 1000)) & @CRLF & _
                "Time remaining until Example ends: " & StringFormat("%02i:%02i:%02i", $iMinsRemain, $iSecsRemain, Mod($iMilis, 1000)), 0, 0)
        Sleep(200)
    WEnd
    MsgBox("", "Exited", "Reached the " & $TIMEOUT & " minute timeout. Example() has exited")
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

On 3/26/2016 at 9:19 PM, InunoTaishou said:

Using a timer you can dictate how long a function can run, like this example.

Global Const $TIMEOUT = 1 ; Timeout in minutes

Example()
Func Example()
    Local $iTimeoutInMilis = ($TIMEOUT * 60) * 1000 ; Multiple timeout by 60 to get the seconds, then by 1000 to the miliseconds. Since the difference returned from TimerDiff is miliseconds
    Local $iDifference = 0
    Local $iTimer = TimerInit()
    While ($iDifference < $iTimeoutInMilis)
        $iDifference = TimerDiff($iTimer)
        Local $iMilis = ($iTimeoutInMilis - $iDifference)
        Local $iSecsRemain = Mod($iMilis / 1000, 60)
        Local $iMinsRemain = Mod($iMilis / 1000 / 60, 60)
        ToolTip("Current in loop for " & StringFormat("%02i:%02i:%02i", Floor($iDifference / 60000), Floor($iDifference / 1000), Mod($iDifference, 1000)) & @CRLF & _
                "Time remaining until Example ends: " & StringFormat("%02i:%02i:%02i", $iMinsRemain, $iSecsRemain, Mod($iMilis, 1000)), 0, 0)
        Sleep(200)
    WEnd
    MsgBox("", "Exited", "Reached the " & $TIMEOUT & " minute timeout. Example() has exited")
EndFunc   ;==>Example

 

how about like this :
Func > Timer > back to Func again and repeat again again and again ??

can like that ?

On 3/26/2016 at 10:15 PM, Jos said:

Or simply an AdlibRegister() statement to perform a UDF after the specified time?

Jos

Yes, after the specified time like >
Function running on 5 minutes > after 5 minutes it is do another function sleep 1s / more then back to the function 1st.

 

So Like This an Example i have 2 Func
 

Hotkeyset [{"F1"}] "Start"

Func Start ()

While 1 = 1

MouseMove ( 700, 600 )

MouseClick ("Left" 700, 600)

WEnd

EndFunc

Func B ()

MouseMove ( 500, 500 )

Send ({"ESC"})

MouseClick ("Left", 500, 300 )

EndFunc

So What i mean is First Running Function Start after 5 Minutes Run Func B one time then back again to Function Start.

It Can ??


Thank's

Edited by Jooshxp

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