Subscribe to this thread
Home - General / All posts - Handy batch export script for Manifold 9
gjsa74 post(s)
#30-Oct-19 22:59

Been looking for a script in M9 to batch export items to a chosen directory.

Here's one that does the job (without any error checking):

' VBScript

 

Set app = Manifold.Application

Set db = app.GetDatabaseRoot()

 

Sub Main

 

 root_dir = "D:\temp"

 

 export_type = "query"

 ext = "sql" 

 Call batch_export(root_dir, export_type, ext) 

 

 export_type = "script"

 ext = "vbs"

 Call batch_export(root_dir, export_type, ext) 

 

 export_type = "drawing"

 ext = "shp"

 Call batch_export(root_dir, export_type, ext) 

 

 app.OpenLog

 

End Sub

 

Function batch_export(root_dir, export_type, ext)

 

 Set table = db.Search("mfd_root")

 Set sequence = table.SearchAll(Array("Name""Type"))

 If Not (sequence Is NothingThen

     Do While sequence.Fetch

       fname = sequence.GetValues()(0).Data

       If sequence.GetValues()(1).Data = export_type Then

          db.ExportFile fname, root_dir+"\"+fname+"."+ext

           app.Log "Exporting "+root_dir+"\"+fname+"."+ext

       End If

     Loop

 End If

 

End Function

atrushwo52 post(s)
#30-Oct-19 23:26

Love it.

adamw


8,750 post(s)
#31-Oct-19 08:34

Very clean.

There was a thread discussing similar ideas from a slightly different angle earlier, which resulted in Riivo (rk) posting an add-in:

Mad idea - version control for queries, scripts, schema etc (thread)

Manifold_Dump_Code (add-in)

Manifold User Community Use Agreement Copyright (C) 2007-2019 Manifold Software Limited. All rights reserved.