HP Forums
Executing a program directly from a menu - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Executing a program directly from a menu (/thread-8955.html)



Executing a program directly from a menu - webmasterpdx - 09-01-2017 12:38 PM

I'm just curious. Currently, to run a program you select it from the user menu and it gets pasted to the input line and then you hit enter to execute it. Is there a way to run a program directly from a menu selection?....so that the program can operate on the input line's contents?
Thx
-D


RE: Executing a program directly from a menu - toml_12953 - 09-01-2017 02:05 PM

(09-01-2017 12:38 PM)webmasterpdx Wrote:  I'm just curious. Currently, to run a program you select it from the user menu and it gets pasted to the input line and then you hit enter to execute it. Is there a way to run a program directly from a menu selection?....so that the program can operate on the input line's contents?
Thx
-D

If your program starts like this:

EXPORT myprog(x)

then to call your program with 5.2 as an example on home screen

in algebraic mode:
myprog(5.2)
<enter>

in RPN mode:
5.2
<Enter>
myprog(1)


RE: Executing a program directly from a menu - Cristóbal De Jesús - 09-01-2017 07:47 PM

(09-01-2017 02:05 PM)toml_12953 Wrote:  
(09-01-2017 12:38 PM)webmasterpdx Wrote:  I'm just curious. Currently, to run a program you select it from the user menu and it gets pasted to the input line and then you hit enter to execute it. Is there a way to run a program directly from a menu selection?....so that the program can operate on the input line's contents?
Thx
-D

If your program starts like this:

EXPORT myprog(x)

then to call your program with 5.2 as an example on home screen

in algebraic mode:
myprog(5.2)
<enter>

in RPN mode:
5.2
<Enter>
myprog(1)

I deduct that 1 in myprog(1) is the amount of parameters to get from the stack... Am I right?


RE: Executing a program directly from a menu - Tim Wessman - 09-01-2017 09:06 PM

(09-01-2017 07:47 PM)Cristóbal De Jesús Wrote:  I deduct that 1 in myprog(1) is the amount pd parameters to get from the stack... Am I right?

Yes, but this is only needed if the function accepts multiple numbers of arguments. Since user functions currently accept only a fixed number of arguments, that is not necessary and automatic. ENTER will correctly take 1 argument without specifying (1) manually.


RE: Executing a program directly from a menu - webmasterpdx - 09-02-2017 03:18 AM

What did you mean by 5.2?
Also, isn't this doing what I was asking to get around? i.e. Pasting to the input line. I wanted to select it from the menu and have it execute immediately, without being pasted (assuming no parameters....it would get it's input data from it's gui or from the current input line or stack).
Thx
-D


RE: Executing a program directly from a menu - toml_12953 - 09-02-2017 10:34 AM

(09-02-2017 03:18 AM)webmasterpdx Wrote:  What did you mean by 5.2?
Also, isn't this doing what I was asking to get around? i.e. Pasting to the input line. I wanted to select it from the menu and have it execute immediately, without being pasted (assuming no parameters....it would get it's input data from it's gui or from the current input line or stack).
Thx
-D

Sorry! I misunderstood the question. The 5.2 is just used as an example parameter. It has no significance.


RE: Executing a program directly from a menu - webmasterpdx - 09-02-2017 07:57 PM

I think user mode is the soln...