Sign in to follow this  
Followers 0
hohenheim

RunWait problem

4 posts in this topic

Hi everyone, I jope that someone could help me fixing this:

I have two autoit programs, parent script that runs another script every 10 minutes, no gui showed in both scripts.

The problem is that when the parent script executes the child one; the active window i'm working on switches to inactive(MSN, Firefox....) that's very annoying.

I'm looking for a way to run child script in total transparency. So if someone have the solution to this it would be great. Thanks

Share this post


Link to post
Share on other sites



you could have the parent script check to see what window is currently active before calling the 2nd script, then write the handle to a small ini file or something. Then first thing the child script could do is get the handle from the saved ini and reactivate that window. You might still get an initial flicker in whatever else you were doing but it may be a place to start.

Without seeing and code it's hard to tell why it would be doing that.

Another option to try (even though there is no GUI) could be Run() or ShellExecute() your child script with the @SW_HIDE flag.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Thank you for your consideration Mr Kaotikbliss.

Here's the simplified child script code:

#include <ie.au3>

$timeout=60000

opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)

TraySetOnEvent(-7,"traypop")
TraySetOnEvent(-8,"traypopout")
TraySetOnEvent(-13,"show")
TraySetOnEvent(-10,"trayexit")



func traypopout()
    tooltip("")
endfunc

func traypop()
    tooltip($user,_WinAPI_GetMousePosX(),_WinAPI_GetMousePosY()-20,Default,0,2)
endfunc

func trayexit()
    Exit(0)
EndFunc

func show()
    if $shown=1 Then
        $shown=0
        GUISetState(@SW_HIDE)
        return 0
    EndIf
    $shown=1
    GUISetState(@SW_SHOW)
EndFunc


_IELoadWaitTimeout($timeout)
$h=guicreate("Child",900,600)
$iex=_IECreateEmbedded()
guictrlcreateobj($iex,0,0,900,600)



for $x=1 to 5
.
.
.
.
.
Next

exit(1)

And here's the parent script simplified too:

#include <date.au3>

opt("TrayOnEventMode",1)
TraySetOnEvent(-7,"traypop")
TraySetOnEvent(-8,"traypopout")

Opt("TrayMenuMode",1)
TraySetOnEvent(-10,"trayexit")

func trayexit()
    Exit(0)
EndFunc

func traypopout()
    tooltip("")
endfunc

func traypop()
$dirpath=stringsplit(@ScriptDir,'\')
tooltip($dirpath[ubound($dirpath)-1],_WinAPI_GetMousePosX(),_WinAPI_GetMousePosY()-20,Default,0,2)
EndFunc



Do
    filltab($tab,$n)

    for $x=0 to $n-1

        if _datediff('n',_nowcalc(),$tab[$x])<0 Then

        $result=runwait("files\instance.exe "&$x+1,"files\",@SW_HIDE)

    Next

    sleep(getsleep($tab,$n)*1000)

until 0

Share this post


Link to post
Share on other sites

No one has a solution? :)

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  
Followers 0