Jump to content
Sign in to follow this  
careca

Firefox Backup/Restore

Recommended Posts

careca

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

post-68092-0-64972400-1352048027_thumb.p

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
MrCreatoR

There is a few issues...

1) $Input1 is not used, so no mater what i will input to the «Profile Folder», it will always use predefined path (which can be wrong of course).

2) You can use @AppDataDir to get the firefox data files dir.

And also i think you should put all needed files for this project in one archive, so the user can just download and use it :).


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
careca

There is a few issues...

1) $Input1 is not used, so no mater what i will input to the «Profile Folder», it will always use predefined path (which can be wrong of course).

2) You can use @AppDataDir to get the firefox data files dir.

And also i think you should put all needed files for this project in one archive, so the user can just download and use it :).

Hello, thanks for the input, you're correct input1 is not changing the path, it's only for the user to see where the application is trying to get the profile files, %appdata% environment variable is a good idea.

In order to upload, i got to upload to an external server, didn't want to include files i haven't created, but it seems like a more pratical option for the user.

Greetz,

Careca

EDIT: updated 1st post including your sugestion, added more stuff.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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  

  • Similar Content

    • careca
      By careca
      This is a folder backup tool, after i got tired of using tools made by others, that had either lack of functionality,
      or were overly complex, i decided to make my own, and this is it.
      MirrorDir mirrors dirs as the name says, simply select source and destination hit scan, review in the list if that's what you want it to do and press start copy.
      As this is a mirror sync tool, this means files that exist in destination but dont exist in source are marked for deletion.
      Other tools have other modes like the incrementing copy which does not delete anything, but i made this for me,
      only if there is a request i may think about adding features just for fun.
      Whats more? There's a save/load of profile and the profile is what contains the list of source and destination folders, these are kept in prefs.ini in folder MDir in local appdata.
      There are context menu's that allow for the removal of items from the profile list, either just for the list (in case you dont want to sync a specific folder, just this time)
      or delete from the list and the .ini .
      Best regards.
       
       
    • Carm01
      By Carm01
      All,
      I have decided to release my code for the automated clean install, set up and configuration of Mozilla Firefox with a Mozilla.cfg file included in my example as well. I seen an older version of this and decided to post mine on here. This is Windows 10 friendly.
      The whole process once compiled executes in about 15 seconds on my machine from start to finish as it is extremely fast.
      If you want to include your own Mozilla.cfg into the mix simply place Your Mozilla.cfg file in the same directory as the exe when it is run. If you do not wish to embed the Mozilla.cfg file into the script as a back up in case you forget you need to remove that line of code to embed it.
      I hope this helps some people esp those wanting to understand how to use a cfg file to set default settings for all users without having to do it by putting all those files and folders in the defaultapp data folders.
      #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Clear-App-firefox.ico #AutoIt3Wrapper_Outfile=FirefoxUpdater(x64Stable)_x.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Comment=Preformes a clean install of Firefox 64bit Stable version. Auto downloads latest version. #AutoIt3Wrapper_Res_Description=Updates to the Latest 64bit Stable #AutoIt3Wrapper_Res_Fileversion=2.5.0.0 #AutoIt3Wrapper_Res_ProductVersion=2.5.0.0 #AutoIt3Wrapper_Res_Language=1033 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <InetConstants.au3> #include <EventLog.au3> #include <Inet.au3> #include <File.au3> #include <array.au3> #include <Misc.au3> #include <TrayConstants.au3> ; Required for the $TRAY_CHECKED and $TRAY_ICONSTATE_SHOW constants. If UBound(ProcessList(@ScriptName)) > 2 Then Exit TraySetToolTip("Firefox Updater") HotKeySet("^!m", "MyExit") ; ctrl+Alt+m kills program ( hotkey ) Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Opt("TrayOnEventMode", 1) ; Enable TrayOnEventMode. TrayCreateItem("About") TrayItemSetOnEvent(-1, "About") TrayCreateItem("") ; Create a separator line. TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "About") ; Display the About MsgBox when the tray icon is double clicked on with the primary mouse button. TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. Local $sVersion, $CVersion, $ecode ;https://www.mozilla.org/en-US/firefox/developer/all/ ;https://www.mozilla.org/en-US/firefox/all/# ;https://www.mozilla.org/en-US/firefox/all/#en-US ;https://www.mozilla.org/en-US/firefox/beta/all/#en-US ;https://archive.mozilla.org/pub/firefox/candidates/48.0b1-candidates/build2/ ;https://archive.mozilla.org/pub/firefox/candidates/ getfiles() compare() killapps() uninstall() dlinstall() Exit Func killapps() ; kill firefox and plugin if running If FileExists("C:\Program Files\Mozilla Firefox\") Then $cmd = "taskkill.exe /im firefox.exe /f /t" RunWait('"' & @ComSpec & '" /c ' & $cmd, @SystemDir, @SW_HIDE) Sleep(300) $cmd = "taskkill.exe /im plugin* /f /t" RunWait('"' & @ComSpec & '" /c ' & $cmd, @SystemDir, @SW_HIDE) Sleep(300) Call("remcfg64") EndIf If FileExists("C:\Program Files (x86)\Mozilla Firefox\") Then $cmd = "taskkill.exe /im firefox.exe /f /t" RunWait('"' & @ComSpec & '" /c ' & $cmd, @SystemDir, @SW_HIDE) Sleep(300) $cmd = "taskkill.exe /im plugin* /f /t" RunWait('"' & @ComSpec & '" /c ' & $cmd, @SystemDir, @SW_HIDE) Sleep(300) Call("remcfg32") EndIf EndFunc ;==>killapps Func remcfg64() ; delete existing config file if exist $SSlist = _FileListToArrayRec("C:\Program Files\Mozilla Firefox\", "*", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) For $i = 1 To UBound($SSlist) - 1 If StringInStr($SSlist[$i], "mozilla.cfg") > 1 Then FileDelete($SSlist[$i]) ElseIf StringInStr($SSlist[$i], "override.ini") > 1 Then FileDelete($SSlist[$i]) ElseIf StringInStr($SSlist[$i], "local-settings.js") > 1 Then FileDelete($SSlist[$i]) EndIf Next EndFunc ;==>remcfg64 Func remcfg32() $SSlist = _FileListToArrayRec("C:\Program Files (x86)\Mozilla Firefox\", "*", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) For $i = 1 To UBound($SSlist) - 1 If StringInStr($SSlist[$i], "mozilla.cfg") > 1 Then FileDelete($SSlist[$i]) ElseIf StringInStr($SSlist[$i], "override.ini") > 1 Then FileDelete($SSlist[$i]) ElseIf StringInStr($SSlist[$i], "local-settings.js") > 1 Then FileDelete($SSlist[$i]) EndIf Next EndFunc ;==>remcfg32 Func uninstall() ; uninstall existing Firefox If FileExists("C:\Program Files\Mozilla Firefox\Firefox.exe") Then ShellExecuteWait("helper.exe", " /S", "C:\Program Files\Mozilla Firefox\uninstall") EndIf If FileExists("C:\Program Files (x86)\Mozilla Firefox\Firefox.exe") Then ShellExecuteWait("helper.exe", " /S", "C:\Program Files (x86)\Mozilla Firefox\uninstall") EndIf Sleep(1500) DirRemove("C:\Program Files (x86)\Mozilla Firefox\", 1) DirRemove("C:\Program Files\Mozilla Firefox\", 1) EndFunc ;==>uninstall Func getfiles() ; get latest download Local $sTxt, $sTxt1 $xjs = "C:\windows\temp\xjs.tmp" $xjs1 = "C:\windows\temp\xjs1.tmp" ;$sSite = "https://www.mozilla.org/en-US/firefox/beta/all/" $sSite = "https://www.mozilla.org/en-US/firefox/all/" ;$sNotes = "https://www.mozilla.org/en-US/firefox/beta/notes/" $sNotes = "https://www.mozilla.org/en-US/firefox/notes/" SplashTextOn("Progress", "", 210, 75, -1, -1, 18, "Tahoma", 10) ControlSetText("Progress", "", "Static1", "Initializing", 2) $source = _INetGetSource($sSite) $sTxt = StringSplit($source, @LF) $q = 0 $i = 0 For $i = 1 To UBound($sTxt) - 1 ; is like saying read the line number ;GUIGetMsg();prevent high cpu usage If StringInStr($sTxt[$i], "=win64&amp;lang=en-US") > 1 Then $sActiveX1 = StringSplit($sTxt[$i], 'href="', 1) $sActiveX2 = StringSplit($sActiveX1[2], '"') Global $dia = $sActiveX2[1] $q = 1 EndIf If UBound($sTxt) - 1 = $i Then $ecode = '404' EventLog() Exit EndIf If $q = 1 Then ExitLoop EndIf Next ; FIND VERSION $source = _INetGetSource($sNotes) $sTxt1 = StringSplit($source, @LF) $q = 0 $i = 0 For $i = 1 To UBound($sTxt1) - 1 ; is like saying read the line number ;GUIGetMsg();prevent high cpu usage If StringInStr($sTxt1[$i], "<title>Firefox") > 1 Then $sActiveX1 = StringSplit($sTxt1[$i], '<title>Firefox', 1) $sActiveX2 = StringSplit($sActiveX1[2], ',') $sVersion = StringStripWS($sActiveX2[1], 3) $q = 1 EndIf If $sVersion = "" Then ; error correcting if mozilla changes page where version notes are located. $sVersion = "Current Version" EndIf If $q = 1 Then ExitLoop EndIf Next SplashOff() EndFunc ;==>getfiles Func dlinstall() ; download and install $Version = $sVersion & " - 64 bit" _webDownloader($dia, "FFInstall.exe", $Version) SplashTextOn("Progress", "", 210, 75, -1, -1, 18, "Tahoma", 10) ControlSetText("Progress", "", "Static1", "Installing Version " & $sVersion, 2) ShellExecuteWait("FFInstall.exe", " -ms", "C:\Windows\Temp\") If FileExists(@ScriptDir & "\mozilla.cfg") Then FileCopy(@ScriptDir & "\mozilla.cfg", "C:\Program Files\Mozilla Firefox\mozilla.cfg", 1) Else FileInstall("G:\Users\username\Documents\Project\FirefoxDefault\mozilla.cfg", "C:\Program Files\Mozilla Firefox\mozilla.cfg", 1) EndIf FileWrite("C:\Program Files\Mozilla Firefox\defaults\pref\local-settings.js", 'pref("general.config.obscure_value", 0);' & @CRLF & 'pref("general.config.filename", "mozilla.cfg");' & @CRLF) FileWrite("C:\Program Files\Mozilla Firefox\browser\override.ini", '[XRE]' & @CRLF & 'EnableProfileMigrator=false' & @CRLF) FileDelete("C:\windows\temp\" & "\FFInstall.exe") $CVersion = FileGetVersion('C:\Program Files\Mozilla Firefox\firefox.exe', $FV_PRODUCTVERSION) SplashOff() EndFunc ;==>dlinstall Func _webDownloader($sSourceURL, $sTargetName, $sVisibleName, $sTargetDir = "C:\windows\temp", $bProgressOff = True, $iEndMsgTime = 2000, $sDownloaderTitle = "Mozilla Firefox") ; Declare some general vars Local $iMBbytes = 1048576 ; If the target directory doesn't exist -> create the dir If Not FileExists($sTargetDir) Then DirCreate($sTargetDir) ; Get download and target info Local $sTargetPath = $sTargetDir & "\" & $sTargetName Local $iFileSize = InetGetSize($sSourceURL) Local $hFileDownload = InetGet($sSourceURL, $sTargetPath, $INET_LOCALCACHE, $INET_DOWNLOADBACKGROUND) ; Show progress UI ProgressOn($sDownloaderTitle, "" & $sVisibleName) GUISetFont(8, 400) ; Keep checking until download completed Do Sleep(250) ; Set vars Local $iDLPercentage = Round(InetGetInfo($hFileDownload, $INET_DOWNLOADREAD) * 100 / $iFileSize, 0) Local $iDLBytes = Round(InetGetInfo($hFileDownload, $INET_DOWNLOADREAD) / $iMBbytes, 2) Local $iDLTotalBytes = Round($iFileSize / $iMBbytes, 2) ; Update progress UI If IsNumber($iDLBytes) And $iDLBytes >= 0 Then ProgressSet($iDLPercentage, $iDLPercentage & "% - Downloaded " & $iDLBytes & " MB of " & $iDLTotalBytes & " MB") Else ProgressSet(0, "Downloading '" & $sVisibleName & "'") EndIf Until InetGetInfo($hFileDownload, $INET_DOWNLOADCOMPLETE) ; If the download was successfull, return the target location If InetGetInfo($hFileDownload, $INET_DOWNLOADSUCCESS) Then ProgressSet(100, "Downloading '" & $sVisibleName & "' completed") If $bProgressOff Then Sleep($iEndMsgTime) ProgressOff() EndIf Return $sTargetPath ; If the download failed, set @error and return False Else Local $errorCode = InetGetInfo($hFileDownload, $INET_DOWNLOADERROR) ProgressSet(0, "Downloading '" & $sVisibleName & "' failed." & @CRLF & "Error code: " & $errorCode) If $bProgressOff Then Sleep($iEndMsgTime) ProgressOff() EndIf SetError(1, $errorCode, False) FileDelete("C:\windows\temp\" & "\FFInstall.exe") SplashOff() EndIf EndFunc ;==>_webDownloader Func compare() $CVersion = FileGetVersion('C:\Program Files\Mozilla Firefox\firefox.exe', $FV_PRODUCTVERSION) If $sVersion = $CVersion Then $ecode = '411' MsgBox(64, "Firefox says:", 'You have the latest version ' & $CVersion , 5) EventLog() Exit EndIf EndFunc ;==>compare Func EventLog() If $ecode = '404' Then Local $hEventLog, $aData[4] = [0, 4, 0, 4] $hEventLog = _EventLog__Open("", "Application") _EventLog__Report($hEventLog, 1, 0, 404, @UserName, @UserName & ' No "exe" found for Mozilla Firefox. The webpage and/or download link might have changed. ' & @CRLF, $aData) _EventLog__Close($hEventLog) EndIf If $ecode = '411' Then Local $hEventLog, $aData[4] = [0, 4, 1, 1] $hEventLog = _EventLog__Open("", "Application") _EventLog__Report($hEventLog, 0, 0, 411, @UserName, @UserName & " Mozilla Firefox " & "version " & $CVersion & " successfully installed." & @CRLF, $aData) _EventLog__Close($hEventLog) EndIf EndFunc ;==>EventLog Func MyExit() Exit EndFunc ;==>MyExit Func About() ; Display a message box about the AutoIt version and installation path of the AutoIt executable. MsgBox($MB_SYSTEMMODAL, "", "Firefox Update Tool" & @CRLF & @CRLF & _ "Version: 2.5.0.0" & @CRLF & _ "Firefox Updater by Carm0@Sourceforge" & @CRLF & "CTRL+ALT+m to kill", 5) ; Find the folder of a full path. EndFunc ;==>About Func ExitScript() Exit EndFunc ;==>ExitScript #comments-start http://superuser.com/questions/823530/change-some-default-settings-for-firefox-globally http://mxr.mozilla.org/mozilla-release/source/browser/app/profile/firefox.js#387 http://smallbusiness.chron.com/change-default-homepage-users-54727.html https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment https://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/ https://wiki.mozilla.org/Installer:Command_Line_Arguments https://support.mozilla.org/en-US/questions/971189 http://forums.mozillazine.org/viewtopic.php?p=2228066 http://forums.mozillazine.org/viewtopic.php?f=38&t=2950829 ; updates auto http://forums.mozillazine.org/viewtopic.php?f=8&t=2753795 http://superuser.com/questions/697018/how-to-disable-popups-in-firefox-without-add-ons http://www.itninja.com/blog/view/deploy-popup-allowed-sites-with-firefox deploy with certain opous enabled #ce Mozilla.cfg file:
      // pref("browser.search.geoSpecificDefaults", false); pref("browser.search.defaultenginename.US", "data:text/plain,browser.search.defaultenginename.US=Google"); //https://support.mozilla.org/en-US/questions/1034136 // set Firefox Default homepage defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=https://www.startpage.com/do/mypage.pl?prf=381c658b828c3fe50ec7563137fef98f"); // Don't show WhatsNew on first run after every update pref("browser.startup.homepage_override.mstone","ignore"); // disables the 'know your rights' button from displaying on first run pref("browser.rights.3.shown", true); pref("browser.usedOnWindows10", true); pref("browser.rights.override", true); // Do not perform system default browser check on startup pref("browser.shell.checkDefaultBrowser", false); // set all plugins to always activated - two settings pref("plugin.default.state", 2); // https://support.mozilla.org/en-US/questions/982143 reference about click to play flash // set flash and silverlight always ask = 1 always activate = 2 defaultPref("plugin.state.flash", 2); // hide choose what i share which pops up at the bottom after a minute lockPref("datareporting.policy.dataSubmissionPolicyBypassNotification", true); // https://groups.google.com/forum/#!topic/mozilla.support.firefox/DRXvfTA6Hnc //disable the "Improve Firefox" suggestion pref("toolkit.telemetry.prompted", 2); //https://support.mozilla.org/en-US/questions/898549 // do not block popups - can only be default or locked pref defaultPref("dom.disable_open_during_load", false); //http://superuser.com/questions/697018/how-to-disable-popups-in-firefox-without-add-ons //lockpref("privacy.sanitize.migrateFx3Prefs", true); // http://www.pcc-services.com/kixtart/firefox-lockdown.html //pref("browser.privatebrowsing.autostart", true); // prevent reader view from popping down at the top pref("reader.parse-on-load.enabled",false); // click to play - disabled so you are not prompted - https://support.mozilla.org/en-US/questions/934809 pref("plugins.click_to_play", false); // below will set the cache only to clear on exit, you need to tell it what to do with the reset of the data not just cache leave cache out. Just add a '\\' to whatever you want to clear on browser exit. //defaultPref("privacy.clearOnShutdown.cookies", false); defaultPref("privacy.clearOnShutdown.downloads", false); defaultPref("privacy.clearOnShutdown.formdata", false); defaultPref("privacy.clearOnShutdown.history", false); defaultPref("privacy.clearOnShutdown.sessions", false); defaultPref("privacy.sanitize.migrateClearSavedPwdsOnExit", false); defaultPref("privacy.sanitize.sanitizeOnShutdown", true); //pref("browser.privatebrowsing.autostart", true); //prevent autoplay https://support.mozilla.org/en-US/questions/1103127 //defaultPref("media.autoplay.enabled", false); //https://wiki.mozilla.org/Electrolysis //pref("browser.tabs.remote.autostart", true); //pref("browser.tabs.remote.force-enable", true); // ref: http://www.itninja.com/question/firefox-22-for-enterprise-deployment-default-preferences // Prevent refresh message showing at the bottom if firefox is not used in a while - http://techdows.com/2016/05/firefox-reinstall-to-prompt-for-a-refresh.html https://support.mozilla.org/en-US/questions/1084402 pref("browser.disableResetPrompt", true); // disable plugin check - https://support.mozilla.org/en-US/questions/968056 //defaultPref("plugin.scan.plid.all",false); //defaultPref("plugins.update.url",""); // disable remember preferences //defaultPref("signon.rememberSignons", false); //https://twitter.com/HighTechDad/status/955916813178691584 //https://t.co/YTvSy9EBJ1 // defaultPref can also be lockPref defaultPref("privacy.donottrackheader.enabled", true); //defaultPref("privacy.trackingprotection.enabled", true); lockPref("privacy.trackingprotection.introCount", 20);  
    • rudi
      By rudi
      Hello,
      usually I do Win automations, so I have no skills at all to handle HTML forms :-/
      The script to catch and syntax check  the required information from Excel is done.
      Now I'd like to automate the upload using this form, too:
       
      http://flashcardsdeluxe.com/flashcards/Upload.aspx
      What browser is easiest to do so? (IE, Chrome, FF) The Values $DeckCode, $DeckName, $DeckDefinition shall go to their HTML form fields finally "click" the button "upload flashcards" <table width="70%" class="cssCenter" border="0"> <tr> <td style="width: 1%">Deck&nbsp;Code</td> <td style="width: 100%"><input name="ctlDeckCode" type="text" id="ctlDeckCode" style="width:50%;" /> (no spaces allowed)</td> <td></td> </tr> <tr> <td style="width: 1%">Deck&nbsp;Name</td> <td style="width: 100%"><input name="ctlDeckName" type="text" id="ctlDeckName" style="width:50%;" /> (optional)</td> <td style="width: 1%" align="right"><input type="submit" name="ctlUpload" value="Upload Flashcards" id="ctlUpload" /></td> </tr> <tr> <td valign="top" style="padding-top: 5px" >Flashcard&nbsp;Text</td> <td colspan="2"><textarea name="ctlFlashcardText" rows="2" cols="20" id="ctlFlashcardText" style="height:280px;width:100%;"></textarea></td> </tr> </table> If someone kindly could jump in showing how to address just one of the input fields and how to "click" the "upload flashcards" button, I should be able to do the rest myself.
      TIA, Rudi.

    • Faraz
      By Faraz
      I have to open a URL on Mozilla Firefox , cursor is by default userid textbox, had to send userid, send tab, send pwd with flag 1 , send tab, send Enter.
      But Script is Failing to take Password.
      Any Help
       
      #include <Constants.au3>
      #include <IE.au3>
      #include <PassMask.au3>
      If $CmdLine[0] <> 3 Then
          MsgBox($MB_OK, "Usage", "ps_weblogin_FireFox <Url> <Browser Title> <Text to Send>")
      Else
         web_login($CmdLine[1], $CmdLine[2], $CmdLine[3])
      EndIf
      Func web_login($bt_url, $bt_Title, $bt_SendText)
          Local $ff = Run("C:\Program Files (x86)\Mozilla Firefox\firefox.exe " & $bt_url)
              WinWaitActive($bt_Title)
          Sleep(2000)
          ControlSend("","","",$bt_SendText)
      EndFunc
      _______________________________________________
      _______________________________________________
      Func Mask_Password($Password)
          $MaskPassword = $Password
          $MaskPassword = StringReplace($MaskPassword, "#", "||||||#@@@@@@")
          $MaskPassword = StringReplace($MaskPassword, "!", "||||||!@@@@@@")
          $MaskPassword = StringReplace($MaskPassword, "+", "||||||+@@@@@@")
          $MaskPassword = StringReplace($MaskPassword, "^", "||||||^@@@@@@")
          $MaskPassword = StringReplace($MaskPassword, "{", "||||||{@@@@@@")
          $MaskPassword = StringReplace($MaskPassword, "}", "||||||}@@@@@@")
          $MaskPassword = StringReplace($MaskPassword, "||||||", "{")
          $MaskPassword = StringReplace($MaskPassword, "@@@@@@", "}")
          Return $MaskPassword
      EndFunc
    • Miliardsto
      By Miliardsto
      Hello. How to make GUI restore from tray with slower speed or effect?
×