Check if an app is active, use AVar() - 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: Check if an app is active, use AVar() (/thread-4379.html) |
Check if an app is active, use AVar() - salvomic - 07-18-2015 01:06 PM hi, in Effemeridi (my program for Astronomy) I would get some controls about Astro Lab 4 (the app for Astronomy by Marcel) and use some of its variables (with the kind permission of Marcel). Is it possible to get some of these things? 1. check if Astro Lab 4 is installed and it's the active app 2. call some functions by it (something like Astro_Lab_4.ListNow ...) 3. use its Avars *also* if it's not active app The purpose is to share Avars with the app without duplicate them, also if Astro Lab is not the active app. Thank you for advice and hints. Salvo for example: Code:
or Code:
RE: Check if an app is active, use AVar() - Marcel - 07-18-2015 04:23 PM Hi Salvomic! I know that ti-Nspire can do this because we can declare a library to be public or not and use it where and when we want from any document! This is what I do with Astro Lab 2. On Prime you can do Astro_Lab_4.AVars("name"):=varName and it will work. This is a sort of "public Library"... Marcel RE: Check if an app is active, use AVar() - Marcel - 07-18-2015 04:34 PM Oups... In fact this is OK with DATA but with function I have to try it, because one fonction call other and so on... Marcel RE: Check if an app is active, use AVar() - salvomic - 07-18-2015 04:44 PM (07-18-2015 04:23 PM)Marcel Wrote: Hi Salvomic! (07-18-2015 04:34 PM)Marcel Wrote: Oups... hi Marcel, thank you, however is a good input... I tried this, just now: Code:
It works if Astro Lab 4 is active, and in Effemeridi give for planets (not Pluto for now) the same results as Astro Lab (taken by there!) But if Astro Lab 4 is not active I get error: "unmatch control word". So I need: 1. control if Astro Lab 4 is active or 2. correct syntax to work even if it isn't active. Then I'll study how use Avars from your app (it could be nice to extract some part to elaborate other calculations not already included in the app)... RE: Check if an app is active, use AVar() - Marcel - 07-18-2015 04:55 PM Hi! The DATA is the easy part but how to know if a apps is active or not? I don't know. I will try... Marcel RE: Check if an app is active, use AVar() - salvomic - 07-18-2015 05:52 PM [quote='salvomic' pid='39335' dateline='1437237850'] ...and use this line Code:
is insecure! if the program doesn't exist the program won't compile and gives a syntax error i.e. Code:
RE: Check if an app is active, use AVar() - StephenG1CMZ - 07-18-2015 08:59 PM Could you use IFERR? Something like: Iferr astro... then // not there or other err Else Astro... // all ok Endif RE: Check if an app is active, use AVar() - salvomic - 07-18-2015 10:09 PM (07-18-2015 08:59 PM)StephenG1CMZ Wrote: Could you use IFERR? yes Stephen, using IFERR, this seems to work (but...) Code:
It executes the 5 lines if Atro Lab is active, and changing the IFERR line like IFERR EXPR("Astro_Lab_4xxxxxx()") THEN temp:=0; // change nothing it executes ...nothing, as expected. But if Astro Lab 4 is not active I got always the "unmatch control word" error: I don't understand from where it comes... However now with IFERR we can control if the syntax is ok, but not still *if* the app there is or it's active. Salvo RE: Check if an app is active, use AVar() - Tyann - 07-19-2015 06:58 AM hello Each application has its Avars list. Add an Active Variable : = "name" or number. In Astro: Avars "Active" : = " Astrolab " in Function Avars "Active" : = "Function" Etc ... If Avars "Active" not exist, write Code:
RE: Check if an app is active, use AVar() - salvomic - 07-19-2015 03:28 PM (07-19-2015 06:58 AM)Tyann Wrote: hello I'm trying, thank you. The problem seems still the "unmatch control word" error when Astro Lab is not active, executing its function in the program: also the ELSE path of IFERR gives error and I don't know how to avoid it... Salvo RE: Check if an app is active, use AVar() - salvomic - 07-19-2015 04:56 PM found! thank also to Tyan input. The "unmatch control word" was generated by an error of mine: it was recalled a function of Astro Lab 4 with a similar name, not mine! corrected a "J" in "j" it works also when Astro Lab is not installed with a code like this one: Code:
AVars "lieu" is in Astro Lab 4, we control if it exists, and if not nothing will be changed, otherwise it's used the function PlanetCoordinates() in Astro Lab 4 and the result will be treated into Effemeridi, in some parts: very interesting! I advice to install and use Astro Lab 4, to have a better experience with Effemeridi also. Salvo |