User Tools

Site Tools


settings_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
settings_scripts [2022/04/01 18:30]
antreas
settings_scripts [2023/11/22 17:58] (current)
chris
Line 1: Line 1:
 ===== External script ===== ===== External script =====
-External scripts ​is the functionality ​provided by PMA.core to configure and execute command line scripts ​via  PMA.core itself. ​+External scripts ​are a method ​provided by PMA.core to configure and execute command line programs ​via PMA.core itself. ​
  
 {{ ::​external_scripts.jpg?​600 |}} {{ ::​external_scripts.jpg?​600 |}}
  
 ==== Adding a new script ==== ==== Adding a new script ====
-To configure a new script you need to provide the following information describing the script ​you want to execute and the parameters passed to it+To configure a new script you need to provide the following information describing the application ​you want to execute and the parameters passed to it
 ^ Setting ^ Description ^ ^ Setting ^ Description ^
-|Name| A unique name for the script used to fetch it and distinguish from other| +|Name| A unique name for the scriptused to fetch and distinguish from other scripts
-|Command| The command line to execute, a bat file, cmd file or exe|+|Command| The command line to execute, a batch file, cmd or .exe file|
 |Arguments| The arguments passed to the script | |Arguments| The arguments passed to the script |
 |Parameters| A dynamic list of parameters passed to the script by PMA.core| |Parameters| A dynamic list of parameters passed to the script by PMA.core|
Line 19: Line 19:
 {{ :​external_scripts_add.jpg?​600 |}} {{ :​external_scripts_add.jpg?​600 |}}
  
-==== Executing an script ​==== +==== Parameters & command line arguments ​==== 
-To execute ​an external ​script ​after adding ​and configuring ​it you have to utilize ​the  +The parameters define which query string parameters PMA.core should attempt to parse from the URL when a script is invoked. Then, the values of these parameters can be passed as command line arguments to the script, provided that they also appear in the arguments list contained within the braces.  
-[[https://​docs.pathomation.com/​pma.core.api/#/​Script/​ExternalScripts_Run|Scripts Run]] API + 
 +Here'​s ​an example: 
 +Let's assume we want to invoke a python ​script and pass it a path and a number argument. We would end up with the following configuration:​ 
 + 
 +^ Option ^ Value ^ 
 +| Number | PythonScriptTest | 
 +| Command| python.exe | 
 +| Arguments | d:​\scripts\python_test.py -p {slide_path} -n {some_number} -i 123 | 
 +| Parameters | slide_path - type = path, some_number - type = number | 
 + 
 +We would invoke this script by crafting the following URL: 
 + 
 +<​code>​http(s)://​pma.core.url/​scripts/​Run?​sessionId=your-session-id&​name=PythonScriptTest&​slide_path=images/​collection1/​slide1.svs&​some_number=10</​code>​ 
 + 
 + 
 + 
 +Then PMA.core would extract and validate the values "​images/​collection1/​slide1.svs"​ and "​10"​ and pass them on to the command, by replacing {slide_path} and {some_number} respectively. The resulting script looks like this: 
 + 
 + 
 +''​python.exe d:​\scripts\python_test.py -p "​images/​collection1/​slide1.svs"​ -n 10 -i 123''​ 
 + 
 + 
 +After successful execution, the complete output of the command invocation is returned to the client. 
 + 
 + 
 +See also the [[https://​docs.pathomation.com/​pma.core.api/#/​Script/​ExternalScripts_Run|Scripts Run]] API.
settings_scripts.1648827005.txt.gz · Last modified: 2022/04/01 18:30 by antreas