X-Functions whose names begin with dlg
may be called in your scripts to facilitate dialog-based interaction.Name | Brief Description |
---|---|
dlgChkList | Prompt to select from a list |
dlgFile | Prompt with an Open File dialog |
dlgPath | Prompt with an Open Path dialog |
dlgRowColGoto | Go to specified row and column |
dlgSave | Prompt with a Save As dialog |
dlgTheme | Select a theme from a dialog |
Possibly the most common such operation is to select a file from a directory. The following line of script brings up a dialog that pre-selects the PDF file extension (group), and starts at the given path location (init):
dlgfile group:=*.pdf init:="C:\MyData\MyPdfFiles"; type %(fname$); // Outputs the selected file path to Script Window
The complete filename of the file selected in the dialog, including path, is stored in the variable fname$. If init is left out of the X-Function call or cannot be found, the dialog will start in the User Files folder.
The dlgsave X-Function works for saving a file using a dialog.
dlgsave ext:=*.ogs; type %(fname$); // Outputs the saved file path to Script Window
The type.remind() method provides another way to open a dialog for user interaction. This method creates a private reminder message dialog. An Ini file is used to initialize the dialog. Each section in the ini file is used for a single message. The same functionality can be created in Origin C using the global function PrivateReminderMessage.
For more information, see type.remind().