Author Topic: Replacing the OS/2 URL object - DIY version...  (Read 6073 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Replacing the OS/2 URL object - DIY version...
« on: June 16, 2020, 02:39:11 pm »
Hi everyone,

I recently moved all of my DOCUMENTS (you know, the personal stuff that accumulates over the years, PDFs, text files, notes, etc...LOL) from my OS/2 box to the NAS. The NAS does not support EAs, and as expected all of my URL objects (the WPS object that you to double-click thus openning up your web browser) have now become simple text files on the NAS.

Alright, so I knew this was going to happen and now am trying to figure out a way to deal with it.

The NAS files that used to be the OS/2 URL objects are now a simply text file with the one-liner content being the URL itself. I figured that if I can read the contents of that file and pass that onto Firefox as a command line parameter that should in fact give me a "poor man's" replacement for the WPS UL object.

I need a little help in making that into a one-liner though. The alternative is of course to do up a small REXX script, but if I can parse the stuff as a one-lines, well, that's better since I can simply create the program object for it and convert that into my own DIY "OS/2 URL Object" solution.

So here is a scenario I'm looking at:

1) URL text file => 'CBC - URL'

2) content of the above text file
http://www.cbc.ca/news

3) current DIY URL object CLI
g:\apps\tcipip\firefox\firefox.exe &head "cbc - url"

4) sample execution

The CLI produces the following, but the firefox window pops up on it's own and the URL is not passed to it

Code: [Select]
[V:\PUBLIC\DOCUMENTS\Dariusz]g:\apps\tcpip\firefox\firefox.exe &head "cbc - url"

http://www.cbc.ca/news

The idea here being that I can use the HEAD utility to simply pull that single line from the text file (which is the actual URL) and pass that onto Firefox as a CLI argument.

My problem is that testing this out I clearly do not have the right CLI definition, simply put the "&head" must feed INTO firefox.exe and I don't know how to do this in our OS/2 world.

I spent a little time going through various OS/2 help files but didn't spot anything that worked for me.

So can anyone give me the proper syntax for the CLI structure to pass an output of the 2nd command as input to the first command?

Thanks!

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: Replacing the OS/2 URL object - DIY version...
« Reply #1 on: June 18, 2020, 03:13:11 pm »
Alright, so it turns out the default WPS URL object has a sort of a "hidden gem" (to me anyways as I did not know this).

Adding a '.URL' extension to a filename automatically causes WPS to convert the object to a URL object, even if the said file exists on a fs which does not support EAs.

From that perspective, problem solved, I simply added that '.URL' extension to all my filenames.

Now, in parallel to this (as this was my original approach) I crafted this little CMD file to pull the one-liner URL from the file itself and invoke FF:

Code: [Select]
/* Quick script to read in a URL from a text file and open Firefox */

/* parse the input argument, which should be a text file that contains the one-l
iner URL */
parse arg url_file

/* check if actual argument was passed, if not, end gracefully */
if url_file = '' then
   do
   say "No URL_FILE passed!"
   exit
   end

/* show the file we are processing */
say "Parsing file: " url_file

/* parse the input URL_FILE and get the actual URL from it */
url = Linein(url_file)

say "The URL to load is: " url

/* call the Firefox browser */
'@g:\apps\tcpip\firefox\firefox.exe' url

When a WPS program object points to this CMD script and the object Parameters field contains '%*' the fully qualified path of the URL text file is being passed to the script, which is exactly what I want.

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Replacing the OS/2 URL object - DIY version...
« Reply #2 on: June 18, 2020, 06:15:22 pm »
Without fully understanding your problem: You need to restore the .TYPE EA to UniformResourceLocator.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: Replacing the OS/2 URL object - DIY version...
« Reply #3 on: June 18, 2020, 06:57:55 pm »
Hi Andreas,

Without fully understanding your problem: You need to restore the .TYPE EA to UniformResourceLocator.

The core of my problem is that that NAS box does not support EAs...so the approach you suggest, as much as I would love to do so will not work. I do appreciate your response though!

Problem solved, the WPS URL object recognizes filenames ending in '.URL' extension as URL objects, as such, a file re-name works!

Olafur Gunnlaugsson

  • Full Member
  • ***
  • Posts: 244
  • Karma: +5/-0
    • View Profile
Re: Replacing the OS/2 URL object - DIY version...
« Reply #4 on: June 18, 2020, 08:50:59 pm »
Hi Andreas,

Without fully understanding your problem: You need to restore the .TYPE EA to UniformResourceLocator.

The core of my problem is that that NAS box does not support EAs...so the approach you suggest, as much as I would love to do so will not work. I do appreciate your response though!

Problem solved, the WPS URL object recognizes filenames ending in '.URL' extension as URL objects, as such, a file re-name works!
What NAS box are you using? EA'support can be enabled in most of them ...