Getting data out of the IDE externally

I have an app that needs to retrieve information from the IDE. For example, I might want the text of Module1.Constant1. If the IDE were AppleScriptable, it would be easy (on the Mac, at least). But how do this in the current state of things, and in a cross-platform way?

Windows: AutoIt
OS X: AppleScript or maybe F-Script (?)

Maybe create an IDE-Script, which can be started from the outside (via the Xojo menu File –> IDE-Script).

But why not read the source files? That would be the easiest.

The data I’m looking for may not be saved so reading the files is not an option. Requiring the end-user to install something is not an option either.

But I do thank you for taking the time to respond.

Do I understand correctly, that the end-user is a Xojo developer, since you wrote in your OP: I have an app that needs to retrieve information from the IDE.

Does this help, from “IDEScripting.pdf”:

Controlling Xojo from the Command Line
Although Xojo cannot be run from the command line, it can be controlled using a separate command-line app that communicates with Xojo using IPC sockets and the “XojoIDE” path.
The IDECommunicator example project (Examples/Advanced/IDE Scripting/IDE Communication) is a fully functional app that can be used control Xojo from the command line by sending IDE Scripts
to Xojo for it to run.
Xojo must already be running in order to the communication to work.

I’ve thought of a different way to accomplish my goal that probably works better anyway, so this question is now academic. I’d still like an answer for the future though.

That is a very good point.

[quote=197582:@Peter Dreisiebner]The IDECommunicator example project (Examples/Advanced/IDE Scripting/IDE Communication) is a fully functional app that can be used control Xojo from the command line by sending IDE Scripts
to Xojo for it to run.
[/quote]

I’m using that now to send scripts, but it doesn’t provide a mechanism to get data back.

Thanks to both of you.

[quote=197582:@Peter Dreisiebner]The IDECommunicator example project (Examples/Advanced/IDE Scripting/IDE Communication) is a fully functional app that can be used control Xojo from the command line by sending IDE Scripts
to Xojo for it to run.
[/quote]

There is a mechanism to get data back, but it is currently broken (at least on OS X).

<https://xojo.com/issue/32928>

What if you save the project as xml and parsed it yourself?

Ew. :stuck_out_tongue:

[quote=197745:@Paul Messias]There is a mechanism to get data back, but it is currently broken (at least on OS X).

<https://xojo.com/issue/32928>[/quote]
Damnit, I need the same. And it’s still broken in 2016r1 :frowning:

Don’t IDE Scripts have a DoShellCommand("…") function? Would it be possible to send data back through that? I’m not really sure.

That’s exactly what I’m doing to write a file that contains the response. Quite ineffiecient.

Would the clipboard work better than file

Call DoShellCommand("echo myData123 | pbcopy")  //pbcopy on mac

dim cb As new Clipboard dim result As String = cb.Text

I know these are kludgy. Are you looking for a better workaround or just raising attention to the bug?

btw, even if the bug is fixed, how does the script source return something? “return” doesn’t work and “Print” shows a message box.

Will, I cannot use the default clipboard for my purposes are it would interfere with the user’s clipboard.

I need this for a tool I’m writing that would add some nice features to the IDE. For that to work, it has to talk to the IDE constantly and therefore it should not be too ineffiecient.

Well, that’s the beauty of it: If you end your sent command with Chr(0), then the Print command DOES return the text over the socket instead of calling MsgBox.