cppman Posted July 5, 2006 Share Posted July 5, 2006 (edited) Welp, I have'nt really done anything In autoit for a while, I thought i'd make something... Application > The programs name. File > Full path to the executable. State > Wether the program is local or global. Running > If the application is running or not. It a simple startup manager and is devided up into Local and Global groups. Global means the program starts for all users on the computer and Local means just you(the current user). expandcollapse popup#include <GUIConstants.au3> #include <GUIListView.au3> Const $Global = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" Const $Local = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" $cForm = GUICreate("Startup Manager", 425, 315, 192, 125) $winListView = GUICtrlCreateListView("Application|File|State|Running?|", 8, 64, 409, 193) ;Application = The Applications executable name ;File = The complete path with parameters to the file ;State = Either Global or Local ;Running = Yes if Running, No if not Running. GUICtrlSetFont(-1, 10, 400, 0, "OCR A Extended") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xD8E4F8) GUICtrlSetCursor ($winlistView, 2) GUICtrlCreateLabel("Startup Manager", 112, 16, 173, 35) GUICtrlSetFont(-1, 20, 400, 0, "Poor Richard") $RemoveButton = GUICtrlCreateButton("Remove Item", 8, 264, 161, 41) $AddButton = GUICtrlCreateButton("Add Item", 256, 264, 161, 41) GUISetState(@SW_SHOW) $count = 0 $countl = 0 $avRegKeysGlobal = GetStartupItems($count, $Global) $avRegKeysLocal = GetStartupItems($countl, $Local) _GUICtrlListViewSetColumnWidth($winListView, 0, 150) _GUICtrlListViewSetColumnWidth($winListView, 1, 150) _GUICtrlListViewSetColumnWidth($winListView, 2, 150) _GUICtrlListViewSetColumnWidth($winListView, 3, 150) ;Get the Global Startup Items For $i = 1 to $count $curKey = $avRegKeysGlobal[$i] if $curKey = "" then ExitLoop $value = RegRead($Global, $curKey) if ProcessExists($curKey & ".exe") Then $state = "Yes" Else $state = "No" EndIf GUICtrlCreateListViewItem($curKey & "|" & RegRead($Global, $CurKey) & "|" & "Global" & "|" & $state, $winListView) Next For $i = 1 to $countl $curKey = $avRegKeysLocal[$i] if $curKey = "" then ExitLoop $value = RegRead($Local, $curKey) if ProcessExists($curKey & ".exe") Then $state = "Yes" Else $state = "No" EndIf GUICtrlCreateListViewItem($curKey & "|" & RegRead($Local, $CurKey) & "|" & "Local" & "|" & $state, $winListView) Next While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE $rval = MsgBox(4, "Are you sure?", "Are you sure you'd like to exit?") if $rval = 6 Then Exit Case $msg = $RemoveButton $curIndex = _GUICtrlListViewGetCurSel($winListView) $rval = MsgBox(4, "Are you sure?", "This will remove this entry from the startup." & @CRLF & " Are you sure you wish to continue?") if $rval = 6 Then $str = _GUICtrlListViewGetItemText($winlistView, $curIndex) $wow = StringSplit($str, "|") $str = _GUICtrlListViewGetItemText($winListView, $curIndex) $wow1 = stringsplit($str, "|") if $wow1 = "Global" Then RegDelete($Global, $wow[1]) Else RegDelete($Local, $wow[1]) EndIf _GUICtrlListViewDeleteItem($winListView, $curIndex) _ListViewUpdate() Else EndIf ;//Delete Registry Item & Update win Control Case $msg = $AddButton $f = FileOpenDialog("Choose File...", "", "Executable (*.exe)") if $f <> "" Then AddStartup($f) _ListViewUpdate() Else EndIf EndSelect WEnd Func _ListViewUpdate() _GUICtrlListViewDeleteAllItems($winListView) $count = 0 $countl = 0 $avRegKeysGlobal = GetStartupItems($count, $Global) $avRegKeysLocal = GetStartupItems($countl, $Local) For $i = 1 to $count $curKey = $avRegKeysGlobal[$i] if $curKey = "" then ExitLoop $value = RegRead($Global, $curKey) if ProcessExists($curKey & ".exe") Then $state = "Yes" Else $state = "No" EndIf GUICtrlCreateListViewItem($curKey & "|" & RegRead($Global, $CurKey) & "|" & "Global" & "|" & $state, $winListView) Next For $i = 1 to $countl $curKey = $avRegKeysLocal[$i] if $curKey = "" then ExitLoop $value = RegRead($Local, $curKey) if ProcessExists($curKey & ".exe") Then $state = "Yes" Else $state = "No" EndIf GUICtrlCreateListViewItem($curKey & "|" & RegRead($Local, $CurKey) & "|" & "Local" & "|" & $state, $winListView) Next ;//Refresh the control EndFunc Func GetStartupItems(byRef $iCount, $regloc) ;//Returns array of startup items ;Read registry items into an array ;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run dim $avKeys[1] For $i = 1 to 100 ;a somewhat high reasonable amount. $curVal = RegEnumVal($regloc, $i) if @error = -1 then $iCount = $i - 1 Return $avKeys EndIf _ArrayAdd($avKeys, $curVal) Next return $avKeys EndFunc Func AddStartup($File) ;// Type = Local/Global, RegKey = Registry Key, RegVal = Registry Key Value $RegType = $Local $str = StringSplit($File, "\") $string = StringSplit($str[$str[0]], ".") $filename = $string[1] $extension = $string[2] RegWrite($Local, $filename, "REG_SZ", $file) EndFunc Edited July 5, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
RazerM Posted July 5, 2006 Share Posted July 5, 2006 (edited) Found a bug: if $rval = 6 Then Exit Else ContinueCase EndIfoÝ÷ Ù¼®²)à í{ «Ö¬ÈÊ°j{m¢·¦¢÷+Úò~º&²Ö«¶êl¢ë¶¬{-y§ZºÚ"µÍY ÌÍÜ[H [^] edit: other than that it works great Edited July 5, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
cppman Posted July 5, 2006 Author Share Posted July 5, 2006 (edited) ah. thx for pointing that out. Edited July 5, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
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