Andrew,
Thanks for the suggestion and it seems like it should work - but after a considerable amount of trial and error I’m still not getting it. For what it’s worth, I’m on a Linux system. In the MEDM display’s Shell Command ‘Command’ field
I put the executable name - foo.exe - and in the ‘Arguments’ field I put the line you recommend, echo ‘caget -t myPV’, where myPV is the target PV name. This produces an error: “foo.exe: line 1: <myPVvalue>: command not found”, where <myPVvalue> is the current
value of the PV. No variation of the caget command I’ve tried produces the desired result of passing the value of myPV to foo.exe. I can’t get this to work on the Linux command line, either. By any chance, do you have any other suggestions?
Thanks,
Mark
-----Original Message-----
From: Andrew Johnson [mailto:[email protected]]
Sent: Friday, April 18, 2014 11:25 AM
To: Poff, Mark A; [email protected]
Subject: Re: MEDM: Passing PV Values to Shell Commands
Hi Mark,
On 04/18/2014 09:23 AM, Poff, Mark A wrote:
> Is it possible to pass a PV value as the argument of a program call
> from a MEDM Shell Command button? It seems like that would be a
> useful capability, but I can’t find any reference to it. Somebody
> posted this question in Tech-Talk for EDM in 2004 (“EDM: Passing PV
> values to shell
> commands”) but it doesn’t appear that the question was ever addressed.
> Can anybody tell me whether this capability exists and if so, the syntax?
That's a great question. The answer is not directly, but you can have the user select a PV from any widget on the display, and if you make the shell command pass that through `caget -t` you can convert the name into the PV's value before
calling your program.
The Shell Command widget supports embedding the &P operator from the Execute Menu command[1] which prompts the user to point to the PV to be named before executing the command string.
Example: I create a Shell Command widget with a command set to
echo `caget -t &P`
I also put at least one other PV on the screen. When I click the button, the cursor changes to prompt me to click on a widget that will provide the PV name. The caget command is then executed on that PV, and the value returned gets echoed
on the terminal where I started medm.
Of course if your PV name is fixed you don't have to use the &P part at all, you can just name it directly in the caget call:
echo `caget -t myPV`
Hope this helps,
- Andrew
[1]
http://www.aps.anl.gov/epics/EpicsDocumentation/ExtensionsManuals/MEDM/MEDM.html#ExecuteMenu
--
Advertising may be described as the science of arresting the human intelligence long enough to get money from it. -- Stephen Leacock