Author Topic: Rexx?  (Read 12145 times)

Larry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Rexx?
« on: March 19, 2013, 09:36:48 pm »
I'm not going to ask how to program in Rexx, as I'm reading a documentation on it's built in functions and such. I've scripted mIRC in the past, been using Javascript since a teen, learned OOP-PHP, understand some C/C++ structuring due to some involvement with reverse engineering and such, so it shouldn't be super super hard for me. However, if I want to read a line of a file I would use

Code: [Select]
say Linein( 'file1' )  right?

So if I have a Rexx widget in my taskbar and tell it to "say Linein( 'file1' )" and file1 contains "Hello, Larry!" would I see that on the taskbar?

Sorry, it appears it can't do that, RxMessagebox or what not, will read more and learn.

Derp:

« Last Edit: March 19, 2013, 10:01:26 pm by Larry »



Doug Bissett

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 38
  • Posts: 928
    • View Profile
Re: Rexx?
« Reply #1 on: March 19, 2013, 11:52:28 pm »
You are jumping in a little too fast. REXX is actually fairly easy, but there are two versions. One is known as "Classic REXX", which is the default. There is also "Object REXX" which needs to be set up by the user. It is usually one, or the other, but not both, although there is a way to do both. I assume that you are still using "Classic REXX".

Next, you picked a more advanced function with RxMessageBox. It does need some extra things to make it work.

There are also a few more advanced REXX packages, that help to make GUI interfaces. VXREXX, and DrDialog, are the two that I remember. I use DrDialog, but VXREXX is probably a better choice, since the support is already in eCS (I am not sure if the programmer package is included).

Quote
So if I have a Rexx widget in my taskbar and tell it to "say Linein( 'file1' )" and file1 contains "Hello, Larry!" would I see that on the taskbar?

Not the way you are doing it. There are some widgets that support REXX code, but what you did would simply start the program in a window. There is also a widget to add an "Extended system tray", which does some of the things that the windows taskbar does. AFAIK, the only things that actually use that, are some programs that have been ported using the QT4 package, and some JAVA programs.

If your quoted code is what you tried, it isn't likely to work. First, to tell the command processor to decode  REXX command file, it needs to start with a comment line. That is the first two characters, in the first line, need to be "/*" ( slash asterisk, without the quotes). That is usually followed by a description of what the program is, and the comment is closed by "*/" (asterisk slash, without the quotes). If that is not found, the command processor attempts to treat it like a normal batch file (pretty much like DOS).

Then, you need to load the appropriate support module(s), which is one of the reasons why RxMessageBox isn't working. Add this sequence:

Code: [Select]
/* Load the rexxUtil functions -------------------------------------------- */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

Which loads the functions, including RxMessageBox. Be aware, that this is a system wide load, so any program can use it, as long as it stays loaded. Proper practice dictates that you should unload that stuff, when you are finished with it. In real life, if you do that, and some other REXX program is using it, it goes away, and the other program will die. The fix is: do NOT unload it. You should always load it to be sure that your program has access, just in case it is the first program that needs it. There are more function  libraries available, but you should stay with the simple stuff to start.

Then, add your line of code. Now, you can run that from a command line, or from a program icon, or, put the program icon in the eCenter bar, and it will open a text window, and do what you asked.

At this point RxMessageBox still won't work, because it needs to be run by  a program that is capable of doing a graphical presentation. The easiest program is PMREXX. Create a file called HelloLarry.cmd, and insert this code:
Code: [Select]
/* Hello Larry */

/* Load the rexxUtil functions -------------------------------------------- */
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

Do until RxMessageBox("Hello Larry","Testing","OK","EXCLAMATION") = 1
end

EXIT

Now go to a command line, in the directory where you saved the HelloLarry.cmd file, and type "PMREXX /Q HelloLarry". It will open the PMREXX window (which may hide behind other things), and pop up the message window. When you click OK, it will close (PMREXX would stay open, without the "/Q" parameter).

Of course, this is pretty simple, and it contains no checking, but it is a start.

Larry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Rexx?
« Reply #2 on: March 20, 2013, 01:23:39 am »
Posting from eCS, since Virtualbox doesn't wanna transfer clipboards between guest and host. lol

Code: [Select]
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
Address 'CMD'
'D:\Programs\cURL\curl\bin\curl.exe <URL/weather/?zip=zipcode> -o D:\scripts\weather\current.txt'
Address
Do until RxMessageBox(Linein( 'D:\scripts\weather\current.txt' ,1),"Weather","OK","EXCLAMATION") = 1
end

EXITcall RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
Address 'CMD'
'D:\Programs\cURL\curl\bin\curl.exe http://steam.dvflex.com/weather/?zip=L9Y4V4 -o D:\scripts\weather\current.txt'
Address
Do until RxMessageBox(Linein( 'D:\scripts\weather\current.txt' ,1),"Weather","OK","EXCLAMATION") = 1
end

EXIT

That's what I have now, and it works as expected. Just now need to tell it what to do with the response.
If you're unsure of what I'm doing, I'm trying to make widget similar to the one that tells me the current cpu load on the desktop shell?( or should I say Workspace shell?)
« Last Edit: March 20, 2013, 01:47:37 am by Larry »

