Maybe it’s simple but… how can I run a PowerShell script from Clarion?
RUN('test.ps1') - doesn't work
RUN('test.ps1',0,0) - doesn't work
RUN(LONGPATH()&'\test.ps1') - doesn't work
RUN('powershell.exe '&LONGPATH()&'\test.ps1') - doesn't work
I do like Mike’s ActiveScripting stuff very much, but you might also try Capesoft Oddjob (if you have it) to run your script if you really just want to run a .ps1 and capture output, etc.
I have OddJob but for this what I need it’s not good… it’s the same like NT ping class. From docs (Note this is a blocking, syncronous call.) so it will block the entire app until you got the response and I don’t think anyone wants that to happen.
The only workaround is with external tools like Powershell.
works nicely if you want to run PS commands direct instead of a ps1 script and optionally output to file for parsing in clarion.
Executionpolicy options that also work is ‘bypass’ but if thats not set back to the previous, is a security risk, so remotesigned is safer, but still a risk.
Example 3 in the below link is a good example of risk!
Interestingly I can do the above from an unmanifested c6 app on win11 which is surprising.
This is a ps script to interact with websites which can be called from clarion and altered by clarion. Its like Selenium the browser automation tool.
And if you want to control machines over the internet using ps controlled by clarion, this will do it.