PrimalScript build with .bat file

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
kryten
Posts: 45
Last visit: Fri Dec 25, 2020 7:46 am

PrimalScript build with .bat file

Post by kryten »

Hi,

I have an ancient version of PrimalScript 2009!! Probably not many people still using that ;)

In an effort to get some value out of it I'm trying to set it up as my scripting environment for Logstash, which is, more or less, Ruby.
Works okay - but I'm hitting a problem with getting PS to execute and run the code. This is extremely easy to do in Sublime Text and even Notepad++ but I can't seem to achieve what I need in PS and would appreciate some advice about whether its possible or not.

When I want to run my Logstash code I need to call "C:\<myfolder>\Logstash\bin\logstash.bat" + several simple params This executes the .bat file with the params I send, obviously one of them being the name of the Logstash script I am working on in PS at the time.. and Logstash just runs. Now in Sublime and N++ I can even capture the output from that run and see the results. The problem is that I see no way to either:-

1. Add a tool or build system in PS2009
or
2. Modify an existing tool to accept the .bat instead of the .exe

Is this even possible? I have fond memories of using PS back in the early days of Powershell and would really like to use it again, but can't seem to find a spare $400 to upgrade just now, sadly.

Any suggestions?
Thanks,
Stuart
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: PrimalScript build with .bat file

Post by Alexander Riedel »

2009 :D Oh my. I do not know if I remember that UI.
Tools, Options,languages, and set the script interpreter.

It should look similar to this:
language.png
language.png (70.23 KiB) Viewed 3200 times
Additionally, you could add the batch file to the tools browser on the left.
tools.png
tools.png (119.51 KiB) Viewed 3200 times
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
kryten
Posts: 45
Last visit: Fri Dec 25, 2020 7:46 am

Re: PrimalScript build with .bat file

Post by kryten »

Thanks Alexander.

I can get the ruby interpreter to recognize the extension - so that is good. Hello syntax highlighting.

Adding the batch file as a tool works too. I can now execute the 'tool' and collect the output back to the built in console. Which is wonderful. Here is the "but..."...but when the tool executes it feels to me as though the tool is running in the same thread as the PS UI so everything freezes. I cannot stop the tool from running or even click anything till the Logstash run finishes. If I am running across a lot of data that can take several minutes - even though I may only need to see a couple of lines output on the console (json) to know whether or not I'm getting what I need.

Any way to configure the tool to run in a separate thread? Or even to stop the tool from executing would be more than acceptable?
Sorry to ask these questions about a product which is so old. Its just the PS UI remains so classic and pleasant to work in, I would really like to get some use out of it for this.

Thanks,
Stuart
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: PrimalScript build with .bat file

Post by Alexander Riedel »

Your tool already runs in a separate process.
In 2009, when you go back to the script engine dialog, you should be able to configure your tool as a "Script compiler". Look at the options in the combobox.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 7 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.