Doug Bissett

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 38
  • Posts: 928
    • View Profile
Re: Rexx?
« Reply #3 on: March 20, 2013, 06:15:27 pm »
Quote
Posting from eCS, since Virtualbox doesn't wanna transfer clipboards between guest and host. lol

You need to install the VBox additions. It works a little different from installing in a windows client. Click on (VBox menu) Devices, then Install Guest Additions. In windows, that will start an installer in the client. In OS/2 (eCS), it simply attaches a virtual CD, so you need to open the CD. Then, look in the OS2 directory. There are instructions that you need to follow.

Quote
f you're unsure of what I'm doing, I'm trying to make widget similar to the one that tells me the current cpu load on the desktop shell?( or should I say Workspace shell?)

Neither is right. The CPU load widget shows the whole system load, not just for Presentation Manager, and/or the Workplace Shell.

You need one of the REXX widgets for eCenter (XCenter) from: http://www.os2usr.org/xcenter/. READ the instructions that comes with them. Depending on what you want to do, one of them should do it for you.

BTW, since you seem to want to use up valuable space in the eCenter (XCenter) bar, you should realize that you can have two bars. One at the top of the screen, and the other at the bottom. Go to Programs-> Utilities and copy the eCenter icon to something like eCenter1, then put a shadow of that into the startup folder. When it starts, it will be on top of the original eCenter bar. Right mouse click on an empty spot (or jamb the cursor hard against the right end, if there is no blank spot), and open the Properties. One of the settings is Top or Bottom. Select Top, and the new bar will appear at the top, with the old bar at the bottom. Then, you should delete any duplicated widgets, and adjust both bars to your own preferences. Don't worry about "you can't undo this". You can, but any settings, or contents, for the individual widgets will need to be recreated if you put them back.

