Jump to content

Bring application or process to the foreground


Recommended Posts

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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