Jump to content

If I press a button I want to minimalize my script to the taskbar? - (Moved)


Recommended Posts

Hello Auto It Forum.

I want to minimalize my program to Windows Taskbar if I press a Button, then my program does something and reactivate my window.

(What I mean  Taskbar: https://support.microsoft.com/en-us/help/29280/windows-10-how-to-use-the-taskbar)

My Example code which is works perfectly but it puts the script to the script to the pin bar instead of the of the task bar:

HotKeySet("{Ins}", "ShowGUI")
HotKeySet("{esc}", "_Exit")
#include <Misc.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Clipboard.au3>

#Region Contents ;; which data is contained in the button and assigned into the clipboard
Global $clip1 = "Clip 1"
Global $clip2 = "Clip 2"
Global $clip3 = "Clip 3"
#EndRegion Contents

#Region gui ;; creates gui
Global $Show = False
Global $Form1 = GUICreate("Clipboard Copier", 322, 146, 238, 287)
Global $Button1 = GUICtrlCreateButton($clip1, 16, 16, 283, 25)
Global $Button2 = GUICtrlCreateButton($clip2, 16, 56, 283, 25)
Global $Button3 = GUICtrlCreateButton($clip3, 16, 96, 283, 25)
#EndRegion gui

#Region loop ;; inputs data into clipboard according to button pressed, minimises to tray after pressing button/minimise and hides from taskbar
Local $hDLL = DllOpen("user32.dll")
Sleep(1000)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $vdata = $clip1
            _ClipBoard_SetData($vdata)
            $Show = Not $Show
            GUISetState($Show, $Form1)
        Case $Button2
            $vdata = $clip2
            _ClipBoard_SetData($vdata)
            $Show = Not $Show
            GUISetState($Show, $Form1)
        Case $Button3
            $vdata = $clip3
            _ClipBoard_SetData($vdata)
            $Show = Not $Show
            GUISetState($Show, $Form1)
        Case $GUI_EVENT_MINIMIZE
            $Show = Not $Show
            GUISetState($Show, $Form1)
        DllClose($hDLL)
    EndSwitch
WEnd
#EndRegion loop
#Region Functions ;; Makes Insert key minimize to tray, while hiding from taskbar, and set Esc to close program
Func ShowGUI()
    $Show = Not $Show
    GUISetState($Show, $Form1)
EndFunc   ;==>ShowGUI
Func _Exit()
    Exit
EndFunc   ;==>_Exit
#EndRegion Functions

 

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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