star2 Posted January 24, 2008 Posted January 24, 2008 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]
smashly Posted January 24, 2008 Posted January 24, 2008 Hi, I used notepad as the example for the reg add or remove..etc..expandcollapse popup#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
star2 Posted January 26, 2008 Posted January 26, 2008 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]
star2 Posted January 27, 2008 Posted January 27, 2008 (edited) 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 January 27, 2008 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]
star2 Posted January 27, 2008 Posted January 27, 2008 oh...and all along i thought it was only for files, and files alone...thanks alot! you're welcomeat this point your best friend is the Autoit Help file and the Autoit Forum Searchsearch 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]
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