'script retrieves all scripts from OT and stores it in current directory 'in current directory following folders have to exist:globalScripts,folderScripts,globalforms,folderforms Dim objApp,objSession,scriptsG,scriptsF Dim script Dim AllFolders Dim formsF,formF Dim formsG,formG Dim objFS, objFile Dim CurrentDirectory Dim newfolderpath,newdir Set objApp = CreateObject ("OtAut.OtApplication") Set objSession = objApp.MakeSession ("localhost", 5085, "superuser", "superuser") Set objFS = CreateObject("Scripting.FileSystemObject") CurrentDirectory = objFS.GetAbsolutePathName(".") On Error Resume Next WScript.Echo "Global scripts:" set scriptsG=objSession.GlobalScripts for each script in scriptsG WScript.Echo (CurrentDirectory&"\globalScripts\"&script.Name&".vbs") Set objFile = objFS.CreateTextFile(CurrentDirectory&"\globalScripts\"&script.Name&".vbs") objFile.WriteLine(script.Script) objFile.Close() Next If Err.Number Then WScript.Echo "Error saving :"&CurrentDirectory&"\globalScripts\"&script.Name&".vbs" End If On Error Resume Next WScript.Echo "Folder scripts:" set AllFolders=objSession.RequestFolders for each folder in AllFolders set scriptsF=folder.Scripts WScript.Echo "Folder:"&folder.Name for each script in scriptsF newfolderpath=CurrentDirectory&"\folderScripts\"&folder.Name If Not objFS.FolderExists(newfolderpath) Then Set newdir = objFS.CreateFolder(newfolderpath) End if WScript.Echo (CurrentDirectory&"\folderScripts\"&folder.Name&"\"&script.Name&".vbs") Set objFile = objFS.CreateTextFile(CurrentDirectory&"\folderScripts\"&folder.Name&"\"&script.Name&".vbs") objFile.WriteLine(script.Script) objFile.Close() Next Next If Err.Number Then WScript.Echo "Error saving :"&CurrentDirectory&"\folderScripts\"&folder.Name&"\"&script.Name&".vbs" End If On Error Resume Next WScript.Echo "Global frames:" set formsG=objSession.GlobalForms for each formG in formsG WScript.Echo (CurrentDirectory&"\globalforms\"&formG.Name) Set objFile = objFS.CreateTextFile(CurrentDirectory&"\globalforms\"&formG.Name&".xml") objFile.WriteLine(formG.Data) objFile.Close() Next If Err.Number Then WScript.Echo "Error saving :"&CurrentDirectory&"\globalforms\"&formG.Name&".xml" End If On Error Resume Next WScript.Echo "Folder frames:" set AllFolders=objSession.RequestFolders for each folder in AllFolders set formsF=folder.Forms WScript.Echo "Folder:"&folder.Name for each formF in formsF newfolderpath=CurrentDirectory&"\folderforms\"&folder.Name If Not objFS.FolderExists(newfolderpath) Then Set newdir = objFS.CreateFolder(newfolderpath) End if WScript.Echo (CurrentDirectory&"\folderforms\"&folder.Name&"\"&formF.Name) Set objFile = objFS.CreateTextFile(CurrentDirectory&"\folderforms\"&folder.Name&"\"&formF.Name&".xml") objFile.WriteLine(formF.Data) objFile.Close() Next Next If Err.Number Then WScript.Echo "Error saving :"&CurrentDirectory&"\folderforms\"&folder.Name&"\"&formF.Name&".xml" End If objSession.logOff()
After running this script use SVN commands on created directories. I’d recommend also to add this script to Windows Task Scheduler and commit changes on regular basis.