1

I would like to open a specific browser with Jython.

I believe this is how it is done with Java:

Runtime rt = Runtime.getRuntime();
rt.exec(new String[]{"cmd", "/c","start chrome http://www.stackoverflow.com"});

I've tried to convert the Java to Jython:

from java.lang import Runtime 
Runtime = Runtime.getRuntime()
Runtime.exec("start chrome http://www.stackoverflow.com");

However, it fails:

java.io.IOException: java.io.IOException: Cannot run program "start": CreateProcess error=2, 
The system cannot find the file specified in <script> at line number 3
BMXAA7837E - An error occured that prevented the TESTURL script for the LP23 launch point from running.
java.io.IOException: java.io.IOException: Cannot run program "start": CreateProcess error=2, The system 
cannot find the file specified in <script> at line number 3

Is it possible to open a specific browser with Jython?

mzjn
  • 48,958
  • 13
  • 128
  • 248
User1974
  • 276
  • 1
  • 17
  • 63
  • Note: In my implementation of Jython (Maximo 7.6.1.1), it is **not** possible to import Python libraries. – User1974 Oct 21 '19 at 19:56
  • 1
    `Runtime.exec("cmd /c start chrome http://www.stackoverflow.com")` works for me (but I'm not using Maximo). – mzjn Oct 22 '19 at 04:39
  • Related question here: [Jython: Open URL in browser (without importing Python libraries)](https://stackoverflow.com/questions/58488528/jython-open-url-in-browser-without-importing-python-libraries/58497638#58497638]) – User1974 Oct 22 '19 at 15:10
  • Does this answer your question? [Jython: Open URL in browser (without importing Python libraries)](https://stackoverflow.com/questions/58488528/jython-open-url-in-browser-without-importing-python-libraries) – User1974 Nov 05 '19 at 19:57

1 Answers1

1

The direct answer to your question is, "No."

Because Automation Scripts run 100% on the server side (even on the server-side of the server-side), they have zero direct control over the client / browser. You could format a URL into an attribute and use that attribute for a Launch in Context configuration item, but that's about as close as you come to manipulating the client / browser, unless you want to do a much more invasive customization.

Preacher
  • 2,127
  • 1
  • 11
  • 25
  • Have you ever seen a hyperlink in a Maximo message box? Or a button in a message box that had some code behind it? – User1974 Oct 22 '19 at 12:45
  • I think I've put one in a "maxmessage" (Messages option in DB Config) that was used somewhere, but that memory is a bit foggy. I would certainly try it again. I know I have put `
    ` tags in those.
    – Preacher Oct 22 '19 at 14:49