You should also look up the REXX help, to see what the options are for RxMessageBox. "EXCLAMATION" is probably not the best icon for your popup window (which you probably won't use anyway, with the REXX widgets).

Have fun...

Larry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Rexx?
« Reply #4 on: March 20, 2013, 07:47:58 pm »
I think you may have read me a little unclear, I was referring to the taskbar. It's called the WPS isn't it? I know that the CPU load widget is the whole system though, either way, you still gave me some valuable information.  thanks again, I appreciate it.

Update, just to be sure, this is what you meant?

« Last Edit: March 20, 2013, 08:08:03 pm by Larry »

Doug Bissett

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 38
  • Posts: 928
    • View Profile
Re: Rexx?
« Reply #5 on: March 20, 2013, 09:12:55 pm »
I think you may have read me a little unclear, I was referring to the taskbar. It's called the WPS isn't it? I know that the CPU load widget is the whole system though, either way, you still gave me some valuable information.  thanks again, I appreciate it.

Update, just to be sure, this is what you meant?

There is no "taskbar" as such. There is the eCenter (XCenter) bar, which sort of works like the windows taskbar.  The Extended System Tray widget adds more of the function of the windows task bar to the eCenter (XCenter) bar.

WPS is a program that runs under the Presentation Manager, which is really the GUI that OS/2 uses. WPS adds a lot of function to the Presentation Manager, and the WPS itself is further extended by eWorkPlace, which is a sub set of the full blown XWorkPlace. Most OS/2 GUI programs run under the Presentation Manager (which is why many programs are called PM<something or other>). The WPS can also be programmed (extended) if it makes sense to do that for a particular reason.

Older versions of OS/2 use a different thing called "WarpCenter" (if I remember correctly), which is not nearly as flexible as eCenter.  Before that (in warp3) there was the Toolbar, which was quite different, and really had a different purpose. They all work in eCS, but usually only the eCenter bar is used. WarpCenter (AKA eComCenter) is known to have some bugs, and the Toolbar takes up a lot of screen real estate.

I would guess, that you are trying to do something similar to what the windows Gadgets do. If so, you are probably on the right track, but it would be better to use VXREXX, or DrDialog, to create a GUI window with whatever you want in it. That, of course, is even more complicated, and does involve a "learning curve".

Alex Taylor

  • Full Member
  • ***
  • Thank You
  • -Given: 10
  • -Receive: 14
  • Posts: 218
    • View Profile
Re: Rexx?
« Reply #6 on: March 21, 2013, 04:41:48 pm »
The REXX 'SAY' instruction simply prints to standard output (STDOUT).  Unless you use a special REXX environment that redirects STDOUT (such as PMREXX), you will only see this when running the REXX program from a command prompt.

RxMessageBox only works within a process that is running as in graphical (PM) mode.  If you run within PMREXX ('REXX console' on the eCS desktop) then it should work (IIRC, anyway).  You can also convert a REXX script to a graphical program by using a tool like REXX2EXE (use e.g. 'rexx2exe myrexx.cmd myrexx.exe /p').

Normally eCenter widgets are not written in REXX.  I believe somebody wrote a special wrapper widget a few years ago which does allow this, however.  It might be in this package but I'm not sure (and I've never used it so I can't be any more help than that).

Larry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Rexx?
« Reply #7 on: March 22, 2013, 02:04:40 pm »
Okay, thanks. Both replies helped me learn some stuff. But before I get too out of focus, where exactly could one see a documentation on VX-REXX, or DrDialog? I'm coming up nothing in Google, and I'm not buying a book, haha. The books don't teach me anything, I need visual examples and class/function structure so I can engineer it. I didn't learn PHP, Javascript, HTML, or anything like that reading books, just examples, concepts, and functions, until I knew enough functions to write my own stuff. Same way I learned PC repair. I opened up a PC case, took out a part and replaced it. I didn't need no guide.
« Last Edit: March 22, 2013, 02:07:28 pm by Larry »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 244
  • -Receive: 46
  • Posts: 1642
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Rexx?
« Reply #8 on: March 22, 2013, 02:19:53 pm »
Hi Larry.

The EDM/2 wiki has several OS/2 REXX related article, there is also a series of articles called "DrDialog, or: How I learned to stop worrying and love REXX"
http://www.edm2.com/

But seems that the wiki is down for the moment. I will contact Adrian (netlabs) to see what happened.

Jumping a little but out of the topic, I always dream with the idea of replacing OS/2's REXX with an open source implementation of Regina REXX  (http://regina-rexx.sourceforge.net/) How will it work for us to remove IBM's REXX libraries from OS/2 and use Regina? I don't have the technical skill to know how hard or easy will be to do this, or if Regina REXX has all the functionality that IBM's REXX has.
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Larry

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Rexx?
« Reply #9 on: March 22, 2013, 02:34:20 pm »
Hi Larry.

The EDM/2 wiki has several OS/2 REXX related article, there is also a series of articles called "DrDialog, or: How I learned to stop worrying and love REXX"
http://www.edm2.com/

But seems that the wiki is down for the moment. I will contact Adrian (netlabs) to see what happened.
Thanks Martin, sounds like it is what I could be looking for.

Jumping a little but out of the topic, I always dream with the idea of replacing OS/2's REXX with an open source implementation of Regina REXX  (http://regina-rexx.sourceforge.net/) How will it work for us to remove IBM's REXX libraries from OS/2 and use Regina? I don't have the technical skill to know how hard or easy will be to do this, or if Regina REXX has all the functionality that IBM's REXX has.

Well, on the outside it seems to have a lot of what IBM does, but there could be something deeper that IBM has that makes it still somewhat better. Don't know enough about eCS yet.
I would imagine it would be the same as replacing any other library or interpreter. As long as all the functions and calls are there for the OS, it would make it an easier change, if workarounds need to be coded, that could take time.
« Last Edit: March 22, 2013, 02:35:56 pm by Larry »

Doug Bissett

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 38
  • Posts: 928
    • View Profile
Re: Rexx?
« Reply #10 on: March 22, 2013, 06:38:26 pm »
Quote
where exactly could one see a documentation on VX-REXX, or DrDialog?

I don't know about VX-REXX. There is some information at: http://en.wikipedia.org/wiki/VX-REXX.

DrDialog is at HOBBES (where many things are to be found): http://hobbes.nmsu.edu/download/pub/os2/dev/rexx/drdialog.zip with updates: http://hobbes.nmsu.edu/download/pub/os2/dev/rexx/DrDlgFix.zip and: http://hobbes.nmsu.edu/download/pub/os2/dev/rexx/DrDlgRc.zip.

HOBBES is at: http://hobbes.nmsu.edu/, where you can search for things.

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 5
  • -Receive: 11
  • Posts: 151
    • View Profile
Re: Rexx?
« Reply #11 on: March 25, 2013, 07:56:28 am »
Hello,

something that may seem unrelated, but provide you with the mentioned tool ...
look for Dimitris 'sehh' Michelinakis - WebMail/2 for OS/2
not to mention the web mail tool written in rexx  ;D

//Jan-Erik

Robert Mauro

  • Global Moderator
  • Newbie
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Rexx?
« Reply #12 on: April 04, 2013, 11:22:07 pm »
Hi, I believe what is really needed is very simple. There is a REXX widget toolkit or Rexx widget someplace for XWorkplace (and eWorkplace). Installing that will allow writing simple rexx code where the code is used to do various things (output text, update graphs, etc).

It's not as simple as simply writing output to STDOUT (ie: a console window), but still very easy, especially if one looks at the widgets and source included.

Thomas Klein

  • Global Moderator
  • Newbie
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Rexx?
« Reply #13 on: April 13, 2013, 12:07:28 am »
Hi all,

most probably, that widget toolkit is the one that can be found here:
http://www.os2usr.org/xcenter/

Scroll down for the "rexx gauge", which is part of the linked xworkplace widget library.
IIRC it includes code samples and documentation and comes as a warpin install package (.wpi)

Cheers, Thomas

Robert Mauro

  • Global Moderator
  • Newbie
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Rexx?
« Reply #14 on: May 01, 2013, 11:22:18 pm »
Scroll down for the "rexx gauge", which is part of the linked xworkplace widget library.
IIRC it includes code samples and documentation and comes as a warpin install package (.wpi)

BINGO! That's the one! Glad someone remembered it. Thanks Thomas!