Table of Contents
Ispirer Website
Ispirer Capabilities - PowerBuilder Conversion
Free Trial
PowerBuilder 8.x-12.x - Extracting Source from PBT Files
In order to perform the conversion of the PowerBuilder application first you need to extract the script files of which each PowerBuilder Target (PBT) file consist. These are the files containing the definition of each object used in the application. There is two ways to do this task using tool developed by our team or do it manually from PowerBuilder. One more benefit of using PBExtractor is collecting information about lines of code for each type of file and total amount of this files. All information is saved into “total_information.log”.
NOTE: If you are planning to use SQLWays tool for migration of extracted PowerBuilder files, ensure that it saves them in one of the following encodings:
- ANSI
- UTF-8
Extracting Source from PBT Files Using Tool
- Run PowerBuilder.
- Create workspace.
- Click “New” button:
- Select “Workspace” and click “OK”:
- Type pbextractor to “*.pbw” file and save it.
- Create new application (Menu File→New):
- Select tab “Target”, click on “Application” and click “OK”:
- Specify folder, file name “pbextractor” and press “Finish” button:
- Create New Window.
- Press “New” button:
- Select tab “PB Object” click on “Window”. Make sure that the Target is pbextractor application:
- Add title to window, for example “PbExtractor”:
- Declare members for the window.
- Declare Global Variables for window (you can find it at downloaded file “w_pbextract.srw”):
- Declare Local External Function for window (you can find it at downloaded file “w_pbextract.srw”):
- Add 3 controls “StaticText” to window with names and text as on pictures (you can find it at downloaded file “w_pbextract.srw”).
- Put them inside window’s border on layout editor and call Properties dialog.
- Name and Text for the controls should be like these:
- Add 2 controls “SingleLineEdit” to window with names and text as on pictures (you can find it at downloaded file “w_pbextract.srw”):
- Put them inside window’s border on layout editor and call Properties dialog.
- Name and Text for the controls should be like these:
- Add control “CommandButton” to window with name and text as on picture (you can find it at downloaded file “w_pbextract.srw”):
- Put it inside window’s border on layout editor and call Properties dialog.
- Name and Text for the controls should be like these:
- Place controls on window as on picture (you can find it at downloaded file “w_pbextract.srw”):
- Add script for open event of window (you can find it at downloaded file “w_pbextract.srw”):
- Make right click inside window’s border on layout editor:
- Copy event’s body from file w_pbextract:
- Add functions to window:
- Select (Functions) at dropdown
- Add function “of_parsetoarray” to window (you can find it’s declaration at downloaded file “w_pbextract.srw”) and copy it’s body from file “w_pbextract.srw”:
- To create new function select “(New Function at dropdown)”:
- Add function “of_count_lines” to window (you can find it’s declaration at downloaded file “w_pbextract.srw”) and copy it’s body from file “w_pbextract.srw”:
- Add function “of_extract” to window (you can find it’s declaration at downloaded file “w_pbextract.srw”) and copy it’s body from file “w_pbextract.srw”:
- Add clicked event script for “CommandButton” control (you can find it declaration at downloaded file “w_pbextract.srw”):
- Go to tab “Layout”. Make right click on button in layout editor:
- Copy “Clicked” event’s body from file “w_pbextract.srw”:
- Add open event script for application pbextractor (you can find it declaration at downloaded file “pbextractor.sra”):
- close Window’s editor and save it:
- type w_pbextract as window’s name:
- Make double click on pbextractor at tab “Workspace”. Copy “Open” event’s script body from file “pbextractor.sra”:
- Close designer and save file:
Using PBExtractor
- Run PBExtractor
- Specify the path to PBL or LST file in the first text box “Path to PBL or LST file:”*. The existing pbt or lst file should be specified.
- Specify the folder where the extracted files should be placed in the second text box “Folder for extracted files :”. The Path should end with “\” and the existing directory should be specified.
- Press the “Extract…” button.
Extracting Source from PBT Files Manually
For this purpose please go to the “Tools” menu and run the “Library Painter” as it is specified in the screen-shot below:
In the opened “Library Painter” window please browse to one of the pbt files from your PowerBuilder project, select all the objects in the left-hand pane, click the right mouse button on the selected objects and choose “Export” in the menu, like in the picture below:
After that you will be prompted to specify the location of each object exported, which definition will be stored in its own file (SRD, SRU, SRW, SRF & etc.) in the specified location.
The same set of actions needed to be performed for each PBT file in the project to acquire the definitions of all the objects in the project.