Is it possible to export all data from a Portfolio Catalogue by scripting?
You can either use VB or AppleScript (Win vs. Mac) to do the script. For a more low tech route, use the "File -> Export -> Text file" route to produce a data file you can then parse with another app.
As a pure scripting approach, why not try this (pseudocode):
'Find' your target records for export into a Gallery
Make this the active Gallery
For Each Record in the Gallery
With the Record
For Each Field in the Record
With the Field
Write the wanted data to a file, array or database
Close the Gallery.
The (v5) TLB has no ExportText function. However, you could use SendKeys to pass the text export shortcut Ctrl+Shift+T and then an enter etc. By default this would pass all the existing fields' data to a tab-delimited text file named as per the Catalogue file, in that Catalogue's folder. As Portfolio is single instance app you only need to check for the "Portfolio" part of the task name to find the app. This saves checking you have appended the right Catalogue name to the app name, though make sure the right catalogue is the active one if you go this route.
Here's some code for the quick & dirty method mentioned above (sample tested with VB6 & Portfolio v4.1.1 under Win 98SE. No error checking at all done here.):
(Assuming TEST.FDB is in C:\ this code will create a text file export of all Fields of all *selected* Records in the active Gallery. File will be created as name of .FDB in FDB's location, i.e. C:\TEST.TXT.)
Private Sub Command1_Click()
'Send Ctrl+Shift+T to open text export dialog
SendKeys "^+(T)", True
'Send Enter to accept default 'Export' button
SendKeys "~", True
'Send Alt+S to activate 'Save' key
SendKeys "%(S)", True
Note in the AppActivate we only call "Portfolio". See my last message and the VB Help topic for AppActivate to see why.
Question: Exporting to text via scripting [FAQ00124.htm]
Last Update:- 01 June 2006
Site and articles © Mark Anderson 2001-2007 - Visit my home page