OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Internet => Topic started by: André Heldoorn on August 12, 2019, 10:47:09 am

Title: FF/SM parameters
Post by: André Heldoorn on August 12, 2019, 10:47:09 am
WPProgram object #1, converted to CLI commands: C: & CD \SEAMONKEY & C:\SEAMONKEY\SEAMONKEY.EXE
WPProgram object #2, converted to CLI commands: C: & CD \SEAMONKEY & C:\SEAMONKEY\SEAMONKEY.EXE C:\TOOLS\openurls.html
WPProgram object #3, converted to CLI commands: C: & CD \SEAMONKEY & C:\SEAMONKEY\SEAMONKEY.EXE -search "\"hello world\"

While #1 is running, is it a (fixable) bug or missing feature that #2 opens an expected new tab but #3 doesn't?

I was trying to develop a simple fire & forget front-end to search without having to wait for a started browser first, and of course hardly better than using "-search "[Search for ...]" as a WPProgram parameter prompt, but one of the unexpected results was that a new search killed the browser and next restarted the browser again (WPProgram object #3 replaced) or didn't start at all (#3 updated). So apparently the started EXE is linked to the survival of its starter.
Title: Re: FF/SM parameters
Post by: Dave Yeo on August 12, 2019, 04:30:14 pm
Seems to work as expected here. With my setup, if SeaMonkey is running, it opens a new window, without it running it opens a new tab along with the previous session.
Title: Re: FF/SM parameters
Post by: André Heldoorn on August 12, 2019, 05:25:05 pm
Here it didn't. I'll try to reproduce it with a test...
Title: Re: FF/SM parameters
Post by: André Heldoorn on August 12, 2019, 06:08:42 pm
"Funny". Yesterday a different test app killed and restarted SM (replace existing WPProgram object), or moved the previous session to the foreground (update existing WPProgram object). The last parameter of SysOpenObject() made no difference. Perhaps the cause was running out of memory!?

At least the test code below still doesn't open a new tab here. If I open a local HTML file with another WPProgram object, then it opens a new tab per opened HTML file.

Save TEST.CMD in the directory of SEAMONKEY.EXE, and execute TEST.CMD twice. Do not execute the created object Test 1. Delete this object afterwards.

The attached images may save you the troubles. Executing TEST.CMD (SEAMONKEY.EXE -search "stupid question") twice, while typing this, results in 3 SM sessions. Executing OpenURLs (SEAMONKEY.EXE openurls.html" twice, while typing this, results in 2 new tabs.

So if the parameter of a SEAMONKEY.EXE WPProgram object is a HTML file, it opens a new tab. If the parameter is "-search something", then it doesn't. With the same SM setup.

Code: [Select]
/* Test.CMD */

CALL RxFuncAdd 'SysCreateObject','RexxUtil','SysCreateObject'
CALL RxFuncAdd 'SysOpenObject','RexxUtil','SysOpenObject'

dir=Translate(Directory())

IF Stream('SEAMONKEY.EXE','C','QUERY EXISTS')='' THEN DO
   SAY 'Error: SEAMONKEY.EXE not found in' dir
   EXIT
END

setup='STARTUPDIR='||dir
IF Right(dir,1)<>'\' THEN dir=dir||'\'
setup=setup||';EXENAME='dir||'SEAMONKEY.EXE;PARAMETERS='
setup=setup||'-search "\"hello world\";OBJECTID=<Am_I_Wrong>'

IF SysCreateObject('WPProgram','Test 1','<WP_DESKTOP>',setup,'R')>0 THEN DO
   CALL SysOpenObject '<Am_I_Wrong>','DEFAULT','TRUE'
END

EXIT

Of course I've traditionally deleted the source code of the original search app, which killed and restarted SM...
Title: Re: FF/SM parameters
Post by: Dave Yeo on August 12, 2019, 07:05:30 pm
Worked here. Had a few seconds of one core at 100% CPU then a new window opened with the search terms. Whether it is a new window or new tab depends on your settings in Preferences-->Browser-->Internet Search, where I have nothing ticked as I prefer the search results in a new window.
Quite possible you are running out of memory when the new Seamonkey.exe starts, communicates with the one already running and closes after telling the already running one to display the search results (at least that is what I think happens).
Title: Re: FF/SM parameters
Post by: André Heldoorn on August 13, 2019, 10:31:02 am
Whether it is a new window or new tab depends on your settings in Preferences-->Browser-->Internet Search, where I have nothing ticked as I prefer the search results in a new window.

Quite possible you are running out of memory

There is a difference. Here, while SM is already in use, a WPUrl-object with e.g. the URL http://www.google.com/search?q=stupid+question (http://www.google.com/search?q=stupid+question) or a WPProgram object with the parameter "localfile.html" opens a new tab. The expected result, quite likely because of some customized setting. But if Google is my default search engine, and I execute the command SEAMONKEY.EXE -search "stupid question" by using a WPProgram object or by using CMD.EXE, then it always opens in a new window. I've tried several settings. In the end the parameter -search will come down to opening an URL (of the default search engine) too, so the expected result is a new tab. Constant URL: new tab. Variable URL, because of a variable search engine setting: new window!? As such I'm not expecting a fix, but it may be a bug.

Closing is "solved". The app was overwriting the WPProgram object, which opened as a new window earlier. Apparently if you overwrite a WPProgram object of a running program and open the new WPProgram object, then - at least in this case - OS/2 closes the app first. I'll use a different "solution", possibly opening an unchanged existing window, as a "documented feature".