Give me some dummy data and I'll see if I can't automate it with AutoIt.
Okay this doesn't sync...but it'll add accounts from FileZilla.
If you have any accounts already in UltraEdit be sure to back them up before running this. It "should" do the right thing...but hasn't been heavily tested.
and during install set it to execute scripts...well unless you like compiling them before you can execute them...your call.
Then copy the code below and save it into a text file with .au3 as the file extension. Then simply double click the script to execute it...or compile it...depending on your pick during install.
Code: Select all
#Include <Array.au3>
Opt( 'SendAttachMode' , 1 )
Opt( 'SendKeyDelay' , 1 )
If FileExists ( @AppDataDir & '\FileZilla\sitemanager.xml' ) Then
$sBuffer = FileRead( @AppDataDir & '\FileZilla\sitemanager.xml' )
Else
$sFile = FileOpenDialog( 'Select SiteManager' , @AppDataDir , 'XML Files (*.xml)' , 3 , 'sitemanager.xml' )
If @Error Then Exit
$sBuffer = FileRead( $sFile )
EndIf
; RegEx Server Nods
$aServers = StringRegExp( $sBuffer , '(?i)(?s)<Server>(.+)</Server>' , 3 )
If IsArray( $aServers ) Then
; Check for UltraEdit
If NOT ProcessExists( 'Uedit32.exe' ) Then
Run( @ComSpec & ' /c Uedit32' , '' , @SW_HIDE )
WinWaitActive( ' - UltraEdit' , '' , 15 )
EndIf
; Open FTP Account Manager
If NOT WinExists( 'FTP Account Manager' ) Then
WinActivate( ' - UltraEdit' )
Send( '{ALTDOWN}ftm{ALTUP}' )
EndIf
; Wait for FTP Account Manager
WinWait( 'FTP Account Manager' )
; Make Sure We Are On The Correct Tab
While NOT ControlCommand( 'FTP Account Manager' , '' , 'Button20' , 'IsVisible' )
ControlCommand( 'FTP Account Manager' , '' , 'SysTabControl321' , 'Tableft' , '' )
WEnd
; Process Server Nods
For $ii = 0 To UBound( $aServers ) - 1
; Test if We Need to Add an Account
$hSelected = ControlTreeView( 'FTP Account Manager' , '' , 'SysTreeView321' , 'GetSelected' )
$sSelected = ControlTreeView( 'FTP Account Manager' , '' , 'SysTreeView321' , 'GetText' , $hSelected )
If $sSelected <> 'New Account 1' Then ControlClick( 'FTP Account Manager' , '' , 'Button23' )
; Account Name
$aName = StringRegExp( $aServers[$ii] , '(?i)<Name>(.+)</Name>' , 1 )
If IsArray( $aName ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit14' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit14' , '{DELETE}' & StringStripWS( $aName[0] , 3 ))
Else
ContinueLoop
EndIf
; Protocal
$aProtocol = StringRegExp( $aServers[$ii] , '(?i)<Protocol>(.+)</Protocol>' , 1 )
If IsArray( $aProtocol ) AND $aProtocol[0] = 0 Then
ControlCommand( 'FTP Account Manager' , '' , 'ComboBox3' , 'SelectString' , 'FTP' )
Else
ControlCommand( 'FTP Account Manager' , '' , 'ComboBox3' , 'SelectString' , 'SFTP' )
EndIf
; Server Address
$aAddress = StringRegExp( $aServers[$ii] , '(?i)<Host>(.+)</Host>' , 1 )
If IsArray( $aAddress ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit15' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit15' , '{DELETE}' & StringStripWS( $aAddress[0] , 3 ))
EndIf
; Server Port
$aPort = StringRegExp( $aServers[$ii] , '(?i)<Port>(.+)</Port>' , 1 )
If IsArray( $aPort ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit16' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit16' , '{DELETE}' & StringStripWS( $aPort[0] , 3 ))
EndIf
; User Name
$aUser = StringRegExp( $aServers[$ii] , '(?i)<User>(.+)</User>' , 1 )
If IsArray( $aUser ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit17' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit17' , '{DELETE}' & StringStripWS( $aUser[0] , 3 ))
EndIf
; User Password
$aPass = StringRegExp( $aServers[$ii] , '(?i)<Pass>(.+)</Pass>' , 1 )
If IsArray( $aPass ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit18' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit18' , '{DELETE}' & StringStripWS( $aPass[0] , 3 ))
EndIf
; Save Password
If IsArray( $aPass ) AND $aPass[0] <> '' Then
ControlCommand( 'FTP Account Manager' , '' , 'Button20' , 'Check' , '' )
Else
ControlCommand( 'FTP Account Manager' , '' , 'Button20' , 'UnCheck' , '' )
ControlCommand( 'FTP Account Manager' , '' , 'Button22' , 'Check' , '' )
EndIf
; User Account
$aAccount = StringRegExp( $aServers[$ii] , '(?i)<Account>(.+)</Account>' , 1 )
If IsArray( $aAccount ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit19' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit19' , '{DELETE}' & StringStripWS( $aAccount[0] , 3 ))
EndIf
; Initial Directory
$aRemoteDir = StringRegExp( $aServers[$ii] , '(?i)<RemoteDir>(.+)</RemoteDir>' , 1 )
If IsArray( $aRemoteDir ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit20' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit20' , '{DELETE}' & StringStripWS( $aRemoteDir[0] , 3 ))
EndIf
; Connection Limit
$aLimit = StringRegExp( $aServers[$ii] , '(?i)<MaximumMultipleConnections>(.+)</MaximumMultipleConnections>' , 1 )
If IsArray( $aLimit ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit21' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit21' , '{DELETE}' & StringStripWS( $aLimit[0] , 3 ))
EndIf
; Initial Local Directory
$aLocalDir = StringRegExp( $aServers[$ii] , '(?i)<LocalDir>(.+)</LocalDir>' , 1 )
If IsArray( $aLocalDir ) Then
ControlFocus( 'FTP Account Manager' , '' , 'Edit22' )
ControlSend ( 'FTP Account Manager' , '' , 'Edit22' , '{DELETE}' & StringStripWS( $aLocalDir[0] , 3 ))
EndIf
; Apply Changes
ControlClick( 'FTP Account Manager' , '' , 'Button27' )
Next
; Close Dialog
ControlClick( 'FTP Account Manager' , '' , 'Button27' )
; Final Message
MsgBox( 0 , 'Finished:' , 'Batch FileZillia Import Complete.' )
Else
MsgBox( 0 , 'Error:' , 'Could Not Parse SiteManager.xml.' )
EndIf