Jump to content
Sign in to follow this  
stuka

deleted

Recommended Posts

stuka

.

Edited by stuka

Share this post


Link to post
Share on other sites
star2

RegRead (your registry key here)
If @error Then
    action -1 (here you put what happens when the key is missing)
Else
    action - 2 (here you put what happens when the key is available)
EndIf


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites
smashly

Hi, I used notepad as the example for the reg add or remove..etc..

#include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1)

Global $CurUserRun = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
Global $ValueName = "Notepad"
Global $Type = "REG_SZ"
Global $Value = @SystemDir & "\notepad.exe"

$Tray1 = TrayCreateItem("Add Notepad To Startup")
$Tray2 = TrayCreateItem("Remove Notepad From Startup")
TrayCreateItem("")
$Tray3 = TrayCreateItem("Launch Notepad")
$Tray4 = TrayCreateItem("Open Explorer @ Notepad Directory")
TrayCreateItem("")
$Tray5 = TrayCreateItem("Exit", -1)
CheckRegistry()
TraySetState()

While 1
    $msg = TrayGetMsg()
    Switch $msg
        Case $Tray1
            RegWrite($CurUserRun, $ValueName, $Type, $Value)
            CheckRegistry()
        Case $Tray2
            RegDelete($CurUserRun, $ValueName)
            CheckRegistry()
        Case $Tray3
            ShellExecute($Value)
        Case $Tray4
            ShellExecute("explorer.exe", "/e," & @SystemDir)
        Case $Tray5
            Exit
    EndSwitch
WEnd

Func CheckRegistry()
    Local $RR = RegRead($CurUserRun, $ValueName)
    If @error Then
        TrayItemSetState($Tray1, $TRAY_ENABLE)
        TrayItemSetState($Tray2, $TRAY_DISABLE)
    Else
        TrayItemSetState($Tray1, $TRAY_DISABLE)
        TrayItemSetState($Tray2, $TRAY_ENABLE)
    EndIf
EndFunc

Cheers

Share this post


Link to post
Share on other sites
star2

any one knows how to open a directory from the tray menu item?

well Smashly already provided you with the example !

from smashly script:

Case $Tray4
            ShellExecute("explorer.exe", "/e," & @SystemDir)

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites
star2

If FileExists ("c:\windows") = 1 Then
    MsgBox (-1, "test", "Dir Exists !!!")
ElseIf FileExists ("c:\windows") = 0 Then
    MsgBox (-1, "test", "Dir Does not Exist !!!")
EndIf

from the help file:

FileExists

--------------------------------------------------------------------------------

Checks if a file or directory exists.

FileExists ( "path" )

Parameters

Path The directory or file to check.

Return Value

Success: Returns 1.

Failure: Returns 0 if path/file does not exist.

Remarks

FileExists returns 0 if you specify a floppy drive which does not contain a disk.

Edited by star2

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


Link to post
Share on other sites
star2

oh...and all along i thought it was only for files, and files alone...thanks alot! :D

you're welcome

at this point your best friend is the Autoit Help file and the Autoit Forum Search

search them a lot and you'll get valuable info.


[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

Share this post


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
Sign in to follow this  

×