Jump to content
Sign in to follow this  
rossnixon

Bring application or process to the foreground

Recommended Posts

rossnixon

I wish to schedule a compiled script to run each day at a certain time.

This will bring a specifically named 'application' or 'process' (it appears in both places) to the foreground, assuming that it is running,

so that I can automate several key presses on the dialog box.

How would I do the test that it is running?

How would I bring it to the foreground?

I can do the keypress stuff OK.

Thanks.

Share this post


Link to post
Share on other sites
rossnixon

Thank you for that. Now I am stuck on getting the window to unminimise.

The ProcessExists works (I used a MsgBox test)... but WinActivate doesn't work.

I tried part of the text, then the full text from the top of the window.

I also updated to version 3.3.6.1 to see if that would help, but no.

(Using XP Home SP3)

Share this post


Link to post
Share on other sites
rossnixon

The window is called: Ross - Quickbooks Pro Timer (I double-checked using Au3Info)

If the window is behind another window, it brings it to the foreground.

If it is minimised, nothing happens.

I did try the 'Opt' code too, (is that the default?), but no change.

Share this post


Link to post
Share on other sites
rossnixon

Now I'm trying the following 3 lines, but I'm not sure what order to use them in. I tried a few orders but none of them worked.

WinSetState ("QuickBooks Pro Timer", "", @SW_RESTORE)

WinActivate("QuickBooks Pro Timer")

WinSetOnTop("QuickBooks Pro Timer", "", 1)

Share this post


Link to post
Share on other sites
rossnixon

I tried function WinGetState.

It returns 7 (exists, visible, enabled) regardless of whether the interface dialog is minimised to the task bar, or visible in the middle of the screen, or hidden behind another window.

This must not be a 'normal' window. It looks more like a dialog bix than a window, come to think of it.

Is there a different function that will restore a minimised dialog box?

Share this post


Link to post
Share on other sites
omnomnom

have you tried WinActive?

http://www.autoitscript.com/autoit3/docs/functions/WinActive.htm

Share this post


Link to post
Share on other sites
rossnixon

OK, tried WinActive.

The windows is *not* active when minimized.

I don't know how to make it active or restore it onto the screen.

WinActivate(), WinSetOnTop() and WinSetState() won't do it, and after each of them I ran another WinActive(), but the window did not become 'active'.

Does anyone want to try the application? I can send the 3 files for installing (4.3MB as a 7z archive)

Edited by rossnixon

Share this post


Link to post
Share on other sites
omnomnom

OK, tried WinActive.

The windows is *not* active when minimized.

I don't know how to make it active or restore it onto the screen.

WinActivate(), WinSetOnTop() and WinSetState() won't do it, and after each of them I ran another WinActive(), but the window did not become 'active'.

Does anyone want to try the application? I can send the 3 files for installing (4.3MB as a 7z archive)

Sure send them, ill have a try.

Share this post


Link to post
Share on other sites
rossnixon

Have tried using both the basic and the flash uploader. But get error messages with both.

If the file actually got there (Files, Misc) it is called QuickBooks_Pro_Timer.zip

Edited by rossnixon

Share this post


Link to post
Share on other sites
omnomnom

Hmm, I am unsure if it is allowed in the forums however you can try uploading to a file sharing service and giving the the link (in code tags).

I recommend

http://mediafire.com

I can then get it from the link you provide and continue helping you.

if this is not allowed in these forums can somebody let me know? Thanks.

Share this post


Link to post
Share on other sites
rossnixon

OK, have uploaded to the public area of mediafire, I think. (I didn't make an account).

Link is http://www.mediafire.com/download.php?n0ic3z0gm2i

Share this post


Link to post
Share on other sites
herewasplato

Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title
WinActivate("Timer")
works for me using v3.3.6.1 and the zip that you uploaded on XP Pro SP3

The window changes titles.

When it is minimized to the task bar - the title is "Timer".

When it is not minimized, perhaps not in the foreground, the title is "1 - QuickBooks Pro Timer".

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
omnomnom

Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title
WinActivate("Timer")
works for me using v3.3.6.1 and the zip that you uploaded on XP Pro SP3

The window changes titles.

When it is minimized to the task bar - the title is "Timer".

When it is not minimized, perhaps not in the foreground, the title is "1 - QuickBooks Pro Timer".

I also get this...

The title always contains timer so set the winactivate to be "Timer" and it will always work.

Share this post


Link to post
Share on other sites
Neno

I also get this...

The title always contains timer so set the winactivate to be "Timer" and it will always work.

Totally not tested as I don't have your program

;; Find a window and bring it to the foreground ;;
HotKeySet("{F1}","Terminate")
Opt("WinTitleMatchMode",2)
While 1
    If (WinActivate("Timer") <> 0) Or (WinActive("Timer") <> 0) Then
        WinSetState("Timer","",@SW_RESTORE)
        ToolTip("Activated",0,0)
        StuffToDo()
        ExitLoop
    Else
        ToolTip("Not Activated",0,0)
    EndIf
    Sleep(1000)
WEnd

Func StuffToDo()
    ToolTip("Doing Stuff",0,0)
    ;; put all your macros here ;-D
    Sleep(1000)
EndFunc

Func Terminate()
    Exit 0
EndFunc
Edited by Neno

Share this post


Link to post
Share on other sites
rossnixon

Ah!!! Thank you to all who helped. :idea:

I had assumed - wrongly - that the Title was a 'fixed' thing that was just not all visible when minimised.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.