i have developed a couple of helper programs in xojo for my MS Office solutions, such as a calendar for dating letters and presentations. So far, i use a VBA (pardon, API) shell call to start the xojo application with parameters (such as the start date) and then use the Registry to return the value selected in the xojo application to VBA.
Is there a more elegant way to return the selected value? Can i use some kind of shell call like a function? Something like
myDate=SomeShellFunction(“xojoCalendar.exe 2013-11-22”) ?
The only return value for the regular shell seems to be the application’s handle …
Much obliged!! Patrick
It doesn’t look like VBA has an easy way to read shell output.
Maybe the Print output of a Xojo app could be read once you redirect StdOut to a Pipe as described here:
While Paul’s link provides hints, VBA’s locked down environment is designed specifically to NOT allow you to do these types of things. VBA was one of the biggest wins for malware script kiddies for year. So much so that a number of large organizations that we work with still prohibit it’s use even if it cripples their apps’ use and in light of the new, more secure access models provided.
@ Paul: This seems to show how to read the return value on the VBA side … However, since my xojo application is a desktop application, ‘Print’ and ‘StdOut’ don’t appear to ba available …
No, Print and StdOut are not available with desktop apps.
But if your Xojo apps are just helper apps, it seems like they ought to be console apps rather than desktop apps.
I’m not an expert in this, but this system library will output to StdOut and it seems to work from a desktop app:
Soft Declare Function write Lib "System.Framework" (FileNo As Integer, TheData As Ptr, BytesToWrite As Integer) As Integer
Dim s As String = "Test"
Dim output As MemoryBlock
output = s
Call Write(1, output, output.Size)
If you do rebuild your helper app as a Console app, you get Print and it writes to stdout by default on all three platforms.
@ Paul: Sounds promising, kompiles without any problems but causes a ‘FunctionNotFoundException’ when executed
And since some of my helper apps do need an interface (such as a calendar), rebuilding them as console apps is not an option …
Sorry, my example to output to StdOut is for OS X. I’m afraid I don’t know how to do it on Windows.
I guess i’ll just keep returning values through the registry then … Thanks very much anyway!!!
Just for clarification…you are sending a command to the xojo application and its returning a value to the microsoft application?There are a number of ways to do this, and a useful tool to convert PE.GUI apps to PE.Console apps (requires a small change within a build desktop app to work) build right into windows via the command line. Ive also developed other methods for xojo applications to interact with other interpreters (ie perl/php/custom CGIs). Send me a PM and I would be glad to help you find a stream-lined approach, which we can post a solution for here; when another may have the same question.