Activating Stellarium from another application

Asked by Stefan Pulles on 2013-11-28

Though I reported my problem in the forum already, with no response yet, I try to get to my goal this way.

I have designed a MS Access 2003 astronomical database application containing many DSO and double stars. After having selected one of such objects in my application I want to activate Stellarium with the VBA command 'AppActivate' in order to see how the object is like between the surrounding stars. But Stellarium is not activated at all, neither in full screen mode nor in window mode. It doesn't work on both of my laptops (one with windows Vista, the other with Windows 7). The AppActivate command surely works on both laptops activating other sofware.

I'm eager to get the interface between Stellarium and my application working, since Stellarium is a stunning complementary "visualiser" of my application.

Thank you in advance.

Question information

Language:
English Edit question
Status:
Answered
For:
Stellarium Edit question
Assignee:
No assignee Edit question
Last query:
2013-12-01
Last reply:
2015-01-17
gzotti (georg-zotti) said : #1

Never done this, but sounds interesting. Are the arguments you are calling AppActivate with correct? (e.g. complete window title with version number?) I am of no further help, but see some discussion e.g. here:
http://www.mrexcel.com/forum/excel-questions/395115-appactivate-does-not-activate-application.html
You may even want to develop some data exchange:
http://qt-project.org/forums/viewthread/15980
G.

Bogdan Marinov (daggerstab) said : #2

What exactly are you trying to do? Start Stellarium or bring a running instance of Stellarium to the foreground?

How exactly do you intend to exchange data between Stellarium and your VBA application?

Stefan Pulles (palatino) said : #3

To Georg: I tried all possible arguments you mention. The title I use reads "Stellarium 0.12.4". I'll investigate the links you provide. Thanks.

To Bogdan: my application contains the positions of DSO's, double stars and solar system object ephemerisses. The functionality focuses on steering my Meade LX200 (classic model) to these objects and logging all obervations with it, including my comments. Since my application no visualises objects, I looked for good - and free - astronomy program, and recently I found Stellarium as a very promising option.

After solving the AppActivate problem in the first place, what I want to do is steer Stellarium from my application with the VBA Sendkeys command. For objects with names it's easy, just "send" the F3 button to Stellarium and fill in the object name after
which I hope Stellarium will respond and show me the object.
Double stars in general have no names so I have to "send" a double star's position in RA and Decl to Stellarium. That seems difficult since I do not know Stellarium's key stroke to get to the 'Position' tab in the search window.

Thanks again in advance!

Adrian Umpleby (apumpleby) said : #4

I recently added a hack to my 0.12.4 version of Stellarium which makes the StelScriptMgr create a little server that listens on a specific port. It receives lines of text on this port and, once the connection is closed, it then executes those received lines as a script.

It's really quite neat, because it allows the creation of external applications that can control Stellarium via its built-in scripting (and it's over TCP, so that app could be located on a different machine, or tablet, or phone, or whatever, if you set up access appropriately).

I was wondering if the devs might be interesting in adding a feature like this to Stellarium? Please...?
(I don't really feel confident that the way I've hacked it is particularly well done, since I'm coding with Qt for the first time, and hardly done any C++ before. Also I think it could do with someone who really understands how it should abort and clear up, or queue up for later execution, when it receives a new chunk of script before it's finished running the previous one, 'cos mine didn't quite work right under that situation...)

 It wasn't actually that hard to do, even for me (a couple of days of researching Qt, and trying to understand the existing code for scripting, and adding the server code), so I'm sure the devs could figure out how to get it in there within a few hours.
Any takers...?

Alexander Wolf (alexwolf) said : #5

You can create a branch with your code and propose this feature to merge with trunk.

John Kliem (john-kliem) said : #6

What I do is the following:

Manually
I highlight the object designation (e,g, NGC 1040), usually in a spreadsheet, but can be in any doc.
Then Control/C to load the clipboard.
Then I switch to the Stellarium app running.
Then Control/F to popup the find window.
Then Control/V to load the clipboard contents into the find field.
Then Control/1 or Alt/1 to point my scope at the object.

I know, this sounds laborious, but it can be fully automated with Hotkey, with a simple script which emulates the above sequence.
Then it's:
highlight object designation.
Enter Hotkey.

Especially good in the dark!

Can you help with this problem?

Provide an answer of your own, or ask Stefan Pulles for more information if necessary.

To post a message you must log in.