Jump to content

Search the Community

Showing results for tags 'Restore'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 12 results

  1. Hello Everyone, I've developed my own GUI using AutoIt and I'm allowing users to minimize the GUI, but I also want to include some kind of timer so that it will automatically restore the GUI after something like 30 minutes or an hour. However, I also want them to be able to manually restore the GUI by clicking the application's icon in the taskbar. I've searched through the forums, but I'm not sure how to get started. Any ideas or functions to research are appreciated! Regards, TX Techie
  2. Hi All, Please help me on how to fetch date/time of last windows 10 system restore point using autoit? Basically its about querying the last restore point.
  3. Hello. How to make GUI restore from tray with slower speed or effect?
  4. 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:
  5. 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 ;==>_CreateRestorePointJust 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?
  6. 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
  7. 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: 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.
  8. 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
  9. 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.
  10. Hi guys, needed something to speed up the backup of the firefox profile, so i did this, works for me just right, and it's here available to anyone who needs it. Obviously gotta thank to everyone who helped me, and had so much patience to help out. Thumbs up for Melba23! This works like this: press backup, it searches for the file extensions.ini in a subfolder of all fixed drives PROGS01 INSTALL If not found, backs it up to 'C:FFProfBackup' The restore function is similar, searches for the same file in the same manner, not found, searches for 'C:FFProfBackup', if found uses that, not found any, won't do anything. Uses a method of deleting the destination dir, and copying the source on it, So use at your risk. Don't blame me if your pc caught fire, or got infested with cockroaches. hehe PS: Uses Melba23 UDF RecFileListToArray that you can get #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=ResourcesFox.ico #AutoIt3Wrapper_Res_Icon_Add=ResourcesFox.ico #AutoIt3Wrapper_Run_Tidy=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <GuiListView.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ListViewConstants.au3> #include <RecFileListToArray.au3> Opt("GUIOnEventMode", 1) Opt("TrayAutoPause", 0) Opt("TrayIconDebug", 1) $Form1 = GUICreate("Firefox Profile Backup", 600, 300, 190, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $Backup = GUICtrlCreateButton("Backup", 10, 265, 75, 25) GUICtrlSetOnEvent($Backup, "Backup") $Restore = GUICtrlCreateButton("Restore", 120, 265, 75, 25) GUICtrlSetOnEvent($Restore, "Restore") $Exit = GUICtrlCreateButton("Exit", 230, 265, 75, 25) GUICtrlSetOnEvent($Exit, "Close") $cListView = GUICtrlCreateListView("Path", 10, 80, 580, 130) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 575) $Label1 = GUICtrlCreateLabel("Profile Folder", 10, 10, 130, 17) $Label2 = GUICtrlCreateLabel("Backup/Restore Folder(s) List", 10, 60, 200, 17) $Label2 = GUICtrlCreateLabel("Backup/Restore Relative Folder", 10, 220, 200, 17) $Input1 = GUICtrlCreateInput(@AppDataDir & 'MozillaFirefox', 10, 30, 580, 21) $Input2 = GUICtrlCreateInput('PROGS', 10, 240, 580, 21) $ProfileDir = GUICtrlRead($Input1) $DestDir = GUICtrlRead($Input2) ;$DefaultBackup = ('C:FFProfBackup') $aArray = DriveGetDrive('FIXED') If @error Then MsgBox(4096, "DriveGetDrive", "It appears an error occurred.") Else For $i = 1 To $aArray[0] $aList = _RecFileListToArray(StringUpper($aArray[$i]) & $DestDir, "extensions.ini", 1, 1, 0, 2) If IsArray($aList) Then For $u = 1 To $aList[0] GUICtrlCreateListViewItem($aList[$u], $cListView) Next EndIf Next EndIf GUISetState(@SW_SHOW) Func Backup() $ProfileDir = GUICtrlRead($Input1) $DestDir = GUICtrlRead($Input2) If FileExists(@AppDataDir & 'MozillaFirefoxProfilesdefault.defaultextensions.ini') Then _GUICtrlListView_DeleteAllItems($cListView) ProgressOn("Progress...", "Working", "") $aArray = DriveGetDrive('FIXED') If @error Then MsgBox(4096, "DriveGetDrive", "It appears an error occurred.") Else For $i = 1 To $aArray[0] $aList = _RecFileListToArray(StringUpper($aArray[$i]) & $DestDir, "extensions.ini", 1, 1, 0, 2) If IsArray($aList) Then For $u = 1 To $aList[0] GUICtrlCreateListViewItem($aList[$u], $cListView) DirRemove(StringTrimRight($aList[$u], 40), 1) Sleep(3000) DirCopy(@AppDataDir & 'MozillaFirefox', StringTrimRight($aList[$u], 40), 1) If FileExists($aList[$u]) Then MsgBox(4096, 'Success!', 'Files copied successfully From: ' & $ProfileDir & ' >>> to >>> ' & (StringTrimRight($aList[$u], 40))) EndIf ProgressSet(50, "50 %", "Working") Next Else MsgBox(4096, "Info", "No Backup found in subdirectories: " & StringUpper($aArray[$i]) & $DestDir) ;DirCopy($ProfileDir, $DefaultBackup, 1) DirCopy($ProfileDir, StringUpper($aArray[$i]) & $DestDir, 1) ;MsgBox(4096, "Info", 'Backup done in: ' & $DefaultBackup & ' >>> And >>> ' & StringUpper($aArray[$i]) & $DestDir) MsgBox(4096, "Info", 'Backup done in: ' & StringUpper($aArray[$i]) & $DestDir) EndIf Next EndIf ProgressSet(100, "100 %", "Done!") Sleep(1000) ProgressOff() Else MsgBox(4096, "Info", "No Profile in: " & $ProfileDir) EndIf EndFunc ;==>Backup Func Restore() $ProfileDir = GUICtrlRead($Input1) $DestDir = GUICtrlRead($Input2) _GUICtrlListView_DeleteAllItems($cListView) ProgressOn("Progress...", "Working", "") $aArray = DriveGetDrive('FIXED') If @error Then MsgBox(4096, "DriveGetDrive", "It appears an error occurred.") Else ProgressSet(50, "50 %", "Working") For $i = 1 To $aArray[0] $aList = _RecFileListToArray(StringUpper($aArray[$i]) & $DestDir, "extensions.ini", 1, 1, 0, 2) If IsArray($aList) Then For $u = 1 To $aList[0] GUICtrlCreateListViewItem($aList[$u], $cListView) DirRemove($ProfileDir, 1) Sleep(2000) DirCopy(StringTrimRight($aList[$u], 40), $ProfileDir, 1) ProgressSet(75, "75 %", "Working") If FileExists(@AppDataDir & 'MozillaFirefoxProfilesdefault.defaultextensions.ini') Then MsgBox(4096, 'Success!', 'Files copied successfully From: ' & (StringTrimRight($aList[$u], 40)) & ' >>> to >>> ' & $ProfileDir) Else MsgBox(4096, "Info", "No Profile in: " & $ProfileDir) EndIf Next Else MsgBox(4096, "Info", "No Backup found in subdirectories: " & StringUpper($aArray[$i]) & $DestDir) ;If FileExists($DefaultBackup & 'Profilesdefault.defaultextensions.ini') Then ;DirCopy($DefaultBackup, $ProfileDir, 1) ;MsgBox(4096, "Info", 'Backup copied from: ' & $DefaultBackup) ;EndIf If FileExists(StringUpper($aArray[$i]) & $DestDir & 'Profilesdefault.defaultextensions.ini') Then DirCopy(StringUpper($aArray[$i]) & $DestDir, $ProfileDir, 1) MsgBox(4096, "Info", 'Backup copied from: ' & StringUpper($aArray[$i]) & $DestDir) EndIf EndIf Next EndIf ProgressSet(100, "100 %", "Done!") Sleep(1000) ProgressOff() EndFunc ;==>Restore Func Close() Exit EndFunc ;==>Close Do Sleep(100) Until $Form1 = 0 Update 1 includes: 1 - input1 is now readable, change path if different 2 - added input2 to set the relative path to save/restore the backup 3 - Removed/commented defaultpath, meaning it no longer saves to C:FFProfBackup, when there's no destination folder set, instead saves to the relative path you wrote. 4 - Included the udf required, icon, and compiled script Download careca.googlecode.com
  11. Well ,sometimes if you try to pen firefox hidden or minimized,doesn't work ,and when it works,you can't show it again on the monitor ShellExecute( "C:\Program Files\Mozilla Firefox\firefox.exe","Google - Mozilla Firefox","","open",@SW_HIDE) Sleep(2000) WinSetState( "Google - Mozilla Firefox","",@SW_SHOW)
  12. Hey, I am just wondering about how I would check whether the current GUI is maximized or restored? Right now, I am using GUI Events to change a variable, I am wondering whether there is a more efficient way? Thanks.
×
×
  • Create New...