Sign in to follow this  
Followers 0
Beege

Revision Tracker - Track all changes to all scripts

7 posts in this topic

Here is two apps I've been working on to track the changes I make to scripts as I create them. One is for monitoring your script changes, the other is view/restore all the changes that have been made.
 
RevMonitor
RevMonitor works by reciving shell change notifications from windows. For every .au3 file thats within a directory being monitored, 2 files will eventually be created ( as changes happen). One file is a dictionary file that holds all unique lines from the script. The second file is the revisons file that holds all revisons made to the script. A revison entry is a string of line numbers from the dictionary that make up the script. The entry also contains the Date and Time, plus weather it passed au3check at the time. (Date | Au3Check | Revision)
 
For an example take the following script:

#include <array.au3>

Global $aArray1[1]

Func _ShowArray(ByRef $aArray)
    If Not IsArray($aArray) Then Return SetError(1)
    _ArrayDisplay($aArray)
    If @error Then Return SetError(1)
EndFunc

Func _ShowArray2(ByRef $aArray)
    If Not IsArray($aArray) Then Return SetError(1)
    _ArrayDisplay($aArray)
    If @error Then Return SetError(2)
EndFunc

 
The dictionary for the file would look like this:

#include <array.au3>

Global $aArray1[1]
Func _ShowArray(ByRef $aArray)
    If Not IsArray($aArray) Then Return SetError(1)
    _ArrayDisplay($aArray)
    If @error Then Return SetError(1)
EndFunc
Func _ShowArray2(ByRef $aArray)
    If @error Then Return SetError(2)

A entry from the revison file would look like this:

11/29/2013 01:09:23 AM|0|0.1.2.1.1.3.4.5.6.7.1.8.4.5.9.7

 
RevRestore
RevRestore is used for restoring a file. Each dictionary/revison file that gets created for a script being monitored will always get created in a "backup" directory located in the same directory as the script (same way tidy makes backups). To view a revison file, you select the script (not the actual revison file). I wrote it this way to make the revison file easy to open from scite. 
 
To add to SciTE, simply open the users options file (Tools->"Open User Options File") and add something similar to the following lines:

# 45 Open Revisions File
command.45.$(au3)="C:\RevTracker\RevRestore.exe" "$(FilePath)"
command.name.45.$(au3)=Restore Revision
command.shortcut.45.$(au3)=Ctrl+Shift+R

ScreenShots:


screenshot.PNG

popup.PNG

 

Credits - Thank you to all:

Melba23 - Toast, GuiFrame

Ward - QuickLZ

Yashied - Restart

 

Download:

Revision Tracker.html

Note: The .html link is just to help me keep track of downloads. Open the .html file and a download dialog will display. 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Thenks! the RevMonitor.exe working good and detects changes.

but when i want to select the au3 file with RevRestore to restore the changes then i get this error:

