Problem using custom Windows shortcuts in Celestia education
Posted: 14.05.2010, 23:29
Hi everyone;
I could really use your help in solving what so far, has been an intractable problem. As many of you may know, I offer a series of educational journeys for use in Celestia. You can find them all for download on the motherlode. Each journey consists of an Activity document written in MS Word (OpenOffice will also work fine), a student worksheet for students to complete, and a set of customized addons that are arranged and tailored for use in each journey. These activities use a customized version of Celestia called Celestia160-ED.
The educational offering includes a fully functional version of Celestia plus lots of other files (2.5 GB), all installed into its own directory on a user's PC. The default directory for installation is C:\Program Files\Celestia160-ED.
To use an Activity, a user first double-clicks on a specific Windows shortcut that launches Celestia160-ED.exe. That shortcut contains a specific hard-coded command line that tells Celestia to consult a specific config file in order to launch the application. That custom cfg file in turn, contains code that loads only certain add-ons, sets custom parameters for Celestia160-ED to open with, calls a specific start.celx script file, etc. Since I have 12 educational journeys, I have 12 hard-coded Windows shortcut files, each with a different command line. Here is a screenshot of the Properties menu in one such shortcut:
The command line is in the Target field, and ends with " --conf Activity3-160.cfg"
This all works great, but a problem is now surfacing. This Windows shortcut has to be hard-coded because of the command line. As such, the "Target" line, and the "Start in" line must have values in it specifying what directory to look in to locate Celestia160-ED, and its proper cfg files. For the longest time, I have simply used the default directory that I recommend all users install the educational activities into, namely; "C:\Program Files". This works fine IF and only IF a user installs Celestia160-ED into that directory.
However, if they do not, and choose to install Celestia-ED into a different drive such as "D:\Program files", or "J:\Apps", or .... then the shortcut cannot find the directory, and none of the shortcuts work at all. A user has to open the Properties menu of each shortcut and manually change the "Target" and "Start in" lines to reflect the directory he loaded Celestia160-ED into.
This problem recently became worse with the release of Windows 7. Windows 7 automatically places all 32 bit programs into a new directory called "C:\Program Files (x86)". Consequently, NONE of the Activities now work on Windows 7, until the user edits all the shortcuts.
Marco Klunder and I have been researching a fix for this and have tried many things ... so far without success. We tried using general Windows "environment variables" in place of the directory path. For example, I substituted C:\program files, with %programfiles% in each of the two lines. The "Target" line would then read,
"%programfiles%\Celestia160-ED\celestia160-ED.exe" -- conf Activity3-160.cfg. Likewise, the Start In line would read, "%programfiles%\Celestia160-ED"
It doesn't work. If a user has installed the educational activities on any drive other than C:, they get an error message that Celestia cannot find the cfg file.
Marco and I have tried setting a custom environment variable. That didn't work either, since the user does not have their own custom environment variable on their system.
The problem seems to be in the "Start in" line. The shortcut just loses its way, until the user edits all the shortcuts and types the exact path to the Celestia160-ED folder in that line. That is really something a user should not have to do. Many of the users are kids and I don't want them having to edit Windows shortcut Properties menus.
Does anyone have any suggestions here? Is there an "environment variable" I'm unaware of that can be typed as the directory address for both the Target and Start In lines, that will point the shortcut to a folder or app or file where-ever it is installed on a PC?
Alternatively, I am using the program "Inno Installer" to create the Windows installer file for the educational activities. Is there a line I can type in Inno Installer that will create dynamic Windows shortcuts at the time of installation, that INCLUDE the command line parameter I need?
Thank you so much in advance for any help you can give us.
Regards
Frank
I could really use your help in solving what so far, has been an intractable problem. As many of you may know, I offer a series of educational journeys for use in Celestia. You can find them all for download on the motherlode. Each journey consists of an Activity document written in MS Word (OpenOffice will also work fine), a student worksheet for students to complete, and a set of customized addons that are arranged and tailored for use in each journey. These activities use a customized version of Celestia called Celestia160-ED.
The educational offering includes a fully functional version of Celestia plus lots of other files (2.5 GB), all installed into its own directory on a user's PC. The default directory for installation is C:\Program Files\Celestia160-ED.
To use an Activity, a user first double-clicks on a specific Windows shortcut that launches Celestia160-ED.exe. That shortcut contains a specific hard-coded command line that tells Celestia to consult a specific config file in order to launch the application. That custom cfg file in turn, contains code that loads only certain add-ons, sets custom parameters for Celestia160-ED to open with, calls a specific start.celx script file, etc. Since I have 12 educational journeys, I have 12 hard-coded Windows shortcut files, each with a different command line. Here is a screenshot of the Properties menu in one such shortcut:
The command line is in the Target field, and ends with " --conf Activity3-160.cfg"
This all works great, but a problem is now surfacing. This Windows shortcut has to be hard-coded because of the command line. As such, the "Target" line, and the "Start in" line must have values in it specifying what directory to look in to locate Celestia160-ED, and its proper cfg files. For the longest time, I have simply used the default directory that I recommend all users install the educational activities into, namely; "C:\Program Files". This works fine IF and only IF a user installs Celestia160-ED into that directory.
However, if they do not, and choose to install Celestia-ED into a different drive such as "D:\Program files", or "J:\Apps", or .... then the shortcut cannot find the directory, and none of the shortcuts work at all. A user has to open the Properties menu of each shortcut and manually change the "Target" and "Start in" lines to reflect the directory he loaded Celestia160-ED into.
This problem recently became worse with the release of Windows 7. Windows 7 automatically places all 32 bit programs into a new directory called "C:\Program Files (x86)". Consequently, NONE of the Activities now work on Windows 7, until the user edits all the shortcuts.
Marco Klunder and I have been researching a fix for this and have tried many things ... so far without success. We tried using general Windows "environment variables" in place of the directory path. For example, I substituted C:\program files, with %programfiles% in each of the two lines. The "Target" line would then read,
"%programfiles%\Celestia160-ED\celestia160-ED.exe" -- conf Activity3-160.cfg. Likewise, the Start In line would read, "%programfiles%\Celestia160-ED"
It doesn't work. If a user has installed the educational activities on any drive other than C:, they get an error message that Celestia cannot find the cfg file.
Marco and I have tried setting a custom environment variable. That didn't work either, since the user does not have their own custom environment variable on their system.
The problem seems to be in the "Start in" line. The shortcut just loses its way, until the user edits all the shortcuts and types the exact path to the Celestia160-ED folder in that line. That is really something a user should not have to do. Many of the users are kids and I don't want them having to edit Windows shortcut Properties menus.
Does anyone have any suggestions here? Is there an "environment variable" I'm unaware of that can be typed as the directory address for both the Target and Start In lines, that will point the shortcut to a folder or app or file where-ever it is installed on a PC?
Alternatively, I am using the program "Inno Installer" to create the Windows installer file for the educational activities. Is there a line I can type in Inno Installer that will create dynamic Windows shortcuts at the time of installation, that INCLUDE the command line parameter I need?
Thank you so much in advance for any help you can give us.
Regards
Frank