Nova Posted December 3, 2004 Posted December 3, 2004 (edited) This is just a cool looking menu Idea I threw together when I woz bored earlier in the week ! Its for anyone intrested in making their own custom Gui's. Give focus to ur destop and press ESC to open the menu ! expandcollapse popup#include <GUIConstants.au3> Opt("TrayIconHide", 1) Opt("GuiOnEventMode", 1) $GuiWidth = 300 $GuiHeight = 500 $xPos = (@DesktopWidth) $yPos = (@DesktopHeight - $GuiHeight) / 2 ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetState() HotKeySet("{Esc}","Menu_Open") While 1 Sleep(10) WEnd ;Functions Func Menu_Open () $GuiWidth = 300 $xPos = (@DesktopWidth) HotKeySet("{Esc}","None") While $xPos > (@DesktopWidth - $GuiWidth) $xPos = $xPos - 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Close") EndFunc Func Menu_Close () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Open") EndFunc Func None () EndFunc Heres an edited screenshot of my current Gui ! I use it to automate remote desktop connections and netcat sessions on my home network. Pressing the buttons with a command line icon gives me a remote cmd prompt ! Pressing the buttons with a system icon starts a remote desktop connection ! The button icon changes according to the status of the computer they represent if the computer is on the icons are green if its off the icons are red ! The icons refresh when u open or close the menu ! Edited December 3, 2004 by nova
layer Posted December 3, 2004 Posted December 3, 2004 (edited) wow, thats cool! im definatley using it =P EDIT: it could also save space on your desktop instead of all of the icons! im excited to use it =P Edited December 3, 2004 by layer FootbaG
layer Posted December 3, 2004 Posted December 3, 2004 (edited) also... one more thing, sorry, how do you make the tray icon go away, like you did in this script??? i looked up this command TrayIconHide except it said something about it will initially appear ~750 milliseconds... whats that about? so how do you do it? EDIT: im a tard!!!!! its in the begginging of the script... sorry...!!!! Edited December 3, 2004 by layer FootbaG
Nova Posted December 4, 2004 Author Posted December 4, 2004 @layerOpt("TrayIconHide", 1)Hides the AutoIt tray icon. Note: The icon will still initially appear ~750 millisecondsThere is curently a debate in progress on the topic of changing this command so that the icon never appears.Cheers for the support man,glad u like it, im curently working on an update as we speak !
Developers Jos Posted December 4, 2004 Developers Posted December 4, 2004 @layerOpt("TrayIconHide", 1)There is curently a debate in progress on the topic of changing this command so that the icon never appears.Cheers for the support man,glad u like it, im curently working on an update as we speak ! <{POST_SNAPBACK}>debate is Done/Finished/Over: POSTUpdated:- Default function parameters (Ta JP)- StringSplit now accepts full string delimiters too (Ta Nutster)- The directive #NoTrayIcon stops the icon from initially being shown (I wanted to do it by checking for a Opt() command at the top of the script but "top" of the script is meaningless when you have GuiConstants and all sorts) 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.
PerryRaptor Posted December 5, 2004 Posted December 5, 2004 Nova, How did you set the background color to black for the entire menu?
Nova Posted December 5, 2004 Author Posted December 5, 2004 (edited) You can do it with GUISetBkColor (000000) like this ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetBkColor (000000) GUISetState() But in the screenshot that I posted , I actually have a picture set as the gui's background ,which has a white border and a black background ! You can set an image for ur gui's background likt this ! ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) $Background = GUICtrlCreatePic("C:\Background.bmp", 0, 0, 300, 500, $GUI_DISABLE) GUISetState() Where Background.bmp is the image that u want as ur Gui's background Im glad that there are at least a few people making some use of my code Edited December 5, 2004 by nova
PerryRaptor Posted December 5, 2004 Posted December 5, 2004 Never mind...I figured it out! I used MS Access to give me the decimal equivalent of the colors I wanted to use. Then I used the Numerical program, posted here in the forum, to convert the number to Hex.
PerryRaptor Posted December 5, 2004 Posted December 5, 2004 Isn't "GUISetBkColor (000000)" the same as "GUISetBkColor (0)" ? Cool idea to create a *.bmp picture file to fill it in. One could produce a rainbow effect that way...
Wolvereness Posted December 5, 2004 Posted December 5, 2004 Your script for some reason becomes none responsive when the icon is under hide mode. Also, after i took out the hide mode it worked perfectly... Lastly, add a hotkey to EXIT when you don't have an icon to close the program out! (Don't take this as yelling or angry, but i had trouble and couldn't find alternative means of language to portray my particular opinion in this situation of direct criticism) Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]
Nova Posted December 6, 2004 Author Posted December 6, 2004 (edited) Opt("TrayIconHide", 1)This dosent effect the running of my script on my machine !Has anyone else had a problem with this or is it just Wolvereness ?Add a hotkey to EXIT when you don't have an icon to close the program out!In the edited version of the above script which I use, I simple didnt want there to be a hotkey for exiting the script, seeing as its a desktop addon,so I forgot to add an exit hotkey before posting the general code Ur rite though I should have posted an exit hotkey in the source above. Seeing as I posted the code so ppl could edit it to their likeing, for what ever purposes they deemed fit !Seriously thank u for the constructive criticism <I feel its the best way to learn>,plz keep it coming Just in case the exit script hotkey is to someones likeing heres the code including it expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Opt("GuiOnEventMode", 1) $GuiWidth = 300 $GuiHeight = 500 $xPos = (@DesktopWidth) $yPos = (@DesktopHeight - $GuiHeight) / 2 ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetState() HotKeySet("{Esc}","Menu_Open") HotKeySet("{End}","Terminate") While 1 Sleep(10) WEnd ;Functions Func Menu_Open () $GuiWidth = 300 $xPos = (@DesktopWidth) HotKeySet("{Esc}","None") While $xPos > (@DesktopWidth - $GuiWidth) $xPos = $xPos - 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Close") EndFunc Func Menu_Close () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Open") EndFunc Func None () EndFunc Func Terminate () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend exit 0 EndFunc-Ive removed Opt("TrayIconHide", 1) and ive added new #NoTrayIcon in its place <You need the newest beta version of autoitv3 for this> -Added hotkey End which closes the menu and then exits the script Edited December 6, 2004 by nova
Nova Posted December 6, 2004 Author Posted December 6, 2004 @ killaz219Sry I never answered ur question sleep 0Seems pointless rite ? I left that there so people could add time, if they felt the menu opened and closed 2 fast !
PerryRaptor Posted December 7, 2004 Posted December 7, 2004 I know this isn't the support area of the forum, but I need some help figuring out how to put some captions and buttons on Nova's menu... I've tried three different approaches with nothing in return. Well, I've opened notepad 1067 times and can kill the execution. Still no visable captions or buttons...not even for 1/2 a second.
Nova Posted December 7, 2004 Author Posted December 7, 2004 (edited) No prob id be more than happy to help ! Heres an example with a simple button same code as above adcept ive added the lines $ButtonA = GUICtrlCreateButton ( "ButtonA", 150, 175 ,50 ,50) GUICtrlSetOnEvent($ButtonA, "ButtonA_Pressed") GUISetState() and ive added the function Func ButtonA_Pressed() MsgBox(4096,"Novacontrol", "ButtonA pressed") EndFunc expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Opt("GuiOnEventMode", 1) $GuiWidth = 300 $GuiHeight = 500 $xPos = (@DesktopWidth) $yPos = (@DesktopHeight - $GuiHeight) / 2 ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetState() ;ButtonA $ButtonA = GUICtrlCreateButton ( "ButtonA", 150, 175 ,50 ,50) GUICtrlSetOnEvent($ButtonA, "ButtonA_Pressed") GUISetState() HotKeySet("{Esc}","Menu_Open") HotKeySet("{End}","Terminate") While 1 Sleep(10) WEnd ;Functions Func Menu_Open () $GuiWidth = 300 $xPos = (@DesktopWidth) HotKeySet("{Esc}","None") While $xPos > (@DesktopWidth - $GuiWidth) $xPos = $xPos - 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Close") EndFunc Func Menu_Close () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Open") EndFunc Func None () EndFunc Func ButtonA_Pressed() MsgBox(4096,"Novacontrol", "ButtonA pressed") EndFunc Func Terminate () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend exit 0 EndFunc If u want to add and icon for ur button try GUICtrlSetImage ( $Button_1A, "C:\Icons\icon.ico" ) Change C:\Icons\icon.ico to what u want ur icon to be Heres an example expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Opt("GuiOnEventMode", 1) $GuiWidth = 300 $GuiHeight = 500 $xPos = (@DesktopWidth) $yPos = (@DesktopHeight - $GuiHeight) / 2 ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetState() ;ButtonA $ButtonA = GUICtrlCreateButton ( "ButtonA", 150, 175 ,50 ,50) GUICtrlSetOnEvent($ButtonA, "ButtonA_Pressed") GUICtrlSetImage ( $Button_1A, "C:\Icons\ButtonA.ico" ) GUISetState() HotKeySet("{Esc}","Menu_Open") HotKeySet("{End}","Terminate") While 1 Sleep(10) WEnd ;Functions Func Menu_Open () $GuiWidth = 300 $xPos = (@DesktopWidth) HotKeySet("{Esc}","None") While $xPos > (@DesktopWidth - $GuiWidth) $xPos = $xPos - 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Close") EndFunc Func Menu_Close () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Open") EndFunc Func None () EndFunc Func ButtonA_Pressed() MsgBox(4096,"Novacontrol", "ButtonA pressed") EndFunc Func Terminate () $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend exit 0 EndFunc Hope this helps ! Edited December 7, 2004 by nova
killaz219 Posted December 8, 2004 Posted December 8, 2004 (edited) One thing, when you have it hidden and terminate it. The menu comes back out and then goes in to exit. Maybe you can do like a if $isshowing = 1 then and you can prolly figure it out Edited December 8, 2004 by killaz219
Nova Posted December 8, 2004 Author Posted December 8, 2004 (edited) One thing, when you have it hidden and terminate it. The menu comes back out and then goes in to exit. Maybe you can do like a CODEif $isshowing = 1 thenand you can prolly figure it outWoops, your right I completely over looked that Try this expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> Opt("GuiOnEventMode", 1) $Menupos = 1 $GuiWidth = 300 $GuiHeight = 500 $xPos = (@DesktopWidth) $yPos = (@DesktopHeight - $GuiHeight) / 2 ;Main Gui $Gui = GUICreate("Gui", 300, 500, $xPos, $yPos, $WS_POPUP, $WS_EX_TOOLWINDOW) GUISetState() HotKeySet("{Esc}","Menu_Open") HotKeySet("{End}","Terminate") While 1 Sleep(10) WEnd ;Functions Func Menu_Open () $Menupos = 2 $GuiWidth = 300 $xPos = (@DesktopWidth) HotKeySet("{Esc}","None") While $xPos > (@DesktopWidth - $GuiWidth) $xPos = $xPos - 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Close") EndFunc Func Menu_Close () $Menupos = 1 $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend HotKeySet("{Esc}" , "Menu_Open") EndFunc Func None () EndFunc Func Terminate () If $Menupos = 1 Then Else $GuiWidth = 300 $xPos = (@DesktopWidth - $GuiWidth) HotKeySet("{Esc}","None") While $xPos < (@DesktopWidth) $xPos = $xPos + 2 WinMove("Gui", "", $xPos, $yPos, 300, 500) Sleep (0) Wend EndIf Exit 0 EndFunc-Added $Menupos set to (1 when menu is closed) and set to (2 when menu is opened)-Added (If, then, else, endif) statement to Func Terminate () Enjoy Edited December 8, 2004 by nova
Nova Posted December 10, 2004 Author Posted December 10, 2004 (edited) Huge help...thanks a ton NovaNo problem at all man, if you have any other questions/problems plz do ask I get a kick out of figuring this kinda stuff out , plus its always good to see something that u created adapted/advanced by others ! Edited December 10, 2004 by nova
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