Post Reply 
How to run apps in different directory?
10-13-2014, 02:30 AM
Post: #1
How to run apps in different directory?
Is it possible?

I want to stick all of my custom made "toggle" apps in a folder, but still be able to run them from the CUSTOM menu. Is there some sort of PATH (like on Windows and Linux) I can add the apps folder too?
Find all posts by this user
Quote this message in a reply
10-13-2014, 03:02 AM
Post: #2
RE: How to run apps in different directory?
Identify the calculator for which you seek this information.
Find all posts by this user
Quote this message in a reply
10-13-2014, 03:20 AM
Post: #3
RE: How to run apps in different directory?
(10-13-2014 02:30 AM)ohitsanazn Wrote:  Is it possible?

I want to stick all of my custom made "toggle" apps in a folder, but still be able to run them from the CUSTOM menu. Is there some sort of PATH (like on Windows and Linux) I can add the apps folder too?

I'm assuming you're asking about the 50g since you've asked other questions about that calculator recently.

While there's no PATH-like variable designated for the RPL systems, there is a default behavior defined where the operating system will generally search in the current directory and work upwards through each parent when it attempts to find a referenced global variable (aka. user-stored object). As such, the only location that you could store all of your toggle apps for universal access is in the HOME directory (since that would be found from any location). Items stored in the HOME directory will usually be found simply by using their name as a reference, regardless of which directory the calculator is currently browsing.

That's probably not what you had in mind, but there's several other options (some more advanced than others). Perhaps the easiest would be to store them in preferred location (eg. UTILS / TGL), then in the code for your CUSTOM menu you would simply run the program by placing its name prefaced by the parent directories in braces, then executing with EVAL as follows:

Code:
{ HOME UTILS TGL PROG1 } EVAL
(which of course assumes an executable object with the name "PROG1" in the /UTILS/TGL/ directory)

Note that, when using this method, the current directory is changed to the one containing the referenced object. So you may want to take that into account in your code (see the PATH command).
Find all posts by this user
Quote this message in a reply
10-13-2014, 04:11 AM
Post: #4
RE: How to run apps in different directory?
(10-13-2014 03:20 AM)DavidM Wrote:  
(10-13-2014 02:30 AM)ohitsanazn Wrote:  Is it possible?

I want to stick all of my custom made "toggle" apps in a folder, but still be able to run them from the CUSTOM menu. Is there some sort of PATH (like on Windows and Linux) I can add the apps folder too?

I'm assuming you're asking about the 50g since you've asked other questions about that calculator recently.

While there's no PATH-like variable designated for the RPL systems, there is a default behavior defined where the operating system will generally search in the current directory and work upwards through each parent when it attempts to find a referenced global variable (aka. user-stored object). As such, the only location that you could store all of your toggle apps for universal access is in the HOME directory (since that would be found from any location). Items stored in the HOME directory will usually be found simply by using their name as a reference, regardless of which directory the calculator is currently browsing.

That's probably not what you had in mind, but there's several other options (some more advanced than others). Perhaps the easiest would be to store them in preferred location (eg. UTILS / TGL), then in the code for your CUSTOM menu you would simply run the program by placing its name prefaced by the parent directories in braces, then executing with EVAL as follows:

Code:
{ HOME UTILS TGL PROG1 } EVAL
(which of course assumes an executable object with the name "PROG1" in the /UTILS/TGL/ directory)

Note that, when using this method, the current directory is changed to the one containing the referenced object. So you may want to take that into account in your code (see the PATH command).

This solution works, but is there a way to change the label of the soft key?

50g | 48g+ | 38g
Former TI user -- still need to bust out the 84 on tests though
Find all posts by this user
Quote this message in a reply
10-13-2014, 04:44 AM
Post: #5
RE: How to run apps in different directory?
(10-13-2014 04:11 AM)ohitsanazn Wrote:  This solution works, but is there a way to change the label of the soft key?

From the 50g Users Manual, page 20-4:
Quote:Menu specification and CST variable

... the most general menu specification list includes a number of sub-lists equal to the number of items to be displayed in your custom menu. Each sub-list contains a label for the menu key followed by a function, expression, label, or other object that constitutes the effect of the menu key when pressed. ...

... in RPN mode, the argument list has this format
{“label1”, function1, ls1, rs1}, {“label2”, function2, ls2, rs2},…}

In these specifications, function1, function 2, etc., represent the main operation of the key, while ls1, ls2, …, etc., represent the left-shift operation of the key.

Similarly, rs1, rs2, …, etc., represent the right-shift operation of the key. This list will be stored in variable CST if command MENU is used. You can have a different CST variable in each sub-directory, and you can always replace the current contents of CST with those of other variables storing the properly formatted list to produce another custom menu.

So, yes, you can change the label simply by changing the string in the appropriate position of the list shown above ("label1", "label2", etc.).

For example, if you wanted your custom menu to include two items ("foo" and "bar"), each of which executed different programs in the /UTILS/TGL subdirectory of your calculator, you might do something like the following:

Code:
{
   { "foo" << PATH { HOME UTILS TGL PROG1 } EVAL EVAL >> }
   { "bar" << PATH { HOME UTILS TGL PROG2 } EVAL EVAL >> }
}
MENU
Find all posts by this user
Quote this message in a reply
10-13-2014, 06:48 PM
Post: #6
RE: How to run apps in different directory?
(10-13-2014 04:44 AM)DavidM Wrote:  
(10-13-2014 04:11 AM)ohitsanazn Wrote:  This solution works, but is there a way to change the label of the soft key?

From the 50g Users Manual, page 20-4:
Quote:Menu specification and CST variable

... the most general menu specification list includes a number of sub-lists equal to the number of items to be displayed in your custom menu. Each sub-list contains a label for the menu key followed by a function, expression, label, or other object that constitutes the effect of the menu key when pressed. ...

... in RPN mode, the argument list has this format
{“label1”, function1, ls1, rs1}, {“label2”, function2, ls2, rs2},…}

In these specifications, function1, function 2, etc., represent the main operation of the key, while ls1, ls2, …, etc., represent the left-shift operation of the key.

Similarly, rs1, rs2, …, etc., represent the right-shift operation of the key. This list will be stored in variable CST if command MENU is used. You can have a different CST variable in each sub-directory, and you can always replace the current contents of CST with those of other variables storing the properly formatted list to produce another custom menu.

So, yes, you can change the label simply by changing the string in the appropriate position of the list shown above ("label1", "label2", etc.).

For example, if you wanted your custom menu to include two items ("foo" and "bar"), each of which executed different programs in the /UTILS/TGL subdirectory of your calculator, you might do something like the following:

Code:
{
   { "foo" << PATH { HOME UTILS TGL PROG1 } EVAL EVAL >> }
   { "bar" << PATH { HOME UTILS TGL PROG2 } EVAL EVAL >> }
}
MENU

Alright. I'm all squared out now. Thanks!

50g | 48g+ | 38g
Former TI user -- still need to bust out the 84 on tests though
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)