Sign in to follow this  
Followers 0
James

Hide function wont work with button press

21 posts in this topic

Hey, Im making a desktop ball, and with some GUI.

I have it running the program, and nearly closing it, but I also need it to hide the GUI box. I have the hider script working, but not with the GUI.

Any help?

Share this post


Link to post
Share on other sites



Hey, Im making a desktop ball, and with some GUI.

I have it running the program, and nearly closing it, but I also need it to hide the GUI box. I have the hider script working, but not with the GUI.

Any help?

Show us your script and someone will help.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Yeah Ok, I was just going to do that.

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $start
            sleep(3000)
            Run('E:\Programs\ballbasic.exe')    ; Run Desktop Ball
            MsgBox(0, 'Running', 'Desktop has started') ; Tell user ball started
        Case $msg = $stop
            MsgBox(0, 'Stop', 'Pressing this will end the ball game - stop function not working yet')    ; Stop Ball
        Case $msg = $hide
    If $hidden = "yes" Then
        Sleep (10)
    Else
        Global $title = WinGetTitle("")
        Sleep (10)
    EndIf
    EndSelect
Wend

Share this post


Link to post
Share on other sites

Hi,

not sure, but maybe this helps GUISetState(@SW_HIDE)

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

Share this post


Link to post
Share on other sites

Where do I put this?

where it makes sense... meaning where you want to hide the GUI...

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Hi,

post the complete script or replace this line GUISetState () by the one mentioned and you'll not see the GUI

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

Share this post


Link to post
Share on other sites

Thanks th.meger its now working.

But as it hides the window and runs it like a service, how do I make it show the window again?

Hotkeys:

HotKeySet ("^+w", "Show") ; Key to show
Opt("TrayIconHide", 1) ; Hide icon from tray
$hidden = "no" ; Set name for keys
oÝ÷ Ø[§rبƮ¶­s`¤gVæ2FR b33c¶FFVâÒgV÷C·W2gV÷C° bväW7G2gV÷C²gV÷C²fײb33c·FFÆRFVà vå6WE7FFRgV÷C²gV÷C²fײb33c·FFÆRÂgV÷C²gV÷C²Â5uôDR VæD`¤VæDgVæ0 ¤gVæ26÷r b33c¶FFVâÒgV÷C¶æògV÷C° bväW7G2gV÷C²gV÷C²fײb33c·FFÆRFVà vå6WE7FFRgV÷C²gV÷C²fײb33c·FFÆRÂgV÷C²gV÷C²Â5uõ4õr VæD`¤VæDgVæ0oÝ÷ Ø   ݶjǬµ«fz{ljëh×6
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $start
            sleep(3000)
            Run('E:\Programs\deskball.exe')    ; Run Ball
            MsgBox(0, 'Running', 'Ball has started') ; Tell user Ball started
        Case $msg = $stop
            WinKill ('')    ; Stop Ball
            MsgBox(0, 'Stopped', 'Ball has been terminated') ; Tell user ball stopped
        Case $msg = $hide
            GUISetState(@SW_HIDE)
                If $hidden = "yes" Then
        Sleep (10)
    Else
        Global $title = WinGetTitle("")
            MsgBox(64, "Hidden", "Window is now hidden from view!" )    ; Msg now hidden
    EndIf
    EndSelect
Wend

Now I need to kill the desktop ball, which is ran externally, and needs the command where WinKill is, and then also the hotkey to show the GUI again.

Share this post


Link to post
Share on other sites

Its ok, I now got the windo hiding, now I need to know how to make end the program.

$iPID = ProcessExists('Some.exe')
If WinGetProcess('SomeTitle/Handle') = $iPID Then ProcessClose($iPID)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I don't think you want the {} around it.

Send("^!e")

Did you write the ball program? If so, why can't you add closing functions to it directly?

And last of all, they are not services. Just because an application has no visible interface, it does not become a service. Services run behind the user, sometimes even without the user logged in. They require more complex startup and shutdown code, so please stop calling regular programs services.

Edited by Mr Icekirby

Share this post


Link to post
Share on other sites

Thanks Sm0ke_N but the desktop ball doesnt have a title, and it runs as a service but creates the ball.

There's ways around that as well... I'm not assuming this is your program you are shutting down, or if conditions are met, it's just as easy to use "Exit" and I don't want to assume that you didn't know that (benefit of the doubt).

The way around the title is using Opt('WinTitleMatchMode', 4) and classname=


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Ahh right, I thought I did need them.

Yes I did write the ball program. There is a closing function, but the GUI also needs to be able to close it.

When I press CTRL+ALT+Del, I have to goto services.

Share this post


Link to post
Share on other sites

Ahh right, I thought I did need them.

Yes I did write the ball program. There is a closing function, but the GUI also needs to be able to close it.

When I press CTRL+ALT+Del, I have to goto services.

HotKeySet('^!e', '_ExitNow')
While 1
    Sleep(100)
WEnd

Func _ExitNow()
    Exit -1
EndFunc
Problem solved.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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