Sign in to follow this  
Followers 0
behdadsoft

Remove Script Paused

13 posts in this topic

Hi.

I want Remove or hide Script Paused when right click on icon in taskbar.mean only exist Exit button.how can do it?

 

post-84063-0-12424100-1414703165.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Opt("TrayMenuMode", 1)

Edit: sorry this will not set a default menu but play with it. See also TrayItemDelete maybe

Edited by AutID

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Partial solution:

Opt("TrayAutoPause",0)

For removing use:

Opt("TrayMenuMode",1) ; no default menu (Paused/Exit)

If you want your own tray menu items then use

TrayCreateItem()

TraySetState()

TraySetClick()

and in main loop use TrayGetMsg()

You can look here at my Frame example using it

'?do=embed' frameborder='0' data-embedContent>>

Edited by Zedna
1 person likes this

Share this post


Link to post
Share on other sites

Thanks. I create a Function that create tray Item but there is a Problem, that when run script and right click on tray icon do't show any thing. Please Guide Me.

#RequireAdmin
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>

Opt("TrayMenuMode",3) ; no default menu (Paused/Exit)

; Functions
Example ()
_CreateTrayItem ()

Func Example ()

$GUI = GUICreate ("Autoit")
GUISetState(@SW_SHOW, $GUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

   ; Delete the previous GUI and all controls.
   GUIDelete($GUI)

  EndFunc

 ; Function for Create custom Tray Item
 Func _CreateTrayItem ()

   Local $TrayExit = TrayCreateItem ("Exit", -1, -1, 1)
   TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.

   While 1
      Switch TrayGetMsg()
         Case $TrayExit
            GUIDelete ()
            ExitLoop
      EndSwitch
   WEnd

EndFunc

Share this post


Link to post
Share on other sites

That's because the function Example is stuck in an endless loop and the CreateTrayItem function never gets run until you exit the GUI.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

how can fix it?

i'm Weak in loop and array. :(

Edited by behdadsoft

Share this post


Link to post
Share on other sites

i'm Weak in loop and array

 

This has more to do with GUI management.  You should read the GUI Management section in the Help file and Wiki.

kylomas   


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

 

This has more to do with GUI management.  You should read the GUI Management section in the Help file and Wiki.

 

OK, but now I need fix it.

Share this post


Link to post
Share on other sites

#RequireAdmin
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>

Opt("TrayMenuMode", 3) ; no default menu (Paused/Exit)

; Functions
Example()

Func Example()

    $GUI = GUICreate("Autoit")
    GUISetState(@SW_SHOW, $GUI)
    Local $TrayExit = TrayCreateItem("Exit", -1, -1, 1)
    TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
        Switch TrayGetMsg()
            Case $TrayExit
                GUIDelete()
                ExitLoop
        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($GUI)

EndFunc   ;==>Example

Use one While loop, check for both GUI and Tray messages within it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thanks BrewManNH :)

Share this post


Link to post
Share on other sites

Is there a way to just have Exit with no Pause?

Or a way to hide pause?

Pause often confuses people who use my scripts

 

What's wrong with the already presented solutions?

Share this post


Link to post
Share on other sites

Chimaera,

As far as I know you have both the default items or neither - but it is simple to add your own "Exit" trayitem: :)

#include <GUIConstantsEx.au3>

Opt("TrayMenuMode", 1)

$cTrayExit = TrayCreateItem("Exit")

$hGUI = GUICreate("Test", 500, 500)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    Switch TrayGetMsg()
        Case $cTrayExit
            Exit
    EndSwitch
WEnd
Or, as I usually prefer: ;)

#include <GUIConstantsEx.au3>

Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)

$cTrayExit = TrayCreateItem("Exit")
TrayItemSetOnEvent($cTrayExit, "_Exit")

$hGUI = GUICreate("Test", 500, 500)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Exit()
    Exit
EndFunc
M23
1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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