Sw4   >   Tools   >   Tools
The Omnis Studio blowsfish external object can be used to encrypt and decrypt strings. The oEncryptDecrypt object in swBase4 provides you with several methods that make it very easy to use the blowfish external object.
The oEncryptDecrypt object can be used to encrypt (and later decrypt) a string, row, or list.
The following pairs of public methods accomplish this.
To use the oEncryptDecrypt object.
; Encrypt the list.
Do oEncryptDecrypt.$encryptList(List) Returns EncryptedBinVar
; Decrypt the list.
Do oEncryptDecrypt.$decryptList(EncryptedBinVar) Returns List
The object class oExportImportData can be used to export a list of records to a file.
The default export/import format when the object is instantiated is a tab delimited text file. You can change the format by assigning a different export format constant.
; Set the export format to be used for export and import operations.
Do oExportImportData.$:ExportFormat.$assign(kEXcommas)
The export formats are listed in the
The following code shows how you might use this object to export a list of records to a file.
; Export a list of records to a tab delimited file.
; Prompt the user for a file directory and name.
Calculate Title as "Export Data File Name and Location"
Calculate FilePath as con('ExportRecords.txt')
; FileOps.$putfilename(path[,prompt,filter,initial-directory,appflags])
Do FileOps.$putfilename(FilePath,Title,,cLastFilePath) Returns FlagOK
If not(FlagOK)
; User has cancelled. Not an error.
Calculate FlagOK as kTrue
Else
; Remember the last file path for the next prompt.
Calculate cLastFilePath as FilePath
; Export the data.
; $exportList(pfList,pFilePath,pbInclColNames)
Calculate bInclColNames as kTrue
Do oExportImportData.$exportList(ExportList,FilePath,bInclColNames) Returns FlagOK
End If
If not(FlagOK)
Do errhndlr.$promptonceLastError()
End If
Quit method FlagOK
The $exportList method will automatically overwrite the specified file if it exists.
The oOpenFile object will open a specified file in the user's default application for the file type. e.g. A PDF file would be opened in Adobe Acrobat Reader or Preview.
; Prompt the user to select a file.
Do FileOps.$getfilename(FilePath,'Select a PDF or Text file to open') Returns bFileSelected
Calculate FlagOK as kTrue ;; Preset the flag to true.
If bFileSelected
; Open the file.
Do oOpenFile.$openFile(FilePath) Returns FlagOK
End If
If not(FlagOK)
Do errhndlr.$promptonceLastError()
End If
Quit method FlagOK
Click the
button in the to try it out. Feel free to copy and paste the code.The oOpenFile object also has a series of $setFileInfo... methods which can be used to set the file info on the Mac platform and extension so that the file will be opened with the correct application when the user double-clicks on the file to open it up.
Do oOpenFile.$setFileToEXCEL(FilePath) Returns FlagOK
Do oOpenFile.$setFileToHTML(FilePath) Returns FlagOK
Do oOpenFile.$setFileToJPG(FilePath) Returns FlagOK
Do oOpenFile.$setFileToPDF(FilePath) Returns FlagOK
Do oOpenFile.$setFileToWORD(FilePath) Returns FlagOK
The oOpenURL object will open a specified URL in the user's default web browser.
Calculate URL as 'www.vencor.ca'
; Open the URL in the user's default browser.
Do oOpenURL.$openURL(URL) Returns FlagOK
If not(FlagOK)
Do errhndlr.$promptonceLastError()
End If
Quit method FlagOK
The object class, oVersions, contains the version information for each library.
The versions object have property methods which return information about the current version of the library.
The versions objects are subclassed from swBase4.oVersions_abstract. The $:Release... property methods should be overridden in the subclass and the return values set as applicable for the containing library.
The versions object action method $retModsList returns a list of all the modifications made in the library. Parameters allow the sender to specify the date range to be included. The modifications list is compiled from the @MOD tags found the the methods of classes contained in the library.
The @MOD tags must be in the format:
; @MOD:1 Information about the 1st modification to the method. ;; yyyy-mm-dd Developer Name
; @MOD:1 Additional information about the same modification ;; yyyy-mm-dd Developer Name
; @MOD:2 Information about the 2nd modification to the method. ;; yyyy-mm-dd Developer Name
StudioWorks developers can add $update... methods to the versions objects. The $update... methods could include code that needs to be run when upgrading the application from one version to then next. The main library startup task could have a method which checks the current version and if necessary runs the applicable oVersion object update methods.