Jump to content

Desktop Add-on


Nova
 Share

Recommended Posts

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 !

#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 by nova
Link to comment
Share on other sites

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...!!!! :idiot::D

Edited by layer
FootbaG
Link to comment
Share on other sites

@layer

Opt("TrayIconHide", 1)

Hides the AutoIt tray icon. Note: The icon will still initially appear ~750 milliseconds

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 ! :idiot:

Link to comment
Share on other sites

  • Developers

@layer

Opt("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 ! :idiot:

<{POST_SNAPBACK}>

debate is Done/Finished/Over: POST

Updated:

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

Link to comment
Share on other sites

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 :idiot:

Edited by nova
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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 :D

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 :idiot:

Just in case the exit script hotkey is to someones likeing heres the code including it

#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 by nova
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

No prob id be more than happy to help ! :idiot:

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

#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

#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 by nova
Link to comment
Share on other sites

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 out

Woops, your right I completely over looked that :D

Try this :idiot:

#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 :lol:

Edited by nova
Link to comment
Share on other sites

Huge help...thanks a ton Nova

No 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 :idiot: ,

plus its always good to see something that u created adapted/advanced by others !

Edited by nova
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...