Jump to content

Setting an Windows Dialog box to @SW_HIDE


Recommended Posts

here is an example of my effort

#include <GuiConstants.au3>

AutoItSetOption("GUIOnEventMode", 1)
Opt("TrayIconDebug", 1) 

GUICreate("Tester")
$Button_1 = GUICtrlCreateButton("Test", 110, 100, 190, 20)
GUICtrlSetOnEvent(-1, "GetiT")
$Button_2 = GUICtrlCreateButton("Exit", 110, 130, 190, 20, "LeavePrime")
GUICtrlSetOnEvent(-1, "LeaveiT")
GUISetState()

While 1
    Sleep(10)
WEnd

Func GetiT()
    $XSTitle = "Browse For Folder"
    $XSPrompt = "Folders"
    HideiT($XSTitle, $XSPrompt)
EndFunc   ;==>GetiT

Func LeaveiT()
    Exit
EndFunc   ;==>LeaveiT

Func HideiT($XSTitle, $XSPrompt = "")
    FileDelete(EnvGet('temp') & 'XSkinit.txt')
    Local $XSfile = FileOpen(EnvGet("temp") & "XSkinit.au3", 2)
    If $XSfile = -1 Then MsgBox(0,0,0) 
    
    AutoItSetOption("WinTitleMatchMode", 4)
    AutoItSetOption("WinWaitDelay", 145) ;  less than 100 and it doesnt work at all
    Opt("WinDetectHiddenText", 1) 
    
    Local $XSline1 = '#NoTrayIcon'
    Local $XSline2 = '$ret = FileSelectFolder("Folders", @ProgramsDir, 2)'
    Local $XSline3 = 'FileWrite(EnvGet("temp") & "XSkinit.txt", $ret) '
    
    FileWrite($XSfile, $XSline1 & @CRLF & $XSline2 & @CRLF & $XSline3) 
    FileClose($XSfile)
    
    $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & EnvGet('temp') & 'XSkinit.au3"', '', @SW_HIDE)
    
    WinWait($XSTitle)
    
    WinSetState( $XSTitle, $XSPrompt, @SW_HIDE )
    Sleep(2000)
    WinSetState( $XSTitle, $XSPrompt, @SW_SHOW )
    Sleep(2000)
    WinClose( $XSTitle, $XSPrompt)
EndFunc

thx

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Hi,

:"> what is your problem?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

HI,

okay after I changed the title to the German ones - now I see your problem.

First thought was:

#include <GuiConstants.au3>

AutoItSetOption("GUIOnEventMode", 1)
Opt("TrayIconDebug", 1)

GUICreate("Tester")
$Button_1 = GUICtrlCreateButton("Test", 110, 100, 190, 20)
GUICtrlSetOnEvent(-1, "GetiT")
$Button_2 = GUICtrlCreateButton("Exit", 110, 130, 190, 20, "LeavePrime")
GUICtrlSetOnEvent(-1, "LeaveiT")
GUISetState()

While 1
    Sleep(10)
WEnd

Func GetiT()
    $XSTitle = "Ordner suchen"
    $XSPrompt = "Folders"
    HideiT($XSTitle, $XSPrompt)
EndFunc   ;==>GetiT

Func LeaveiT()
    Exit
EndFunc   ;==>LeaveiT

Func HideiT($XSTitle, $XSPrompt = "")
    FileDelete(EnvGet('temp') & 'XSkinit.txt')
    Local $XSfile = FileOpen(EnvGet("temp") & "XSkinit.au3", 2)
    If $XSfile = -1 Then MsgBox(0,0,0)
   
    AutoItSetOption("WinTitleMatchMode", 4)
    AutoItSetOption("WinWaitDelay", 145) ;  less than 100 and it doesnt work at all
    Opt("WinDetectHiddenText", 1)
   
    Local $XSline1 = '#NoTrayIcon'
    Local $XSline2 = '$ret = FileSelectFolder("Folders", @ProgramsDir, 2)'
    Local $XSline3 = 'FileWrite(EnvGet("temp") & "XSkinit.txt", $ret) '
   
    FileWrite($XSfile, $XSline1 & @CRLF & $XSline2 & @CRLF & $XSline3)
    FileClose($XSfile)
   
    $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & EnvGet('temp') & 'XSkinit.au3"', '', @SW_HIDE)
    WinSetOnTop("Tester", "", 1)
    WinWait($XSTitle)
    WinSetState( $XSTitle, $XSPrompt, @SW_HIDE )
    WinSetOnTop("Tester", "", 0)
    Sleep(2000)
    WinSetState( $XSTitle, $XSPrompt, @SW_SHOW )
    Sleep(2000)
    WinClose( $XSTitle, $XSPrompt)
EndFunc

PS: Surely, not what you want, but .. :">

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

#include <GuiConstants.au3>

AutoItSetOption("GUIOnEventMode", 1)
Opt("TrayIconDebug", 1)

GUICreate("Tester")
$Button_1 = GUICtrlCreateButton("Test", 110, 100, 190, 20)
GUICtrlSetOnEvent(-1, "GetiT")
$Button_2 = GUICtrlCreateButton("Exit", 110, 130, 190, 20, "LeavePrime")
GUICtrlSetOnEvent(-1, "LeaveiT")
GUISetState()

While 1
    Sleep(10)
WEnd

Func GetiT()
    $XSTitle = "Browse For Folder"
    $XSPrompt = "Folders"
    HideiT($XSTitle, $XSPrompt)
EndFunc   ;==>GetiT

Func LeaveiT()
    Exit
EndFunc   ;==>LeaveiT

Func HideiT($XSTitle, $XSPrompt = "")
    FileDelete(EnvGet('temp') & 'XSkinit.txt')
    Local $XSfile = FileOpen(EnvGet("temp") & "XSkinit.au3", 2)
    If $XSfile = -1 Then MsgBox(0,0,0)
   
    AutoItSetOption("WinTitleMatchMode", 4)
    ;AutoItSetOption("WinWaitDelay", 145) ;  less than 100 and it doesnt work at all
    Opt("WinDetectHiddenText", 1)
   
    Local $XSline1 = '#NoTrayIcon'
    Local $XSline2 = '$ret = FileSelectFolder("Folders", @ProgramsDir, 2)'
    Local $XSline3 = 'FileWrite(EnvGet("temp") & "XSkinit.txt", $ret) '
   
    FileWrite($XSfile, $XSline1 & @CRLF & $XSline2 & @CRLF & $XSline3)
    FileClose($XSfile)
   
    $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & EnvGet('temp') & 'XSkinit.au3"', '', @SW_HIDE)
   
    WinWait($XSTitle)
   
    WinSetState( $XSTitle, $XSPrompt, @SW_HIDE )
    Sleep(2000)
    WinSetState( $XSTitle, $XSPrompt, @SW_SHOW )
    Sleep(2000)
    WinClose( $XSTitle, $XSPrompt)
EndFunc

? works somewhat better

Edited by CHRIS95219
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...