How to run Jade script as .exe in WIndows?

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Anonymous >> Mon, 15 May 2006 0:11:17 GMT

Hi,

Is there a way to run a Jade Script as a .exe file in Windows?
What codes do I need to include in the Jade script to do this?

thanks,
Hilda

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by allistar >> Mon, 15 May 2006 2:01:32 GMT

I'm not sure whether you want to run an Windows .exe file which connects to a JADE database and then runs a JadeScript, or whether you want to run
a .exe file from within a JadeScript.

If the former, then using the JOMAPI from C++ is the way to go. It's fairly straight forward to connect to a JADE database and run an arbitrary method on an object in that database.

If the latter, then you need the node.createExternalProcess method.

Regards,
Allistar.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Brendan Doolan >> Mon, 15 May 2006 7:01:56 GMT

Alternatively, if it is enough to simply start an app to run the method for you, initiating jadloadb is the way do it.

jadloadb path=database-directory ini=initialization-file-name executeSchema=RootSchema executeClass=Schema executeMethod=methName executeParam=stringParam

Cheers, Brendan

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Brendan Doolan >> Mon, 15 May 2006 7:18:07 GMT

Sorry, not quite right. You should do

jadloadb path=database-directory ini=initialization-file-name executeSchema=UserSchemaName executeClass=JadeScript executeMethod=jadeScriptMethod executeParam=stringParam app=someApp schema=SchemaWithSomeApp

The setup here is that in schema SchemaWithSomeApp you have a non-GUI app called someApp. SchemaWithSomeApp has visibility to the schema UserSchemaName which has a JadeScript jadeScriptMethod you want to execute. This method can have a single string parameter which is passed via stringParam. Note that this allows you to execute a method on any class, not just JadeScript (use executeClass=TheClass). Often SchemaWithSomeApp and UserSchemaName will be the same.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Dr J >> Mon, 15 May 2006 23:31:36 GMT

Rather than using these undocumented jadloadb features, why not use the supported, and documented, jadclient executable to run the non-gui application instead.

You can also use the command line to control what you want the non-gui application to do by supplying additional information after the endJade parameter on the command line.

Of course this assumes that you have written your non-gui application to interpret these additional paramaters as appropriate for your requirements to perform the appropriate processing.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Brendan Doolan >> Tue, 16 May 2006 14:10:59 GMT

Hi BJ,
I agree. In fact before I replied I had a quick look in the documentation to see how jadclient was used to invoke a method since I knew it was how it was meant to be done. But I couldn't find it. I'm sure it's in there but I find it difficult to get hold of. I find that the documentation for jadclient is all over the place and confusing.

Where is how jadclient invokes a method documented?

Also, if you didn't know it was jadclient that was siupposed to be used, how are you supposed to find how to do this?

Cheers, Brendan

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Dr J >> Wed, 17 May 2006 1:36:23 GMT

Actually I've never used jadclient to run methods directly like jadloadb allows you to do. I'm not even sure you can do this with jadclient?

I always use jadclient to run my non-gui application and then, if required, the parameters after endJade on the command line to control what I want the non-gui application to do. While this does require a little more initial setup than just executing a given schema/class/method, it also gives increased flexibility as you can now safely reference properties & methods on app, global, etc without potentially getting 1010 and 1011 runtime exceptions.

Who is BJ ???

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Torrie >> Wed, 17 May 2006 4:19:07 GMT

I also had a quick look in the documentation. There is reference to the command line parameters mentioned in Brendan's email in the ReleaseInfo.pdf file when discussing how to upgrade a Jade system without using the installer supplied by Jade.

Perhaps Jade could look at documenting these options?

I would agree that you potentially have more control using you own application (and Jadclient) but if the need for this method is a one off (ie to fix up data etc) then I would argue that if you don't already have a defined method for running one off scripts then using jadloadb would be a good solution as it is quickly implemented.

If you choose to take the approach of adding extra command line parameters, then you can also run application using Jade.exe This could be a better solution if you are only running the Application Server and don't want to stop your system. The only disadvantage is that there is no documented way of getting the command line parameters for a thin client application. You need to use a Windows API or I assume something similar in Linux. There is an earlier post with the details of how to do this for a windows client.

Torrie

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:55 pm

by Dr J. >> Wed, 17 May 2006 10:44:05 GMT

"I would agree that you potentially have more control using you own application (and Jadclient) but if the need for this method is a one off (ie
to fix up data etc) then I would argue that if you don't already have a defined method for running one off scripts then using jadloadb would be a good solution as it is quickly implemented"

Actually, there's very little work required to setup a non-gui app with an initialize method that simply does the required work and terminates. Either way you're up for a deploy of some sort to get the fixup script into the target system so it makes little odds whether the method runs as the initialise method of a non-gui app or the method is executed via jadloadb. In most cases I simply send a new version of the initialise method and never actually have any additional command line options required - I was mainly mentioning this as an option for completeness. Even simple fixups can still run foul of calling methods that attempt to dereference properties on App/Global etc classes that are not valid in the context of the jadloadb execution.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to run Jade script as .exe in WIndows?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:56 pm

by BeeJay >> Thu, 18 May 2006 3:50:46 GMT

Brendan - My ears were burning, so I thought I'd add my $0.02. BJ. {;-þ)

Actually, there is a way to get at thin client command line entries without resorting to any Windows API calls. Suppose the thin client shortcut has the following command line, with MyAdditionalParam at the end after the usual command line entries:

C:\Jade61\bin\jade.exe app=Test schema=Test AppServer=LocalHost AppServerPort=12345 ini=c:\Jade61\bin\jade.ini MyAdditionalParam=HereWeGo

You can then use Application::getProfileString to get information from the command line by way of the "JadeCommandLine" section using code as per the following sample code. Of course, if someone actually creates a JadeCommandLine section in the ini file in question and puts in a value for the MyAdditionalParam, then it could cause unwanted behaviour as Application::getProfileString will return this value when the command line does not contain a MyAdditionalParam entry: _________________________________________________________
<pre>
constants
NothingOnCommandLine = "Nothing Found On Command Line";

vars
additionalParam : String ;

begin
additionalParam := app.getProfileString( app.getIniFileName, "JadeCommandLine", "MyAdditionalParam", NothingOnCommandLine );

if additionalParam = NothingOnCommandLine then
app.debugLog( "Missing required MyAdditionalParam parameter on command line" );
terminate;
endif;
end;
</pre>
_________________________________________________________

I'm not sure if this was the intended behaviour of the app.getProfileString method, but it is certainly a nice behaviour and hopefully one that will work in a Linux environment - unfortunately I don't have a Linux environment available to test this out. Perhaps someone who has access to a Linux environment would like to test this with a Linux PG client and advise their results back to the Newsgroups?

Cheers,
BeeJay.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 9 guests