marcus_tong Posted January 18, 2023 Share Posted January 18, 2023 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. TestFavrioutWeblink.au3 Link to comment Share on other sites More sharing options...
marcus_tong Posted January 18, 2023 Author Share Posted January 18, 2023 sorry for the poor English. Thanks in advance. Link to comment Share on other sites More sharing options...
Dan_555 Posted January 18, 2023 Share Posted January 18, 2023 (edited) Lucky i had a script with similar requirements already written, so i could copy&paste few lines into it: expandcollapse popup#include <TrayConstants.au3> #include <GUIConstantsEx.au3> #include "GUIHyperLink.au3" #include <WindowsConstants.au3> Opt("TrayIconHide", 0) Opt("TrayMenuMode", 11) Opt("TrayOnEventMode", 0) Opt("TrayAutoPause",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") TraySetClick(16) $SingleClickOpen = 1 ; Set to 1 to open the gui with 1 click on the tray, 0 for doubleclick If $SingleClickOpen = 0 Then $TRAYCLICK = $TRAY_EVENT_PRIMARYDOUBLE Else $TRAYCLICK = $TRAY_EVENT_PRIMARYUP EndIf $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) EndSwitch Switch TrayGetMsg() Case $idExit Exit Case $TRAYCLICK If $GUIVISIBLE = 0 Then GUISetState(@SW_SHOW, $hGUI) $GUIVISIBLE = 1 Else GUISetState(@SW_HIDE, $hGUI) $GUIVISIBLE = 0 EndIf EndSwitch WEnd 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 January 18, 2023 by Dan_555 commented out a debug info line Some of my script sourcecode Link to comment Share on other sites More sharing options...
marcus_tong Posted January 31, 2023 Author Share Posted January 31, 2023 thank you Dan_555, your solution is good. solve1 and 3 problem. Link to comment Share on other sites More sharing options...
Dan_555 Posted January 31, 2023 Share Posted January 31, 2023 Hmm, maybe you are searching for this ? Global $idTreeview = GUICtrlCreateTreeView(3, 26, 200, 420, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) Some of my script sourcecode Link to comment Share on other sites More sharing options...
marcus_tong Posted February 1, 2023 Author Share Posted February 1, 2023 20 hours ago, Dan_555 said: Global $idTreeview = GUICtrlCreateTreeView(3, 26, 200, 420, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) sorry Dan_555, i can not understand this command, and i do not know how to apply it. i am new to autoit. thanks. Link to comment Share on other sites More sharing options...
Dan_555 Posted February 1, 2023 Share Posted February 1, 2023 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 comment Share on other sites More sharing options...
marcus_tong Posted February 1, 2023 Author Share Posted February 1, 2023 thanks Dan_555,you help me a lot. after press f1, autoit show me the help about GUICtrlCreateTreeView. i will try to write the code according to the Example. Link to comment Share on other sites More sharing options...
marcus_tong Posted February 3, 2023 Author Share Posted February 3, 2023 On 2/1/2023 at 11:30 PM, Dan_555 said: 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. hi, Dan_555, acording to the page,i tried to write the code, there is quite a lot of command and syntax i do not understand, but efficiently solve my 4 problem. when i click google, it will execute ShellExecute("google.com"). it is perfect. Dan_555 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now