It's not clear to me whether you are trying to start one A5 app from another A5 app (which was what I thought when reading your first post) or trying to install an A5 app after the A5 runtime has been installed - which is what I'm thinking after reading the later posts.
If you are starting one app from another app, of course the A5.Get_Exe_Path() command will tell you where A5 is but it won't tell you where the other application files are. That would be a completely separate issue.
If you are doing an initial install, a good third party installer should be able to read the registry. In that case, I think you can just tell it to look for HKey_Current_User\Software\Alpha Software\Alpha Five 11.0\RTExeLocation and use the value in that location as the path to the runtime. There is one caveat here - I'm not certain whether or not the runtime needs to run once before that registry value will exist. I'll leave that up to you or someone else to verify.
My personal preference is to use a third party installer and have the installer install both the runtime and the application with the application in a subfolder under the runtime. This way the installer can be set up to create the correct shortcut in the first place. I do NOT recommend installing the runtime in any Program Files folder - especially since I'm putting the application under the exe folder! Since my company name is AIMS DataCom, my default is to install the runtime to C:\AIMS_DC but I allow the user to install to any folder or drive. (I also remove a lot of the runtime files when I do that because, for example, my apps seldom use any of the 3800+ files in the css folder and I don't want to waste the user's time and computer space installing them. In most cases I just install the main runtime files, the Themes folder, the AmyUni folder, and the FunctionHelp folder. I'm not sure why anymore and it doesn't make any sense to me but I recall having a problem if I didn't install the FunctionHelp folder. Of course, if you are using any specific StyleSheet Bitmaps, CSS files, etc. then those would need to be included in your installation - but only those you are using; not all 3800+ bitmaps.)
Once I have my "install" installer working correctly, I then create an "update" installer that simply doesn't install the runtime and doesn't overwrite any of the data files (.dbf, .cdx, and .fpt). By putting empty data files (or at least no user data) in the update routine and setting them to "Do Not Overwrite", users can "restore" a missing file if necessary (of course, they wouldn't have any data so this would only be an emergency solution if they don't have a proper backup) and, far more importantly, I can easily add new tables when needed for a new feature as part an update without worrying that someone will overwrite existing data.
As I re-read the above, I realized that I need to clarify some issues regarding registry entries:
My "install" installer initially tries to get the runtime location from the registry. If it finds that, then it installs to that location. If not, then it installs to the default folder I've selected or whatever folder the user selects.
My "update" installer doesn't install the runtime so it only needs to know where the app is. Consequently, it looks for a registry value that I set every time the autoexec runs. That way it will always be up to date even if the user moves the app. (Most users don't move the app but I had one that knew enough about A5 and did.) And the time to update it isn't much of an issue since my check showed that it took about 0.000 milliseconds - i.e., the time wasn't even enough to register. I call this registry value my "DataPath" and I store it in the registry under HKey_Current_User\Software\<MyCompanyName>\<MyAppName>\DataPath. If this registry entry does NOT exist then the installer shows a warning about that and shuts down. To create this value in the registry, my autoexec has the following commands that can be copied to any app - although you'll probably want to change the company name:
Code:
IF a5.get_master_path() <> "" 'Shadowed datapath = a5.Get_Master_Path() + chr(92) ELSE 'Not shadowed datapath = a5.Get_Path() + chr(92) END IF adbname = file.filename_parse( a5.Get_Name(), "N" ) Registry.sys_create( "HKEY_CURRENT_USER\Software\AIMS DataCom\\" + adbname + "\DataPath", datapath )
Note also that this "datapath" points to the server if there is one. This means that you can run an application update from any workstation. I had one customer who had his server in a locked closet so this worked really well for me when he wasn't around to unlock the closet. (Yes, his employees had messed with his server once too often and he decided to put a stop to it.) Of course, each workstation will have to update after the server is updated but that can be handled with either a manual or automatic update based on however you set up the application.
Leave a comment: