Fire Posted December 12, 2009 Share Posted December 12, 2009 (edited) Hi to all.I want share my script with autoitscript community.I`m not coder in AUTOIT but i really love it.This script for view/delete/add Autostart entries on win32 OS XP.I`m really sorry for grammatical mistakes.My english very awfull.I want to say Great Thanks to this users for help me in my question(mistakes):Melba23,PsaltyDs,Mobius,Mat and to all Autoit DEV & MVP.Pliz note that before delete any entry from your startup backup your regedit then do what you want.Programm interface:Please note that in GUI interface some *.icons reguired for display it in GUI here isall binary package:(7z file (include script.au3+icons+binary)You can download it from here:Download it from here.and who afraid use binary script is free use.Just modify it and use for your needs:expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=beta #AutoIt3Wrapper_icon=H:\local---new_icon240000000039.rwx-rwx--r owner---root\1034.ico #AutoIt3Wrapper_outfile=..\sasa.exe #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <GUIListBox.au3> #include <GuiListView.au3> Local $SS_NOTIFY,$WS_GROUP,$Icon2,$Icon1,$pathopendialog,$path #Region ### START Koda GUI section ### Form=j:\autoit\msconfig\form1.kxf $Form1_1 = GUICreate("Show me What in My AutoStart", 1053, 766, 191, 135) GUISetBkColor(0x000000) $goster ="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run " $List1 = GUICtrlCreateListView("Regedit KEY" &"|" & "Name" & "|" & "Entry", 16, 48, 1017, 422) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") _GUICtrlListView_SetBkColor($List1,0x000000) GUICtrlSetTip(-1, "This Entries Was found on your Autostart","About Finded Items","1",2) GUICtrlSetCursor (-1, 0) $Button1 = GUICtrlCreateButton("Scan Autostart", 24, 496, 161, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetTip(-1, "Scan & Refresh Your Autostart"," ","1",2) GUICtrlSetCursor (-1, 0) $Button2 = GUICtrlCreateButton("Delete Selected Entry", 728, 496, 169, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetTip(-1, "Remove Selected Entry From Regedit!"," ", "",2) GUICtrlSetCursor (-1, 0) $Group1 = GUICtrlCreateGroup("", 0, 528, 1049, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label1 = GUICtrlCreateLabel("Add To Autostart", 408, 560, 170, 27) GUICtrlSetFont(-1, 12, 800, 2, "Arial Black") GUICtrlSetColor(-1, 0xFF0000) $Label2 = GUICtrlCreateLabel("Path To *.exe", 24, 608, 98, 19) GUICtrlSetFont(-1, 8, 800, 0, "Arial Black") GUICtrlSetColor(-1, 0xFF0000) $Label3 = GUICtrlCreateLabel("Apply User Defined Name (Autostart Entry Name)", 16, 656, 346, 19) GUICtrlSetFont(-1, 8, 800, 0, "Arial Black") GUICtrlSetColor(-1, 0xFF0000) $userdefname=GUICtrlCreateInput("", 400, 648, 177, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Checkbox1 = GUICtrlCreateCheckbox("Activate This Function", 680, 648, 121, 17) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetCursor (-1, 0) $Checkbox2 = GUICtrlCreateCheckbox("Activate", 928, 504, 73, 17) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1, "For Delete Entries This Checkbox must be checked!","If You want delete selected Entries From Regedit Activate This Checkbox","1",2) GUICtrlSetCursor (-1, 0) $Button3 = GUICtrlCreateButton("Add It Now!", 40, 712, 169, 25, 0) GUICtrlSetCursor (-1, 0) $Button4 = GUICtrlCreateButton("Exit", 816, 712, 161, 25, 0) GUICtrlSetCursor (-1, 0) $Button6 = GUICtrlCreateButton("Choose File", 400, 600, 177, 25, 0) ;faylin secilmesi duymesi. $Button5 = GUICtrlCreateButton("About", 400, 712, 169, 25, 0) GUICtrlSetCursor (-1, 14) $Label4 = GUICtrlCreateLabel("Show Me What in My AutoStart", 224, 0, 570, 49) GUICtrlSetFont(-1, 24, 800, 0, "Arial Black") GUICtrlSetColor(-1, 0xFF0000) $showpath = GUICtrlCreateInput("", 192, 600, 185, 21) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox2 if BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then $Icon1 = GUICtrlCreateIcon(@ScriptDir&"\data\data.ico", 0, 1016, 504, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP)) ;path icona geden. Checked Ikonu ucun. GUICtrlSetState($Button2,$GUI_ENABLE) Else GUICtrlDelete($Icon1) GUICtrlSetState($Button2,$GUI_DISABLE) EndIf Case $Button4 DllCall("kernel32.dll", "ptr","ExitProcess") Case $Button1 ;if FileGetSize("data\data.ico") =2550 Then _GUICtrlListView_DeleteAllItems($List1) $Icon2 = GUICtrlCreateIcon(@ScriptDir&"\data\refresh.ico", 0, 208, 504, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP)) ;refresh ikonu GUICtrlSetState($Button1,$GUI_DISABLE) Sleep(2500) GUICtrlDelete($Icon2) $mystateforBUTTON2= GUICtrlGetState($Button2) GUICtrlDelete($Icon2) GUICtrlSetState($Button1,$GUI_ENABLE) GUICtrlSetState($Button2,$mystateforBUTTON2) for $i =1 to 20 $a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i) $b = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $a) if $a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i) Then $c = StringReplace($a, "Дополнительные данные отсутствуют.", "") ;I`m sorry.This is for ru based OS. If your OS is another please add it. $d = StringReplace($c, @CRLF, "") if $d ="" Then GUICtrlCreateListViewItem("|" & $d & "|" & $b, $List1) Else GUICtrlCreateListViewItem($goster & "|" & $d & "|" & $b, $List1) GUICtrlSetColor(-1, 0xFF0000) EndIf EndIf Next Case $Button2 $deleteItem = _GUICtrlListView_GetSelectedIndices(GUICtrlRead($List1)) $selecteditem = GUICtrlRead($List1) if $selecteditem ="0" Then MsgBox(64,"No Line Selected!", "No Line Selected") Else $op=_GUICtrlListView_GetSelectedIndices($List1) $HotItem = $op local $HotItem1 = _GUICtrlListView_GetItemText(GUICtrlGetHandle($List1),$op,1) if @UserName = IsAdmin() Then MsgBox(64, "No Enough Privelegies!", "You have no Administrative Privelegies For delete=> " & $HotItem1 & "<= from regedit") Else RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",$HotItem1) MsgBox(64, "Removed Successfully From Regedit ",$HotItem1 & "<=Successfully Removed From Regedit!") EndIf EndIf Case $Checkbox1 if BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then GUICtrlSetState($userdefname,$GUI_ENABLE) GUICtrlSetData($userdefname,"") Else GUICtrlSetData($userdefname,"") GUICtrlSetState($userdefname,$GUI_DISABLE) EndIf Case $Button6 $pathopendialog=FileOpenDialog("Choose Your File",@ScriptFullPath,"All Files(*.*)") $path=FileGetLongName($pathopendialog) ;long da problem yaradirdi. @scriptdir istifade etdim fixlendi. GUICtrlSetData($showpath,$path) GUICtrlSetState($showpath,$GUI_ENABLE) GUICtrlSetTip($showpath,$path,$path,"1",2) Case $Button3 if guictrlread($userdefname) ="" Then MsgBox(64, "Specify Valid Name!", "Specify correct Name for Entry Name which will be added with same name!") Else if $path="" Then MsgBox(64, "Incorrect Path!", "Enter Valid Path!") Else if @UserName = IsAdmin() Then ;checking for user permissions again MsgBox(64, "You Have No Administrative Privelegies!", "You have No Administrative Privelegies!" & @CRLF & "Please Log in with Admin Privelegies and Try again!") ExitLoop Else run("cmd.exe /c reg add " &$goster & "/v " & guictrlread($userdefname) & " /d " & $path, "", @sw_hide) Run("cmd.exe /c tskill reg", "", @SW_HIDE) Run("cmd.exe /c tskill cmd", "", @SW_HIDE) _GUICtrlListView_DeleteAllItems($List1) EndIf for $i =1 to 20 $a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i) $b = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $a) if $a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i) Then $c = StringReplace($a, "Дополнительные данные отсутствуют.", "") $d = StringReplace($c, @CRLF, "") if $d ="" Then GUICtrlCreateListViewItem("|" & $d & "|" & $b, $List1) Else GUICtrlCreateListViewItem($goster & "|" & $d & "|" & $b, $List1) GUICtrlSetColor(-1, 0xFF0000) EndIf EndIf Next MsgBox(64, "Sucessfully Added To your Registry.",$path & " was successfully added to your AutoStart with name => " & guictrlread($userdefname)) EndIf EndIf Case $Button5 MsgBox(64, "Coded In AutoitScript!", "This Programm was coded in SO Wonderfull language => AUTOIT!" & @CRLF & "Thanks for Support To MY Friends!" & @CRlf & "Mat,PSALTYDS,MELBA23,MOBIUS,MariusN and etc. 13.12.2k9") EndSwitch WEnd Edited December 12, 2009 by Sh3llC043r [size="5"] [/size] Link to comment Share on other sites More sharing options...
GEOSoft Posted December 12, 2009 Share Posted December 12, 2009 I won't be testing it today, and I probably won't do so because I hate looking at red on black, but here is some food for thought. I started working on a script to change the order that various apps are loaded at startup. I haven't done anything with it for a few weeks now and I'll just give you the principal here. When you open RegEdit and look at the Run key you will see everything in alphabetical order. That is not the order that they are started. They are started in the order that the value was created by date/time. The basic concept (create a backup first) is too enumerate the values to a listview control and then delete them. allow the user to udjust the start up sequence by moving the app up or down in the ListView. Add a "Go" button to re-write all the values. The details are up to you but it will probably be a good addition. Reminder to self. Less time in Example Scripts. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Fire Posted December 13, 2009 Author Share Posted December 13, 2009 Thank you GEOSoft for tips and helps.I just wondering about that the value was created by date/time.Is here any way detect regedit entry in which time it was added to regedit?I`m sorry for this but really but i didnt saw it yet.I`m mad for black&red colors Thanks again for helps. [size="5"] [/size] Link to comment Share on other sites More sharing options...
dmob Posted December 14, 2009 Share Posted December 14, 2009 After a passing glance at your code, it seems like you are enumerating only HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run;there are many more startup locations in the registry. Check out AutoRuns, might help you identify other locations Link to comment Share on other sites More sharing options...
GEOSoft Posted December 14, 2009 Share Posted December 14, 2009 dmob is correct, there are other places you have to check What I was pointing out is this If you look at the registry Run items you will see them as Item A item B Item C Item D If in fact the apps were installed in the order Item D Item B Item A Item C the load order that's used is D-B-A-C NOT A-B-C-D. The registry always lists items in a sorted alpha-numeric order. That's why you will often see things like MRU lists that are listed Alpha-Numeric and then at the bottom you see something like Order with the value data set to dbac or what ever it was. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Fire Posted December 14, 2009 Author Share Posted December 14, 2009 (edited) Hi,Yeah dmob you are right in this.I was add only this regedit key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run for read entries from it.also i think add other startup locations too.But here is may be negative results for OS.For example:(many malicious apps use this key for autostart) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogonfor ex. Like this:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]"Userinit"="C:\\WINDOWS\\system32\\userinit.exe,c:\\a.exe"In fact if user deletes this value "Userinit" from regedit this may cause many problems for OS.IMHO Right ways to do this: 1)edit value 2)delete it and then restore it to standart values.I like the second way.Delete "Userinit"(and analogie startup entries/values too) and then restore it from script to default.(For this values in registry: Userinit,Shell,System and etc.)Now I think it will be clear.Thanks for tip dmob.In next updates i think i`ll include this features + reporting finded result to report.html + add 1 feature if the added startup entry reguire execution with parameters. Yeah George now i understand Thanks you very much i`ll realise it in future in next update may be.Especially Thanks George & dmob.Sorry for awfull English. Edited December 14, 2009 by Sh3llC043r [size="5"] [/size] 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