Jump to content

My new tray manager


layer
 Share

Recommended Posts

I just got finished with my new "Tray Manager"... It's not that big, because this is really just what makes it "work". While I left some other features out that I will add into this file in the future. Really, is all this is, is a GUI that opens or closes your drives E: and F: in like 3 different ways.

1. Buttons

2. Hotkeys

3. File>Open or Close

Hope you like it! :)

I uploaded the .EXE, the .au3, the HTML Help, and the Icon.

I origanally had the icon on the GUI but I'm not sure how to install the file inside the .EXE itself. Any suggestions would be nice! :)

EDIT: It's sort of like one of those little Windows programs that comes with your computer...

Edited by layer
FootbaG
Link to comment
Share on other sites

:idiot:

But good as your first script :D

I know the first thing I started was Msgbox() :)

Hey, you could bring some more dynamic to your script with "DriveGetType()".

So you check all letters through from A to Z and check the type and if it is a CDROM then you create a button or hotkey or menuitem with the letter...

As an idea...

So long :(

Holger

:)

-posts: 477

-membernr.: 11 33

-since: 22... ;)

Edited by Holger
Link to comment
Share on other sites

A good Idea!

But, I think there are something you can resolve. In your script, everybody should edit it for its computer, because different computer have different cd-drive. But I think the script can auto research how many cd-drive are there.

just a idea for myself.

Link to comment
Share on other sites

Newbie question...

I'm trying to run the script in au3 format and it errors: Line 28, GUICreate("Tray Manager", 400, 300, -1, -1), Unknown function name.

Even if I run it from the Include folder where there is a copy of GUIConstants.au3

What am I missing?

-Scott

Link to comment
Share on other sites

Make sure you have this code in the au3 file...Just edit the file and replace the old code with this one, it may be the same, but let's just check.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x / NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;    Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Setup some useful options that you may want to turn on - see the helpfile for details.

; Expand all types of variables inside strings
;Opt("ExpandEnvStrings", 1)
;Opt("ExpandVarStrings", 1)

; Require that variables are declared (Dim) before use (helps to eliminate silly mistakes)
;Opt("MustDeclareVars", 1)


; ----------------------------------------------------------------------------
; Script Start - Add your code below here
; ----------------------------------------------------------------------------
#include <GUIConstants.au3>
; Creates the GUI itself.
GUICreate ("Tray Manager", 400, 300, -1, -1)
$file = GUICtrlCreateMenu("&File")
$e1= GUICtrlCreateMenuItem ("&Open E:" & @TAB & "Ctrl+E", $file)
$f1= GUICTRLCREATEMENUITEM ("&Open F:" & @TAB & "Ctrl+F", $file)
$e2= GUICTRLCREATEMENUITEM ("&Close E:" & @TAB & "Ctrl+C", $file)
$f2= GUICTRLCREATEMENUITEM ("&Close F:" & @TAB & "Ctrl+X", $file)
;Creates space so that the "Help" menu will not crop over the "File" menu.
GUICtrlCreateMenuItem ("", $file)
$h= GUICtrlCreateMenu("&Help")
$h1= GUICtrlCreateMenuItem ("&Help", $h)
;Creating the Control Buttons.
$f= GUICtrlCreateButton ("Open Tray F:", 0, 100)
$e= GUICtrlCreateButton ("Open Tray E:", 100, -1)
$fc= GUICtrlCreateButton ("Close Tray F:", 0, 150)
$ec= GUICtrlCreateButton ("Close Tray E:", 100, -1)
;Setting the backround color.
GUISetBkColor (0x00ff00)
; To show the window.
GuiSetState(@SW_SHOW)
; Here the HotKeys are set.
HotKeySet ("^e", "opene")
HotKeySet ("^f", "openf")
HotKeySet ("^c", "closee")
HotKeySet ("^x", "closef")
;All the functions needed.
Func closee ()
   CDTray ("E:", "Close")
EndFunc

Func closef ()
   CDTray ("F:", "Close")
   EndFunc

Func opene ()
    CDTray ("E:", "Open")
 EndFunc 
 
 Func openf ()
    CDTray ("F:", "Open")
 EndFunc

;Wait for any action to take place at anytime; Or the main loop.
While 1
  $get = GUIGetMsg()
  Select
  Case $get = $f 
      CDtray ("F:", "Open")
   Case $get= $e 
      CDtray ("E:", "Open")
   Case $get= $e1 
       opene ()
Case $get= $f1 
    openf ()
 Case $get= $f2
    closef ()
 Case $get= $e2
    closee ()
 Case $get= $fc
    closef ()
 Case $get= $ec
    closee ()
 Case $get= $h1
    MsgBox (0, "Help", "Use the buttons to open or close the trays. Or click 'File'> Open X: or Close X:. X= Cd Tray. If your computer freezes this means you are pressing the buttons to fast. Go see the FileHelp.html file for more detailed explanations.")
Case $get = $GUI_EVENT_CLOSE 
    exitloop
   EndSelect
Wend

If the problem persesits, just post another reply...

**EDIT**: Does the .EXE version work??

Edited by layer
FootbaG
Link to comment
Share on other sites

If the problem persesits, just post another reply...

**EDIT**: Does the .EXE version work??

<{POST_SNAPBACK}>

The exe does work fine. Opens and closes my E drive. F is an old Zip drive.

I replaced all the code in GUIConstants.au3 with the code in your post, now when I try to run the script Win2k spits up "AutoIt has generated errors and will be closed by windows.... log file being created"

The code between the GUIConstants files was dramatically different.

-Scott

Edit: Just noticed a missing #include-once at the top of the GUIConstants code.

So I added it, now when I run I get Error: Line 53, Func closee (), Duplicate function name.

-Scott

Edit: Scratch last edit..I'm an idiot. :)

Brought my GUIConstants.au3 back from my backup.

Replaced all the code in Tray_Manager_beta.au3 with the code in your post.

Now when I run it barks a GUICreate error, and I see that I do not have a GUICreate.au3.

Is the latest GUI stuff available for download somewhere?

-Scott

Edited by Scottswan
Link to comment
Share on other sites

!?!?!?!?! YOU REPLACED the GuiConstants code!?!!?!? I only meant replace the Tray Manger code!!!!!

goto http://www.autoitscript.com/autoit3/files/...UIConstants.au3 and downlaod that and replace that with your gui constants...ONLY IF you replaced the gui constants file...by the way, do you have the unstable version of autoit or do you have the older version?

If you have v3.0.103 then tray manager should work fine...if you have an older version, than thats why it's not working, and thats why only the .exe is working =D

FootbaG
Link to comment
Share on other sites

If you have v3.0.103 then tray manager should work fine...if you have an older version, than thats why it's not working, and thats why only the .exe is working =D

<{POST_SNAPBACK}>

Ah, got it working!

I was using v3.0.102, which I though was the Current version

I didn't know there was a .103 version...

I backtracked from that URL you gave me to find it.

Installed .103 from the exe and now the script works fine.

You must be using something unique to .103...?

Thanks

-Scott

Link to comment
Share on other sites

Nah, it's just the new GUI Functions, trust me, when you see the GUI code it's like "Woah!" But then, you get used to it, at first I just looked at the help file, now I'm pretty god with it.

Good luck!

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