Jump to content

Recommended Posts

hi, all.

I am new to autoit, but  I find it quite useful to my usual work.

recently, I create a form, and add some frequent web links to that form.

I convert that form to exe program, and set it "always on top" on my windows deskotp.

i want to add other functions.

1、when I click to form's close button, it will not exit but minimize to the system tray.

2、when I pull the form to the edge of the screen, it will auto hide, when the mouse move to that edge, it can display.

3、when I click system tray icon of that form, it will show me the "exit" but no “Script paused“ menu.

4、finally, i want to add function like windows explorer, but how to make the "arrow" or "cross".

Attachment is the code, and the screenshot.







Link to post
Share on other sites

Lucky i had a script with similar requirements already written, so i could copy&paste few lines into it:

#include <TrayConstants.au3>
#include <GUIConstantsEx.au3>
#include "GUIHyperLink.au3"
#include <WindowsConstants.au3>
Opt("TrayIconHide", 0)
Opt("TrayMenuMode", 11)
Opt("TrayOnEventMode", 0)
$hGUI = GUICreate("Access2Web", 200, 250, -1, -1, $WS_EX_LAYERED, $WS_EX_TOOLWINDOW)
$tLable = GUICtrlCreateLabel("Access2Web", 10, 10, 60, 15)
WinSetOnTop($hGUI, "", 1)
Global $GUIVISIBLE = 1 ;Set the initial state of the gui

Global $idExit = TrayCreateItem("Exit")

$SingleClickOpen = 1 ; Set to 1 to open the gui with 1 click on the tray, 0 for doubleclick

If $SingleClickOpen = 0 Then

$nAutoItScript_Com_HyperLink = _GUICtrlHyperLink_Create("Google", 25, 35, 155, 15, 0x0000FF, 0x551A8B, _
         -1, 'www.google.com', 'Visit: www.google.com', $hGUI)
$nAutoItScript_Com_HyperLink = _GUICtrlHyperLink_Create("Google1", 25, 65, 155, 15, 0x0000FF, 0x551A8B, _
         -1, 'www.google.com', 'Visit: www.google.com', $hGUI)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ;ConsoleWrite("test" & @CRLF) ;debug info
            GUISetState(@SW_HIDE, $hGUI)

    Switch TrayGetMsg()
        Case $idExit
        Case $TRAYCLICK
            If $GUIVISIBLE = 0 Then
                GUISetState(@SW_SHOW, $hGUI)
                $GUIVISIBLE = 1
                GUISetState(@SW_HIDE, $hGUI)
                $GUIVISIBLE = 0

Func _CreatoRLab_ShowInfo($nCtrlID, $h_GUI)
    MsgBox(64, 'Info', 'HyperLink Clicked:' & @CRLF & GUICtrlRead($nCtrlID), 0, $h_GUI)
EndFunc   ;==>_CreatoRLab_ShowInfo

Solved are your 
1.You can single click (changeable to doubleclick) the icon in the tray to open/hide the window.
3. You can click on close to hide the window.

I do not know what you want to do with the 4.

Edited by Dan_555
commented out a debug info line

Some of my script sourcecode

Link to post
Share on other sites
  • 2 weeks later...

Here is what i do, first, when i do not know of a command (well, actually, auto it has so many commands that i must not know them all, just have to know where to read about it !)

Open the autoit-scite editor, paste the line and save it as test.au3

Then place the cursor right before the GuiCtrlCreateTreeView and press f1.

A help file will open. Scroll down, there will be an example file. Click on open this script. It will open in your scite editor and you can  test it.

Some of my script sourcecode

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...