Line 21341 (File ''C:Program Files (x86)AutoIt3Rzvision
TrackerCompiIedRevRestore.exe"):

Error: Error parsing function call.

Edited by gil900

Share this post


Link to post
Share on other sites

Thank you gil900. This is corrected now. Please download again and let me know if you still have issues. Thanks

Share this post


Link to post
Share on other sites

Thank you gil900. This is corrected now. Please download again and let me know if you still have issues. Thanks

 
Thank you!

Today i  started to use your tool and it is very good!

Share this post


Link to post
Share on other sites

An interesting idea Beege. I will test this in the next couple of days when I have free time.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I have a project with ~6200 lines and lots of Revs in RevRestore.exe.

when i loading this project in RevRestore.exe then RevRestore works very slowly and each Rev load takes about 7-15 seconds..

it is very slow..

Edited by gil900

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thank you for this tool. Looks really good.

So I downloaded the package, copied compilled .exe files into AutoItRevTracker folder, started RevMonitor.exe, selected the folder where my .au3 files are (tray icon stayed, new RevMon.ini file appeared in AutoItRevTracker folder).

Then opened SciTe, opened User Options file, at the bottom added suggested code and changed one line:

command.45.$(au3)="$(SciteDefaultHome)\..\RevTracker\RevRestore.exe" "$(FilePath)"
changed and saved test.au3 file, hit CTRL+SHIFT+R and received:

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

No Dictionary file found

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

Dictionary file not found:

E:Program FilesAutoItScriptsBackuptest.dic

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

OK

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

I do have ScriptsBackUp folder that I created manually before, but no new files there.

Anything I missed?

Thank you.

[EDIT]

It seems tracker only tracks new created files, saving existing files doesn't work? I've tried copy file content, delete the file, create a new document, paste the content and save it with the same filename as the old file - nothing.

Edited by VAN0

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  
Followers 0

  • Similar Content

    • Queener
      By Queener
      I'm not sure if I'm doing it right or there's a better way to restore windows from hidden in system tray, but if I remove the if statement then it's able to restore the program from system tray, but if I add the if statement then it doesn't restore it. Here's what I gotten so far and the reason why I use the if statement is because #32770 opens many other apps also.

      WinSetState("[CLASS:#32770]", "", @SW_SHOW) If WinExists($title_Pass_Entrance) Then WinWaitActive(WinActivate($title_Pass_Entrance))   ControlSend($title_Pass_Entrance, "", "[CLASS:Edit; INSTANCE:1]", "TempPassword")   ControlClick($title_Pass_Entrance, "", "[CLASS:Button; INSTANCE:2]", "left", 1) EndIf   >>>> Window <<<< Title:    Enter Safe Combination Class:    #32770 Position:    728, 411 Size:    465, 218 Style:    0x94C800C4 ExStyle:    0x00010101 Handle:    0x0000000000050A7A >>>> Control <<<< Class:     Instance:     ClassnameNN:     Name:     Advanced (Class):     ID:     Text:     Position:     Size:     ControlClick Coords:     Style:     ExStyle:     Handle:   
    • Chimaera
      By Chimaera
      Ive had a bit of code from a long time ago and its always worked perfectly until recently
      It creates a restore point of a given name that i choose and i use it when i finalize a customers pc to go back to them.
      the original code was from Venom 007
      Global $CuDate = _Date_Time_GetLocalTime() Global $sRestorePointName = 'Tech_Finish ' & StringTrimRight(_Date_Time_SystemTimeToDateTimeStr($CuDate), 9) Func _CreateRestorePoint($sRestorePointName) ; Author = Venom007 SplashTextOn('Restore Point', 'Creating Restore Point.' & @CRLF & @CRLF & _ 'Please Wait', 300, 90, -1, -1, 18) Local $objSystemRestore $objSystemRestore = ObjGet('winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore') If Not $objSystemRestore.createrestorepoint($sRestorePointName, 0, 100) = 0 Then SetError(1) SplashOff() If Not @error Then SplashTextOn('System Restore', 'System Restore Point Created Successfully.', 300, 45) Sleep(2000) SplashOff() Else SplashTextOn('System Restore Error', 'System Restore Point Was Not Created.', 300, 45) Sleep(2000) SplashOff() EndIf EndFunc ;==>_CreateRestorePoint Just recently now im seeing windows 10 machines it fails at this line im pretty sure
      $objSystemRestore = ObjGet('winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore') Does anyone know what has changed in win 10 to cause this?
    • zvvyt
      By zvvyt
      Hello ya'll!
      My problem is split in two, so I'll start with the first one:
      What I'm having is my script with dynamically created GUIs with similar / identical names. I would like to have that undepending on how many windows I have open to only have one "window" down at the taskbar.
      I guess all I need is the correct GUI style, but I can't find which one I need.
      Which brings me to problem part 2 (which I also find to be the easy part):
      Windows will open and close on random, so there's no set order in which they'll get closed. But I still need one "window" at the taskbar to work with as long as there's at least one window open.
      In the action of one of these windows getting minimized/restored all of the windows will act simultaneously.
      This will be solved with something similar: 

      case $GUI_EVENT_MINIMIZE          for $1 = 1 to Ubound($ActiveWindows) step +1                 WinSetState($ActiveWindows[$1], @SW_MINIMIZE)         Next And vice versa for restore.
      So .. Mainly prob #1 that I need some help with, and a thought about the "always one window at taskbar"-issue.
      Just point me in the right direction and I'll hopefully solve it myself ^__^'
      Thanks, and have a great weekend!
      zvvyt
    • crashdemons
      By crashdemons
      Background
      My desktop icons shift around often when I extend my screen or connect a higher resolution monitor to my laptop, or when a game crashes in an awkward resolution.

      Recently I've not been having very much luck with programs and scripts that save desktop icon positions. I know there are various examples on this forum - but I've been frustrated by them as well as other options (eg: an outdated layout.dll shell extension)

      For the record, I use Windows 7 64-bit ; I haven't tested this on anything else, but that was probably part of the problem. From some research it appears desktop positions can be saved in one of several different registry keys; older programs may not be searching for them all.

      So, I decided to write my own crappy program that *did* search multiple locations for position settings.

      TL;DR
      Made a program to save desktop icon positions; checks for multiple settings before attempting.


      Sauce
      Anyway, here's my badly-informed bug-ridden spaghetti code that does what I need:
      Note: See slightly cleaned-up code in a reply below!


      #RequireAdmin #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Array.au3> Global $results[11];elements are array[5]= 0:$display_name 1:$bag_key 2:$bag 3:$valueName 4:$valueDisplayName Global $ctrls[11][5] Global $selected = Int(IniRead("itempos.ini", "settings", "selected", -1)) Global $uiOps = GUICreate("Desktop Position Options", 350 + 20, 100) Global $txSel = GUICtrlCreateInput("Not Selected", 0, 0, 350, 20, $ES_READONLY) Global $btSel = GUICtrlCreateButton("...", 350, 0, 20, 20) Global $btSav = GUICtrlCreateButton("Save", 0, 20, 350 + 20, 40) Global $btRes = GUICtrlCreateButton("Restore", 0, 60, 350 + 20, 40) uiResetOptions() Global $uiSel, $btRef Local $hadSettings = load() uiPopulate($results, $ctrls, $uiSel, $btRef, (Not $hadSettings));refresh if didn't cache settings GUISetState(@SW_SHOW, $uiOps) If (Not $hadSettings) Or $selected < 1 Then GUISetState(@SW_SHOW, $uiSel) WinActivate($uiSel) Else GUISetState(@SW_HIDE, $uiSel) WinActivate($uiOps) EndIf ;------------------------------------ While 1 $amsg = GUIGetMsg(1) $msg = $amsg[0] Switch $msg Case $GUI_EVENT_CLOSE If $amsg[1] = $uiOps Then Quit() GUISetState(@SW_HIDE, $uiSel) WinActivate($uiOps) Case $btRef uiPopulate($results, $ctrls, $uiSel, $btRef) ContinueCase Case $btSel GUISetState(@SW_SHOW, $uiSel) WinActivate($uiSel) Case $btSav save() uiResetOptions() Case $btRes restore() uiResetOptions() Case $ctrls[0][0] MsgBox(0, "Position Information Locations", "This window lists system icon position settings" & @CRLF & "This selection may help if restoring settings does not work. If you do not know what to select, try `Current User`. ") EndSwitch For $n = 1 To 10 If $msg = $ctrls[$n][0] And $ctrls[$n][0] <> 0 Then uiSelect($n) ExitLoop EndIf Next WEnd ;------------------------ Func load() Global $selected Global $results Local $hadSettings = False For $i = 0 To 10 Local $entry[5] If IniRead("itempos.ini", "cache", $i, "") = "array" Then For $j = 0 To 4 $entry[$j] = IniRead("itempos.ini", "cache", $i & '_' & $j, "") Next $results[$i] = $entry $hadSettings = True Else $results[$i] = IniRead("itempos.ini", "cache", $i, "") EndIf Next Local $n = Int(IniRead("itempos.ini", "settings", "selected", -1)) If Not $hadSettings Then $n = -1 uiSelect($n) Return $hadSettings EndFunc ;==>load Func Quit() IniWrite("itempos.ini", "settings", "selected", $selected) For $i = 0 To 10 Local $entry = $results[$i] If IsArray($entry) Then IniWrite("itempos.ini", "cache", $i, "array") For $j = 0 To 4 IniWrite("itempos.ini", "cache", $i & '_' & $j, $entry[$j]) Next Else IniWrite("itempos.ini", "cache", $i, $entry) EndIf Next Exit EndFunc ;==>quit Func uiResetOptions() If $selected > 0 Then GUICtrlSetState($btSav, $GUI_ENABLE) If isSaved() Then GUICtrlSetState($btRes, $GUI_ENABLE) Else GUICtrlSetState($btRes, $GUI_DISABLE) EndIf Else GUICtrlSetState($btSav, $GUI_DISABLE) GUICtrlSetState($btRes, $GUI_DISABLE) EndIf EndFunc ;==>uiResetOptions Func isSaved() Local $entry = $results[$selected] If Not IsArray($entry) Then Return False Return StringLen(IniRead("itempos.ini", safename($entry[0] & '-' & $entry[2] & '-' & $entry[4]), safename($entry[3]), "")) > 0 EndFunc ;==>isSaved Func save() GUICtrlSetState($btSav, $GUI_DISABLE) GUICtrlSetState($btRes, $GUI_DISABLE) WinActivate("Program Manager") Sleep(250) Send("{F5}") Sleep(1000) WinActivate($uiOps) Local $entry = $results[$selected] Local $nameSafe = safename($entry[0] & '-' & $entry[2] & '-' & $entry[4]) Local $bag_key = $entry[1] Local $valueName = $entry[3] Local $valueNameSafe = safename($valueName) Local $value = RegRead($bag_key, $valueName) ConsoleWrite("Saving to " & $nameSafe & @CRLF) IniWrite("itempos.ini", $nameSafe, $valueNameSafe, $value) EndFunc ;==>save Func restore() Local $entry = $results[$selected] Local $nameSafe = safename($entry[0] & '-' & $entry[2] & '-' & $entry[4]) Local $bag_key = $entry[1] Local $valueName = $entry[3] Local $valueNameSafe = safename($valueName) Local $value = IniRead("itempos.ini", $nameSafe, $valueNameSafe, "") ConsoleWrite("Restoring from " & $nameSafe & @CRLF) If StringLen($value) = 0 Then Return MsgBox(0, 'Restore Error', "No data is available for this entry to be restored.") ProcessKill('explorer.exe') ProcessWaitClose('explorer.exe') RegWrite($bag_key, $valueName, "REG_BINARY", Binary($value)) Run('explorer.exe') EndFunc ;==>restore ;-------------------------------------------------- Func uiSelect($n) Global $selected Global $results $selected = $n Local $entry = "" If $selected > 0 Then $entry = $results[$n] If IsArray($entry) Then GUICtrlSetData($txSel, $entry[0] & '-' & $entry[2] & '-' & $entry[4]) If IsHWnd($uiSel) Then GUISetState(@SW_HIDE, $uiSel) WinActivate($uiOps) uiResetOptions() Return True Else GUICtrlSetData($txSel, "Nothing Selected") uiResetOptions() If IsHWnd($uiSel) Then GUISetState(@SW_SHOW, $uiSel) WinActivate($uiSel) EndIf Return False EndFunc ;==>uiSelect Func uiPopulate(ByRef $results, ByRef $ctrls, ByRef $ui, ByRef $button, $doRefresh = True) ;results and ctrls must have the same UBound. ProgressOn("Refreshing...", "Refreshing...") ProgressSet(1, "Cleaning up...") Sleep(250) Local $x = UBound($ctrls) - 1 GUISwitch($ui) GUICtrlDelete($button) For $n = 0 To $x For $i = 0 To 3 If $ctrls[$n][$i] Then GUICtrlDelete($ctrls[$n][$i]) Next Next If IsHWnd($ui) Then GUIDelete($ui) If $doRefresh Then For $i = 0 To UBound($results) - 1 $results[$i] = '' Next ProgressSet(5, "Finding folder information sources...") searchhive($results) EndIf ProgressSet(95, "Creating User Interface...") Sleep(250) Local $count = 0 For $n = 1 To $x Local $y = ($n - 1) * 20 If IsArray($results[$n]) Then $count += 1 Next $ui = GUICreate("Select system setting to use...", 450, 20 * ($count + 2) + 10) $ctrls[0][0] = GUICtrlCreateButton("??", 0, 0, 20, 20) $ctrls[0][1] = GUICtrlCreateLabel("Profile", 020, 5, 250, 20) $ctrls[0][2] = GUICtrlCreateLabel("Bag", 270, 5, 050, 20) $ctrls[0][3] = GUICtrlCreateLabel("ItemPos", 320, 5, 150, 20) $ctrls[0][4] = GUICtrlCreateLabel("-----------------------------------", 0, 20, 450, 5, $SS_ETCHEDHORZ) $count = 0 For $n = 1 To $x Local $y = $n * 20 + 5 Local $entry = $results[$n] If IsArray($entry) Then $count += 1 $ctrls[$n][0] = GUICtrlCreateButton($count & '.', 0, $y, 20, 20) $y += 5 $ctrls[$n][1] = GUICtrlCreateLabel($entry[0], 020, $y, 250, 20) $ctrls[$n][2] = GUICtrlCreateLabel($entry[2], 270, $y, 050, 20) $ctrls[$n][3] = GUICtrlCreateLabel($entry[4], 320, $y, 150, 20) EndIf Next $ctrls[$x][4] = GUICtrlCreateButton("Refresh", 0, 20 * ($count + 1) + 10, 450, 20) $button = $ctrls[$x][4] GUISwitch($ui) ProgressSet(100, "Showing off...") Sleep(250) ProgressOff() Return $ui EndFunc ;==>uiPopulate ;-------------------------------------------------------------------- Func searchhive(ByRef $results) ;ConsoleWrite('Current'&@CRLF) ProgressInitial(5) searchuser($results, 'HKEY_CURRENT_USER', 'Current User') ProgressSet(25) For $i = 1 To 9999 Local $u = RegEnumKey("HKEY_USERS\", $i) If @error <> 0 Then ExitLoop ;ConsoleWrite($u&@CRLF) searchuser($results, "HKEY_USERS\" & $u, $u) ProgressSet(25 + $i * 10) Next EndFunc ;==>searchhive Func searchuser(ByRef $results, $user_key, $display_name) Local $software_key[2] = ["Software\Microsoft\Windows", "Software\Classes\Local Settings\Software\Microsoft\Windows"] Local $shell_key[2] = ["Shell", "ShellNoRoam"] Local $name_suffix For $sw In $software_key $name_suffix = "" If StringInStr($sw, "Local") Then $name_suffix = "L" For $shell In $shell_key If StringInStr($shell, "NoRoam") Then $name_suffix &= "NR" Local $bags_key = $user_key & "\" & $sw & "\" & $shell & "\Bags" For $i = 1 To 9999 ProgressIncrement(0.01) Local $bag = RegEnumKey($bags_key, $i) If @error <> 0 Then ExitLoop If StringLen($name_suffix) > 0 Then $name_suffix = "(" & $name_suffix & ")" searchbag($results, $bags_key, $bag, $display_name & $name_suffix) Next Next Next EndFunc ;==>searchuser Func searchbag(ByRef $results, $bags_key, $bag, $display_name) Local $bag_key = $bags_key & '\' & $bag & '\Shell' For $i = 1 To 9999 Local $value = RegEnumVal($bag_key, $i) If @error <> 0 Then ExitLoop If StringInStr($value, 'ItemPos') Then Local $entry[5] = [$display_name, $bag_key, $bag, $value, StringTrimLeft($value, 7)] _Array_Fixed_Push($results, $entry) EndIf Next $bag_key = $bags_key & '\' & $bag & '\Desktop' For $i = 1 To 9999 Local $value = RegEnumVal($bag_key, $i) If @error <> 0 Then ExitLoop ;ConsoleWrite($value&@CRLF) If StringInStr($value, 'ItemPos') Then Local $entry[5] = [$display_name, $bag_key, $bag, $value, StringTrimLeft($value, 7)] _Array_Fixed_Push($results, $entry) EndIf Next EndFunc ;==>searchbag Func _Array_Fixed_Push(ByRef $array, $value);adds an item, overwriting the oldest item | NOTE: Edited from original intent, see comments Local $x = UBound($array) - 1 If $array[0] = $x Then Return False; *** decided later that overwriting sucked for systems with many profiles. Local $i = Mod($array[0], $x); values from 0 to x-1 Local $n = $i + 1;(0 to x-1)+1 = 1 to x $array[0] = $n; this is also the nonadjusted index for the next item :) $array[$n] = $value EndFunc ;==>_Array_Fixed_Push Func ProgressInitial($n = 0) Global $ProgressIncrement $ProgressIncrement = $n ProgressSet($n) EndFunc ;==>ProgressInitial Func ProgressIncrement($n = 1) Global $ProgressIncrement $ProgressIncrement += $n ProgressSet($ProgressIncrement) EndFunc ;==>ProgressIncrement Func safename($s) Return StringRegExpReplace($s, "[^a-zA-Z0-9_\-]", "_") EndFunc ;==>safename Func ProcessKill($p); I should probably credit someone for this function $Kernel32 = DllOpen("kernel32.dll") $hproc = DllCall($Kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', True, 'int', ProcessExists($p)) DllCall($Kernel32, "int", "TerminateProcess", "int", $hproc[0], "dword", 1) DllClose($Kernel32) EndFunc ;==>ProcessKill

      Other Notes
      This only scans for settings/prompts you on the first run, it should keep that information for the next run. It also limits you to using one of the first 10 profiles the scan results in.

      Sorry about having to kill/restart explorer when restoring positions - nothing else worked for me.

      Clarification for the ItemPos text: from what I've read, it is <Resolution>(<Monitor>). I'm unsure how settings behave when you have icons dragged from one screen to the next and restore one of the screens.
    • Kovacic
      By Kovacic
      This is a very simple application to backup a list of your local and network printers to a shared resource.

      when you restore the printers, the app will just install the printers that were networked. Feel free to improve upon and use.

      Let me know what you think

      I have many more applications and I may post more later.


      #include <File.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Backpath = "\\Myawesomeserver\useraccounts" Global $fp = ($Backpath & @UserName) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Printer Tools", 334, 75, 192, 124) $save = GUICtrlCreateButton("Save Printers", 8, 8, 155, 57) $load = GUICtrlCreateButton("Load Printers", 168, 8, 155, 57) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $save ExportPrinters() Case $load ImportPrinters() EndSwitch WEnd Func ImportPrinters() $File = $fp & "\NetworkPrinters.txt" FileOpen($File, 0) For $i = 1 to _FileCountLines($File) $line = FileReadLine($File, $i) RunWait(@ComSpec & " /c " & "rundll32 printui.dll,PrintUIEntry /in /n " & $line, "", @SW_HIDE) Next FileClose($File) Msgbox(0, "", "Network Printer Import Complete") endfunc ;==>ImportPrinters Func ExportPrinters() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $Output = "" $nOutput = "" $objWMIService = ObjGet("winmgmts:\\" & @computername & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems If Stringinstr($objItem.DeviceID, "\\") then $nOutput = $nOutput & $objItem.DeviceID & @CRLF else $Output = $Output & $objItem.DeviceID & @CRLF endif Next FileWrite($fp & "\NetworkPrinters.txt", $nOutput) FileWrite($fp & "\LocalPrinters.txt", $Output) Else FileWrite($fp & "\Printers.txt", "No printers Found") Endif Msgbox(0, "", "Printer Export Complete") EndFunc ;==>ExportPrinters