Sign in to follow this  
Followers 0
bman

FileOpenDialog always on top?

7 posts in this topic

Is there a way to make it so that the FileOpenDialog shows up with an "always on top" attribute?

Also, is there a way to make the FileOpenDialog time out? :D

Share this post


Link to post
Share on other sites



Is there a way to make it so that the FileOpenDialog shows up with an "always on top" attribute?

Also, is there a way to make the FileOpenDialog time out?

Since the main script is paused while this window is open, you can't do it from the same script. However, I have done this using a 2nd script. You could FileInstall it if you don't want it to appear like you have 2 scripts to the end user. Right before you hit the FileOpenDialog call, you call your 2nd script. That 2nd script will: wait for the dialog to appear, start a timer, and loop to check the timer, and check if the window is not on top. If it is no longer on top, bring it back, and if the time is out, close the window.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

thanks man,

worked like a charm...

Opt("WinTitleMatchMode", 2)

WinWait ("Choose File", "Look &in:")

WinSetOnTop ( "Choose File", "Look &in:", 1)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I found a pretty cool way to do it without the extra file too...

If $CmdLine[0] > 0 Then
     If $CmdLine[1] = "ontop" Then 
     AutoItWinSetTitle("AutoIT ONTOP")
     WinWait ("Choose File", "Look &in:", 5000)
     WinSetOnTop ( "Choose File", "Look &in:", 1)
     Exit
     EndIf
EndIf

;other script steps go here

Run("filename.exe ontop")
$imagename = FileOpenDialog("Choose File", "C:\Windows\", "Images (*.jpg)", 1 + 2 )

;other script steps go here
Edited by bman

Share this post


Link to post
Share on other sites

The script runs itself again with a command line option, to set the window of the existing script on top, right?

That works too. Even better than FileInstall.

Share this post


Link to post
Share on other sites

yes.. that is exactly what it does.. runs itself again...

Share this post


Link to post
Share on other sites

:D Genius!

I had to tweak it a little to work for me, Win XP Pro AutoIt 3.0.102 (June 4th?)--and this should also work for uncompiled scripts if you installed AutoIt with an installer.

$fileOpenDialogTitle = "Choose File"

If $CmdLine[0] > 0 Then
    If $CmdLine[1] = "ontop" Then
      WinWait ($fileOpenDialogTitle, "", 5000)
      WinActivate($fileOpenDialogTitle, "")
      WinSetOnTop ($fileOpenDialogTitle, "", 1)
      Exit
    EndIf
EndIf

;other script steps go here

If @Compiled Then
   Run('"' & @ScriptName & '" ontop')
Else
   $AUTOIT = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\HiddenSoft\AutoIt3","InstallDir") & "\AutoIt3.exe"
   Run('"' & $AUTOIT & '" ' & @ScriptName & ' ontop')
EndIf
$imagename = FileOpenDialog($fileOpenDialogTitle, "C:\Windows\", "Images (*.jpg)", 1 + 2 )

;other script steps go here

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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