ShellExecute - method of the Pm object
Description:
Running or printing the file or the registered document.
Syntax:
Long ShellExecute(String sOperation, String sFile, String sParameters, String sFolder, Long nShow)
Parameters:
sOperation | (String) Type of operation with the file. If the parameter is empty string, then the "open" value is set.
"open" - The file has to be opened along with the associated application
"print" - The file has to be printed |
sFile | (String) The file name with the path.
If a full path is not entered, then it is completed relative to the application folder.
It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders. |
sParameters | (String) Parameters that have to be passed to the application associated to the running file |
sFolder | (String) Path to the working folder of the application.
It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders. |
nShow | (Long) Display mode of the application associated to the file:
0 - hidden
1 - normal active
2 - minimized active
3 - maximized active
4 - normal not active
6 - minimized not active |
---|
Return value:
If the operation passed successfully, then the method returns the 0 value, otherwise it returns the error number:
1 - out of memory
3 - the specified file has not been found
4 - the specified path has not been found
Note:
The method serves to running or printing a
*.exe file or the file that is registered in
Windows OS along with the associated application.
This method
is not functional in
Web panels.
Example1:
Print the text file "experiment.htm" in the InternetExplorer:
JavaScriptVBScriptSelect and copy to clipboard
Pm.ShellExecute("print", "#app:experiment.htm", "", "#app:", 0);
Pm.ShellExecute "print", "#app:experiment.htm", "", "#app:", 0
Example2:
Displays the Windows system window for the network printer "\\SERVER\PRINTER1:"
JavaScriptVBScriptSelect and copy to clipboard
Pm.ShellExecute("", "\\\\\\\\SERVER\\\\PRINTER1", "", "", 0);
Pm.ShellExecute "", "\\SERVER\PRINTER1", "", "", 0
Example3:
Launching the PowerPoint application.
JavaScriptVBScriptSelect and copy to clipboard
Pm.ShellExecute("open", "C:\\\\PowerPoint\\\\presentation.pps", "", "C:\\\\PowerPoint\\\\", 1);
Pm.ShellExecute "open", "C:\PowerPoint\presentation.pps", "", "C:\PowerPoint\", 1
Example4:
Opening a local pdf file in the Edge Web browser.
JavaScriptVBScriptSelect and copy to clipboard
var sPathBrowser = "c:/Program Files (x86)/Microsoft/Edge/Application/";
Pm.ShellExecute("open", sPathBrowser + "msedge.exe", "c:/download/filename.pdf", sPathBrowser, 3);
Dim sPathBrowser
sPathBrowser = "c:/Program Files (x86)/Microsoft/Edge/Application/"
Pm.ShellExecute "open", sPathBrowser & "msedge.exe", "c:/download/filename.pdf", sPathBrowser, 3