Jump to content

MozBackup_Launcher


 Share

Recommended Posts

Hello,

MozBackup it's a good software however unfortunately it has some hole.

I'm sorry if the code has italian comments but it will be translated soon.

INTRO

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

MozBackup_Launcher.au3 is an helper for using Mozilla Thunderbird and MozBackup

FEATURES

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

It Close Thunderbird before starting MozBackup.

It Open Thunderbird before starting MozBackup.

It Prevent Thunderbird opening during MozBackup running.

It Deletes all previous *.pcv files contained in the same directory of the current .pcv file.

It can read commnd line arguments for starting it on scheduled tasks.

USAGE IN COMMAND LINE

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

Command line examples:

"MozBackup_Launcher.exe" "c:\mypath\my_profile.mozprofile"

"C:\mypath_A\MozBackup_Launcher.exe" "\\x.x.x.x\mypath_B\my_profile.mozprofile"

OTHER USAGE

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

If you run MozBackup_Launcher.exe without arguments the program search the file "MozBackup_Launcher.mozprofile" into the same directory of the program and run it.

;Command line example *.cmd : "MozBackup_Launcher.exe myprofile.mozprofile"

#include <Timers.au3>
#Include <File.au3>
#include <array.au3>



$appname=StringMid(@ScriptName,1,StringLen(@ScriptName)-4)
$MozProfile="MozBackup_Launcher.mozprofile" ;default profile

If FileExists(@ScriptDir&"\"&"MozBackup.exe")=0 Then
    MsgBox(48+262144,$appname,"MozBackup.exe not found. The file must be in the same directory of the application. Program will be closed.",30)
    Exit
EndIf

If $CmdLine[0] = 0 Then $MozProfile="MozBackup_Launcher.mozprofile"

If $CmdLine[0] = 1 Then $MozProfile=$CmdLine[1] ;loads the file *.mozprofile from command line

If $CmdLine[0] > 1 Then
    MsgBox(48+262144,$appname,"Wrong command line. Program will be closed.",30)
    Exit
EndIf

If FileExists($MozProfile)=0 Then
    MsgBox(48+262144,$appname,"File '" &$MozProfile&"' not found. Program will be closed.",30)
    Exit
EndIf

$starttime=TimerInit()

While ProcessExists("thunderbird.exe")>0
    ProcessClose("thunderbird.exe")
    If _Timer_Diff($starttime)>60000 then
        MsgBox(48+262144,$appname,"The program is open. Close the program and press OK",0)
        ExitLoop
    EndIf
WEnd

$OutpotPCV=IniRead($MozProfile,"General","output","NA")



Dim $szDrive, $szDir, $szFName, $szExt
$OutpotPCVAr = _PathSplit($OutpotPCV, $szDrive, $szDir, $szFName, $szExt)

If IsArray($OutpotPCVar)=1 Then

    FileDelete($OutpotPCVAr[1]&$OutpotPCVAr[2]&"*"&$OutpotPCVAr[4])
    ;MsgBox(48+262144,$appname,$OutpotPCVAr[1]&$OutpotPCVAr[2]&"*"&$OutpotPCVAr[4],0)

Else

    MsgBox(48+262144,$appname,"The backup file contained in '"&$MozProfile&"' isn't correct",0)

EndIf

ShellExecute("mozbackup.exe", '"'&$MozProfile&'"',@ScriptDir)

While ProcessExists("MozBackup.exe")>0
    If ProcessExists("thunderbird.exe")>0 Then
        ProcessClose("thunderbird.exe")
        MsgBox(48+262144,$appname,"Mozilla Thunderbird has been closed because the Backup is running.",30)
    EndIf
WEnd

Sleep(10000)

Run(@ProgramFilesDir&"\Mozilla Thunderbird\thunderbird.exe")

MozBackup_Launcher.au3

Edited by MatteoGuallini
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...