Ad,
Try the following Mapbasic code. It takes a text file containing a
list of workspace names, opens each one, finds the first layout window
in the workspace, saves it to a jpeg in a folder called Exports,
closes the workspace and proceeds to the next on the list.
You will need to fiddle with the Save Window statements to get your
preferred output format, dimensions and resolution. Also, you will
need to create the text file containing the list of workspaces (Hint:
dir /b /s [path]\*.wor > [path]\list.txt)
Dim iLp, iWMkd, i2, iWin as Integer
Dim sWorksList, sWorks(1), sImg, sWPath, sWNewD as String
sWorksList = FileOpenDlg("","","txt","Select text list of workspaces")
sWPath = pathtodirectory$(sWorksList)
sWNewD = sWPath + "Exports\"
iWMkd = CreateDirectory(sWNewD,0)
Open file sWorksList for input as #1
i = 0
Do While Not EOF(1)
i = i + 1
Redim sWorks(i)
Line Input #1, sWorks(i) '*** Loop stores workspace file
names in string array
Loop
iLp = Ubound(sWorks) - 1
Redim sWorks(iLp)
Statusbar Message Progress()
For i = 1 to iLp
iWin = 0
Run Application sWorks(i)
sImg = PathToDirectory$(sWorks(i)) + "Exports\" + left$
(PathToFileName$(sWorks(i)), len(PathToFileName$(sWorks(i))) - 4) +
".jpg"
For i2 = 1 to NumWindows()
If WindowInfo(i2, WIN_INFO_TYPE) = 3 Then '***
Checks for Layout Window
iWin = WindowID(i2)
Exit For
End If
Next
If iWin > 0 Then
If WindowInfo(iWin, WIN_INFO_PRINTER_ORIENT) = 1 Then '***
Portrait
Save Window iWin As sImg Type "Jpeg" Width 45 Units "cm" Height
63.63 Units "cm" Resolution 150
ElseIf WindowInfo(iWin, WIN_INFO_PRINTER_ORIENT) = 2 Then '***
Landscape
Save Window iWin As sImg Type "Jpeg" Width 64 Units "cm" Height
45.23 Units "cm" Resolution 150
End if
Else
End If
Close All
Next
Have fun with it!
Dave