HP Prime: run a program in another program



#5

Hello friends:

I have a program that asks 5 external variables and call the grid. A second program has 8 external variables to call gutter. I need this second program run first, adding the result with their external variables. Which command need to include for the program run Trough the grid, without me having to run before the Grid program? Because that's what's happening. I have to run before the Grid program, and then run the program.

Can someone help me?

Thank You

David


#6

Hi Friend,


May be you can use the powerfull commad EXPR.

Example: I have a choose command to select what program to run then execute the program.


//programs definition

PROGRAM2();

PROGRAM3();

...

EXTERNAL PROGRAM1

BEGIN

IF CHOOSE(option,... PROGRAMS LIST... ) THEN

EXPR("PROGRAM"+option+"()"); // will execute PROGRAM2 OR 3 ...

END;

END;

In the PROGRAMx you can create a list to return values to use in the rest of PROGRAM1.

Hope these help You, Best regards!!

jose


#7

Quote:
Hi Friend,

May be you can use the powerfull commad EXPR.

Example: I have a choose command to select what program to run then execute the program.


//programs definition

PROGRAM2();

PROGRAM3();

...

EXTERNAL PROGRAM1

BEGIN

IF CHOOSE(option,... PROGRAMS LIST... ) THEN

EXPR("PROGRAM"+option+"()"); // will execute PROGRAM2 OR 3 ...

END;

END;

In the PROGRAMx you can create a list to return values to use in the rest of PROGRAM1.

Hope these help You, Best regards!!

jose


Another method:

EXPORT PROGRAM1()
BEGIN
… source code for program 1 …
END;

EXPORT PROGRAM2()
BEGIN
… source code for program 2 …
PROGRAM1(); // run program 1 as the last thing to do inside program 2
END;

This works for any number of programs. All you need to do is make sure to EXPORT each program you wish to use within other programs. They need not be within one source file, either.

Edited: 11 Nov 2013, 7:46 p.m.


#8

The only problem with this approach is that all the called exported programs will annoyingly appear in the main Toolbox User Program Functions list, unless you group them under a separate main program name. What would be really helpful would be some sort of main program declaration, which could call subroutines that would not appear as global programs or functions.


#9

PROGRAM1()
BEGIN
… source code for program 1 …
END;

EXPORT PROGRAM2()
BEGIN
… source code for program 2
PROGRAM1(); // run program 1 as the last thing to do inside program 2
END;

Fixed! Magic! :-)

TW


#10

Syntax error !

Edit. I forgot that the called program(s) need to be placed before the calling program, because this is not a compiler. Works good now.

Edited: 11 Nov 2013, 9:09 p.m.

#11

Ok, my friends:

I will follow all these guidelines to view the result.

Thank You

David


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP35s Program Four Slings Lift Calculation Jean-Marc Biram (Australia) 2 2,155 12-16-2013, 07:21 PM
Last Post: Jean-Marc Biram (Australia)
  HP35s Calculator Max Rope Tension Program Jean-Marc Biram (Australia) 10 4,280 12-12-2013, 12:03 AM
Last Post: Jean-Marc Biram (Australia)
  Sending little images to the Prime (...and Program name bug?) Erwin Ried 19 7,186 12-10-2013, 05:35 PM
Last Post: Erwin Ried
  WP-34S (Emulator Program Load/Save) Barry Mead 1 1,776 12-09-2013, 05:29 PM
Last Post: Marcus von Cube, Germany
  Problem with debug HP prime program, somebody help me? Carlos CM (Mexico) 6 3,267 12-05-2013, 03:07 PM
Last Post: Carlos CM (Mexico)
  Difficulties with IRR Program Jose Gonzalez Divasson 4 2,312 12-02-2013, 02:34 AM
Last Post: cyrille de Brébisson
  HP PRIME: APP program code DISAPPEARS !! Joseph Ec 0 1,175 11-25-2013, 11:35 AM
Last Post: Joseph Ec
  Polynomial program Michael Carey 12 3,695 11-20-2013, 08:43 PM
Last Post: CR Haeger
  Prime: Placing more than 1 item on the RPN stack in a single program? John Colvin 4 2,209 11-19-2013, 08:59 AM
Last Post: Miguel Toro
  Prime: Program size limited to 64K? Erwin Ried 4 1,989 11-17-2013, 11:42 PM
Last Post: Joseph Ec

Forum Jump: