Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Jan-Erik Lärka

Pages: [1] 2 3
1
Programming / [Classic REXX] Network Map
« on: March 16, 2025, 04:16:38 pm »
I'm trying to write a REXX script to list the devices available on my home LAN.

It use commands available in the OS to get the host name, ip-number and mac address.

Here I can see on the names that it has found computers, mobile phones, vacuum cleaner, routers etc. on the same subnet and indicate if they're offline or not.
I'd also like to, if possible, find out what kind of device the script has listed and set icons accordingly, and not just online/offline. How?!

That also mean that I need help to create the artwork for it.  ;)

The script in default mode without parameters determine the ip-address of the computer, ping and check for others 1 to 255.
With environment variable SET WOL=1 it also send a "wake on lan call" to each machine.
With environment variable SET NET=1 it also create a folder Network Map* in the folder Network, with a sub folder for workgroup* or domain* and individual objects (online*/offline*) for each device. If one click on a device it will refresh (run the script and update the object itself).

2
Programming / GeneologyJ
« on: January 27, 2025, 09:33:03 pm »
Previous versions of GeneologyJ run on OS/2 with OpenJDK, but the one built on sourceforge 6865 (2020-08-25) has been built for Java 1.7 and newer even though it only contain slight changes that doesn't introduce much that require java 1.7

I have now tried to build it myself and adjusted a combined try ... catch and a try ... catch for a file close procedure. The latter may cause problems and need a proper rewrite, but I'd like to ask for your help to see if this build work ok with our OpenJDK.

Perhaps something to look at from an OS/2 perspective as the project is mature and behave very well and is easy to build.

3
Hello,

Would like to see that AOO look like something found in OS/2 applications.

The current/default/available can be found as .zip-files in ...\OpenOffice\share\config
as images.zip, images_brand.zip, images_classic.zip, images_hicontrast.zip and images_industrial.zip
in png format of 16x16 and 26x26 pixels, would be nice if one could use 16x16 & 32x32 or 20x20 & 40x40 instead, but as of now one can specify small/large and a scaling factor in AOO.

Regards,
Jan-Erik

4
Applications / PMInSANE :-P
« on: December 16, 2024, 08:58:30 pm »
I've put togheter this GUI application... nothing fancy, but fun.
It just work and scan stuff on my CanoScan LiDE 25 on both my laptop and workstation with SANE 1.0.27 from Paul Smedley.

Possible parameters with examples/alternatives/info:
-DEVICE plustek:libusb:001:001   (Force the use of a certain device)
-MODE Color                 ( BW, 8G, RGB, Color, ... )
-UNIT cm                       ( mm, cm, inch )
-DPI 300                        ( 75, 150, 300, 600, ... )
-O  C:\Temp                   ( C:\Temp\MyScannedImage )
-AREA 10 10 50 50       ( Left Top X Y )
-BATCH                         (Run in batch mode and return after scan)

5
Programming / ooRexx to control GhostScript
« on: October 14, 2024, 06:37:59 pm »
Hello,

here's a "library" and the script (rename pdf.txt to pdf.cls and TestPDFLib.txt to TestPDFLib.rex ) to use it.
The script should run on win, *nix and os2, but seem to fail on the latter for some functionality.

Note that you may have to tweak ooRexx rexxsetenv.cmd to even be able to access GhostScript.
Run with:
Code: [Select]
rexx TestPDFLib
One can of course write code to do these things in classic rexx, object rexx and plain command line as well,
but the interesting part here is that it should be reusable (not possible with classic rexx).
With some adjustment it should work with Object Rexx as well.

It can be used to merge separate PDF-files, but example of that is not included.


6
Programming / Classic, Regina, Object and Open Object Rexx
« on: October 01, 2024, 06:58:57 pm »
I see that the knowledge of REXX is somewhat limited even with OS/2 users.

Classic Rexx (by IBM) is the default scripting language in OS/2, eComStation and ArcaOS and one just need a simple text editor and write in fairly plain English.
It allow you as a user to write scripts to aid you with certain tasks and it is well integrated with the system so that you don't need to specify an executable to run a script, but it also drive applications as the "engine" written with for example DrDialog, VX-REXX and even code you can write yourself and compile.
It is not possible to create reusable text libraries of code to just call, but one can write functions in the script that perform certain tasks. It's is however possible to use external compiled libraries.

Regina Rexx (by Mark Hessling) is more modern, very similar to Classic Rexx, but lack the system integration.
It is more up to date than Classic Rexx and probably also somewhat more reliable.

Object Rexx (by IBM) addressed some of the shortcomings of Classic Rexx, and one can switch to it in OS/2, eComStation and ArcaOS, while the way to write code also evolved and introduced ~ and arrays with [] but also external reusable code libraries, written in plain text Object Rexx.
Object Rexx is just as well integrated with the base OS as Classic Rexx, can run and use Classic Rexx scripts end external compiled libraries and be the engine for DrDialog, VX-REXX etc., but was never set as default due to that the OS/2 version had some flaws caused by the compiler used, if I remember correctly.

Open Object Rexx (by RexxLA)
has refined what IBM created with Object Rexx and also cleaned up some syntax and introduced a lot of useful and powerful stuff. We now have an up to date and current ooRexx back ported to OS/2 but the integration found in Classic Rexx and Object Rexx is missing so DrDialog, VX-REXX etc. can not benefit from the new features, easier and simpler way to express complicated information and relations etc. but still need to rely on those old scripting engines to be present. If we'd have the intergration Classic Rexx and Object Rexx could be phased out in favor of the new and open version. What we need is what I express as the integration part and that it can run in any command line environment, not only 4OS2.

So what can one do with REXX you wonder?
Alex Taylor has for example written some excellent software that you may have used, both command line scripts and GUI applications like Naps and ANPM to mention a few.
Glassman wrote AutoWGet that is very helpful to fetch things from the internet
and much more...

I use ooRexx to automatically create documents with maps to send to owners of land at work, drive office applications, vector drawing applications such as OpenOffice Draw, Calc etc. split/merge/extract text PDF documents with GhostScript and retrieve routes from google between places etc.

I would like to get your attention to push for an update to the wps integration stuff and enable it for ooRexx on OS/2, without reinventing the wheel from scratch.
The problem is that IBM have a cross licensing agreement with another party (Amiga)?!

7
Setup & Installation / How to? python, pip and language tool
« on: June 11, 2024, 08:28:55 pm »
i have a need to run something that can translate text and the tools provided now all seem to use python and require pip etc.

One can use a standard OS/2 command prompt an run the command as Python 3.7 and onward comes with an ensurepip module.
python -m ensurepip --upgrade
it seem to install version 23, but another run, upgrade it to version 24.

Am aware that it may not know how to handle ArcaOS and OS/2, but it may be possible to iron out some things.

How can one install a downloadable AI tool, translation tool etc. ?
I wouldn't mind a tool to just select what to install.

Example of google translator, but the others seem to have similar issues as seen below.

[C:\usr\lib\python3.9\site-packages]python pip install googletrans
WARNING: The directory 'd:/home/.cache/pip' or its parent directory is not owned
 or is not writable by the current user. The cache has been disabled. Check the
permissions and owner of that directory. If executing pip with sudo, you should
use sudo's -H flag.

Collecting googletrans
  Downloading googletrans-3.0.0.tar.gz (17 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  pip subprocess to install build dependencies did not run successfully.
  exit code: 2

  [1 lines of output]
  C:\USR\BIN/python.exe: can't open file 'C:/usr/lib/python3.9/site-packages/C:/
usr/lib/python3.9/site-packages/pip': [Errno 2] No such file or directory
  [end of output]

 note: This error originates from a subprocess, and is likely not a problem wit
h pip.
error: subprocess-exited-with-error

pip subprocess to install build dependencies did not run successfully.
exit code: 2

See above for output.

note: This error originates from a subprocess, and is likely not a problem with
pip.

//Jan-Erik

8
Applications / A thought remote 2 local
« on: May 26, 2024, 09:37:41 am »
I would like to discuss something I've thought about for some time.
Do try to keep an open mind as you read it, with portions/combinations of virutal machine, rdp, citrix, odin, compiler, pathremapper etc.

Imagine that we have an OS but yet no current major applications for it.

If we could get one application that run "remotely" or in a virtual environment on another os, that would in the initial release send over bitmaps of the applicaiton window.
On the client side (on our OS) we would have an application that draw the application window on our desktop.
The client handle clipboard, send mouse and keyboard input to the server that start and run the application.
Nothing fancy, this is basiclly VNC today, but without a fully visible desktop.

The next release of the server would send over the resources (dialogs, bitmaps/images etc.)
The next release of the local client use local look and feel for those resources when applicable.

The server should then in small steps take over and act as sandbox to the application on the server.
Send drawing commands through the server instead of capturing images of the window. The server need to return that the drawing operation as "completed successfully" right away to not stall execution, while transferring the information to the client, thus use some asyncronious mechanism.
The client should take over drawing as much as possible.

The server determine portions of the execution that doesn't rely on external libraries (dll:s and system calls) as those should be possible to hand over to the client to store as executable code.

The server determine portions of the execution that rely on system calls and hand those over to the client to call versions available on our OS, compile locally and store as executable code.

I guess that the trickier parts emerge at this point, as the server handle external libraries that depend on each other and recreate/interpret (a 64-bit like odin) send it over to compile locally to our client OS and save as library.

Depending on the server OS, hard coded system paths and delimiters ( / instead of our \ ) may need special attention or subsystem support to not cause headache.

This is also the point when simple applications should be able to run on their on, locally on our until now "client" OS, without server and thus no longar as "client". The more libraries that can be translated the more applications will run, but the hateful exact version numbering problem that seem to be in fashion instead of "improve what you got" may be difficult to overcome.

Someone may have to buy portions of tech from IBM or ... to be able to accelerate hardware graphics.

9
Programming / Rexx dll for UniAud
« on: December 27, 2023, 12:09:49 pm »
Hello,

Here's a library to be used with rexx, designed to have the functionality of unimix.exe
The included script demonstrate what it can do, read it to see what it does.
The script doesn't contain an interactive mode as later versions of unimix do, but instead use a stem array to list and set values that you should find useful.

Use and test the script and library at your own risk, it is provided "AS IS". It is your own fault if you break something with it!

No further documentation, information or source code about the library is included in this package.

I do invite you to improve it! :)

Regards,
//Jan-Erik

10
Applications / 3D solid modelling in OS/2 with Irit and GuiIrit
« on: August 07, 2023, 08:48:05 am »
The only 3D solid modelling tool I've found for OS/2 is Irit V7.0, but I've actually never seen it in action and can't figure out how to make it show something. Input seem text based and I'm used to the point and click of Solid Edge v7 (ca. 1999) to design things.

Did however look at it at the Irit home page this weekend and the documentation mention OS/2 in various places for the current version (v12).

There's also a GUI for it (GUIrit) that use wxWindows. The installer for the win binary specifically mention OS/2!
Anyone got a built copy for OS/2 to spare?

Ohh, btw Sweet Home 3D version 7.1 can be used in 2D mode with OS/2 java 1.6 even though the web page mention that it need newer versions of java.

11
Applications / Apache OpenOffice Base
« on: April 16, 2023, 07:45:06 am »
Hi,

I have a need to use OpenOffice Base on ArcaOS-OS/2 and have now tried it over and over again in several versions over the years...
One can create a new connection, jdbc with OpenJDK 1.6 as well, add tables, use the wizards, create reports with Oracle Report Builder as well.
The problem start as one reopen the saved .odb file, I guess from all retries with different database engines* I've done, that it may skip over some initialiation routine and thus fail (bail out/abort) as it behave ok at first.

What can one do to overcome this?

PostgreSQL
MySQL
hsqldb (both emedded with OpenOffice and as stand alone server)
Derby
dbf
spreadsheet
etc.

Code: [Select]
   EBP     Address    Module     Obj:Offset    Nearest Public Symbol
 --------  ---------  --------  -------------  -----------------------
 Trap  ->  1F47D03E   LIBCN0    0001:000FD03E

 0012FA58  1F47D80A   LIBCN0    0001:000FD80A

 0012FA78  1F3DAC85   LIBCN0    0001:0005AC85

12
Multimedia / Mic/Line in with UniAud (3.0.1)
« on: January 16, 2022, 09:26:02 pm »
Hi,

The new build(s) of UniAud show more and more of the built in sound card (ATI HDA, ALC888) functionality with unimix.
I'd like to use the now enabled/recognized Mic in and/or Line in, but "Digital Audio" recorder and the os2tk45 "Audio Recorder Sample" and "Direct Audio" samples either stall the computer or the application. VoiceType therefore can't enable input.

Are there something to do?

Regards,
//Jan-Erik

13
Programming / redirect stdout, stderr and stdin
« on: July 28, 2021, 09:31:41 pm »
Hello,

would like to run one vio application at the time in a separate thread and redirect stdout, stderr and stdin to control it. Tried variations to the example found in "IBM Developers Toolkit version 4.5", "Control Program Programming Giude and Reference", "Redirecting Standard I/O for Child Processes".

The example only describe how to do it for stdout, but I've found examples that include stderr or stdin, but not quite the way intended here.

sqlite3.exe would be a great example.
One can start it and enter a command, wait for the output and then enter a new command (sql query) and continue, and not just a command at startup.

One would be able to write the support library required for oosqlite and Open Object Rexx 5.0.0 on OS/2-ArcaOS.  ;)

See attachment... Please do tell how it should be written instead.

//Jan-Erik

14
Setup & Installation / JRUN - Looking for Guinea pig(s)
« on: January 11, 2021, 03:12:28 pm »
Hello,

I'd like to ask you for help to test a rather advanced script I've created to aid launch of java applications.
The goal is to make it as easy to install a java app as click on a .jar/.class file.

The script can use OpenJDK 6 and Java 4 in parallel. (See README)

Please do tell me what alterations/adjustments and additions you make to the script as well as faults and problems.

Regards,
//Jan-Erik

Remember: If something goes wrong, it's your fault!

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

15
Programming / Android SDK with classic rexx
« on: September 16, 2019, 11:23:07 pm »
This is a script that create a program object that you can use to list and download Android SDK.
It download the current Android SDK and libraries as I write this.
Prerequisite: java and android-sdk_r24.4.1-windows.zip (as previously found through) unpacked to a folder
  • Just run the script by double clicking on it.
  • It search your computer for the unpacked sdk, copy itself and files it need and create a program object (if possible).
  • Double click on the program object and type "update sdk --filter 3,2,1" and follow the instructions.
    repeat the procedure with the packages you want to download, use "list sdk" to list available packages.
The script add "--no-ui --no-https" as it doesn't work otherwise.
Please also note that I don't know if you can actually develop something with the downloaded files, that is up to you to find out.
It was intended to act as a subsystem for development with NetRexx to create apps for Android, but I didn't persue it further since there are so few examples and information on how to actually code NetRexx apps and deploy them on Android.
Code: [Select]
/*
 * Filename: android.cmd
 *   Author: JanErik
 *  Created: Sun Sep 11 2016
 *  Purpose: Install SDK for Android in OS/2
 *  Changes: Mon Sep 16 2019 Changes to program object and startup configuration.
 *  Require: Zip SDK (such as android-sdk_r24.4.1-windows.zip), downloads updates live.
 */

'@echo off'
'@mode 80,102'
'@cls'

/* Set up prog to be the path of this script, including following symlinks,
   and set up progdir to be the fully-qualified pathname of its directory. */
PARSE SOURCE . . prog
PARSE ARG params

IF LENGTH( STRIP( params ) ) = 0 THEN
   params = '-h'

/* Grab current directory before we change it */
work_dir = DIRECTORY()

/* Change current directory and drive to where the script is, to avoid
 issues with directories containing whitespaces. */
PARSE VALUE REVERSE( prog ) WITH fname'\'this
this = REVERSE( this )
CALL DIRECTORY this

/* Load RexxUtil Library */
IF RxFuncQuery('SysLoadFuncs') THEN
DO
   CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
   CALL SysLoadFuncs
END

env = 'ENVIRONMENT'
/* Check we have a valid Java.exe in the path.*/
IF VALUE( 'JAVA_HOME',, env ) = '' THEN
DO
   CALL SysGetEA this, 'JAVA_HOME', 'java_path'
   IF STREAM( java_path'\JAVA.EXE', 'C', 'QUERY EXISTS' ) = "" THEN
      java_path = ''
   IF LENGTH( java_path ) < 2 THEN DO
      PARSE UPPER VALUE rxFind( 'JAVA.EXE', ' -version', 'VERSION "1.' ) WITH java_path'\BIN'
      IF LENGTH( java_path ) = 0 THEN
      DO
         CALL LINEOUT 'STDERR', 'JAVA engine not found'
         RETURN 1
      END
      CALL SysPutEA this, 'JAVA_HOME', java_path
   END
END
ELSE java_path = VALUE( 'JAVA_HOME',, env )

CALL SysGetEA this, 'ANDROID_PATH', 'android_path'
IF STREAM( android_path'\android.bat', 'C', 'QUERY EXISTS' ) = "" THEN
   android_path = ''
IF LENGTH( android_path ) < 2 THEN DO
   PARSE VALUE rxFind( 'android.bat' ) WITH android_path
   IF LENGTH( android_path ) = 0 THEN
   DO
      CALL LINEOUT 'STDERR', 'Android SDK not found'
      RETURN 2
   END
   CALL SysPutEA this, 'ANDROID_PATH', android_path
END
ext = 'cmd ico png'
DO i = 1 TO 3
   IF STREAM( android_path'\android.'SUBWORD( ext, i, 1 ), 'C', 'QUERY EXISTS' ) = '' THEN
      IF SysCopyObject( this'\android.'SUBWORD( ext, i, 1 ), android_path ) = 1 THEN
         CALL LINEOUT 'STDERR', 'Copied android.'SUBWORD( ext, i, 1 )' to "'android_path'"'
END
IF TRANSLATE( android_path ) <> TRANSLATE( this ) THEN
DO
   this = android_path
   work_dir = android_path
END

objID = 'ANDROID'
android_name = 'Android'
android_wps = 'Android SDK'
IF wpsObjectExist( '<WP_'objID'>' ) = 0 THEN
DO
   setupstring = 'OBJECTID=<WP_'objID'>;NOAUTOCLOSE=YES;EXENAME='this'\android.cmd;PARAMETERS=[Specify parameter (list sdk --filter 1)];ICONFILE='this'\'android_name'.ico;'
   IF SysCreateObject( 'WPProgram', android_wps, '<WP_DEVFLDR>', setupstring, 'U' ) <> 1 THEN
      CALL SysCreateObject 'WPProgram', android_wps, '<WP_DESKTOP>', setupstring, 'U'
   CALL rxAddBigIcon this'\'android_name'.png', '<WP_'objID'>'
END

jar_path = 'lib\sdkmanager.jar;lib\swtmenubar.jar'

/* Set SWT.Jar path based on current architecture (x86 or x86_64)*/
CALL DIRECTORY this
swt_path = ''
DO WHILE LENGTH( swt_path ) = 0
   DO WHILE QUEUED() > 0; PARSE PULL; END
   '@'java_path'\bin\java.exe -jar lib\archquery.jar|rxqueue'
   PARSE PULL swt_path
END

MkTempCopy:
    /* Copy android.bat and its required libs to a temp dir.
       This avoids locking the tool dir in case the user is trying to update it.*/

   tmp_dir = VALUE( 'TEMP',,'ENVIRONMENT' )'\temp-android-tool'
   cpy = swt_path'\* common.jar commons-codec* commons-compress* commons-logging dvlib.jag gson* guava* httpclient* httpcore* httpmime* layoutlib-api.jar org-eclipse-* sdk* swtmenubar.jar'
   DO i = 1 TO WORDS( cpy )
      cpyfile = 'lib\'SUBWORD( cpy, i, 1 )
      IF POS( '*', cpyfile ) > 0 THEN
      DO
         CALL SysFileTree this'\'cpyfile, 'file.', 'SFO'
         DO j = 1 TO file.0
            CALL rxCpyFile this, file.j, tmp_dir
         END
      END
      ELSE CALL rxCpyFile this, this'\'cpyfile, tmp_dir
   END

   /* jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs.*/
   tools_dir = android_path
   CALL DIRECTORY tmp_dir

EndTempCopy:

   /* The global ANDROID_SWT always override the SWT.Jar path */
   IF VALUE( 'ANDROID_SWT',,'ENVIRONMENT' ) <> '' THEN
      swt_path = VALUE( 'ANDROID_SWT',,'ENVIRONMENT' )
   ELSE
      swt_path = this'\lib\'swt_path
   IF DIRECTORY( swt_path ) = '' THEN
   DO
      CALL LINEOUT 'STDERR', 'ERROR: SWT folder "'swt_path'" does not exist.'
      CALL LINEOUT 'STDERR', 'Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.'
      RETURN 2
   END

SetPath:
/* Finally exec the java program and end here.
 REMOTE_DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000*/
   IF 0 = POS( TRANSLATE( java_path ), TRANSLATE( VALUE( 'PATH',,'ENVIRONMENT' ) ) ) THEN
      CALL VALUE 'PATH', java_path'\bin;'||STRIP( VALUE( 'PATH',,'ENVIRONMENT' ),, ';' ), 'ENVIRONMENT'
   IF 0 = POS( TRANSLATE( tools_path ), TRANSLATE( VALUE( 'PATH',,'ENVIRONMENT' ) ) ) THEN
      CALL VALUE 'PATH', tools_path'\lib;'||STRIP( VALUE( 'PATH',,'ENVIRONMENT' ),, ';' ), 'ENVIRONMENT'
   CALL DIRECTORY tools_dir
   '@java "-Dcom.android.sdkmanager.toolsdir='tools_dir'" "-Dcom.android.sdkmanager.workdir='work_dir'" -classpath "'jar_path';'swt_path'\swt.jar" com.android.sdkmanager.Main 'params' --no-ui --no-https'
   CALL DIRECTORY work_dir
RETURN rc
   
rxCpyFile: PROCEDURE
   PARSE VALUE REVERSE( SUBSTR( ARG(2), LENGTH( ARG(1) ) + 1 ) ) WITH fname'\'fpath
   fpath = REVERSE( fpath )
   rc = rxMkDir( ARG(3)fpath )
   IF rc = 0 & STREAM( ARG(3)fpath'\'REVERSE( fname ), 'C', 'QUERY EXISTS' ) = '' THEN
      rc = SysCopyObject( ARG(2), ARG(3)fpath )
RETURN rc
   
rxChk: PROCEDURE
   DO WHILE QUEUED() > 0; PARSE PULL; END;
   '@'||ARG(1)||ARG(2)||' 2>>&1 | RXQUEUE'
   DO WHILE QUEUED() > 0
      IF POS( TRANSLATE( ARG(3) ), TRANSLATE( LINEIN( 'QUEUE:' ) ) ) > 0 THEN
         IF LENGTH( ARG(4) ) > 0 THEN RETURN ARG(4)
   END
RETURN ''
   
rxFind: PROCEDURE EXPOSE !_msg_!.
   env = 'ENVIRONMENT'
   PARSE VALUE REVERSE( SysSearchPath( 'PATH', ARG(1) ) ) WITH fname'\'fpath
   fpath = REVERSE( fpath )
   fname = REVERSE( fname )
   IF ARG() > 1 & LENGTH( fpath ) > 0 THEN
      fspec = rxChk( fpath'\'fname, ARG(2), ARG(3), fpath )
   ELSE IF STREAM( fpath'\'fname, 'C', 'QUERY EXISTS' ) <> '' THEN
      fspec = fpath
   ELSE fspec = ''
   IF LENGTH( fspec ) > 0 THEN RETURN fspec
   CALL LINEOUT 'STDERR', VALUE( 'PROGRAMS',, env )
   IF POS( '*', ARG(1) ) = 0 THEN fname = '*'ARG(1)
   ELSE fname = ARG(1)
   CALL SysFileTree VALUE( 'PROGRAMS',, env )'\'fname, 'file.', 'SFO'
   DO i = 1 TO file.0
      PARSE VALUE REVERSE( file.i ) WITH .'\'fspec
      IF ARG() > 1 THEN
         fspec = rxChk( file.i, ARG(2), ARG(3), REVERSE( fspec ) )
      ELSE
         fspec = REVERSE( fspec )
      IF LENGTH( fspec ) > 0 THEN RETURN fspec
   END
   drives = SysDriveMap( 'C:', 'USED' )
   DO j = 1 TO WORDS( drives )
      CALL LINEOUT 'STDERR', SUBWORD( drives, j, 1 )
      CALL SysFileTree SUBWORD( drives, j, 1 )||'\'fname, 'file.', 'SFO'
      DO i = 1 TO file.0
         PARSE VALUE REVERSE( file.i ) WITH .'\'fspec
         IF ARG() > 1 THEN
            fspec = rxChk( file.i, ARG(2), ARG(3), REVERSE( fspec ) )
         ELSE
            fspec = REVERSE( fspec )
         IF LENGTH( fspec ) > 0 THEN RETURN fspec
      END
   END
RETURN ''   
   
rxMkDir: PROCEDURE
    rc = ( DIRECTORY( ARG(1) ) = '' )
    IF rc = 1 THEN
        IF \rxMkDir( STRIP( FILESPEC( 'D', ARG(1) )FILESPEC( 'P', ARG(1) ), 'T', '\' ) ) THEN
           rc = SysMkDir( ARG(1) )
Return rc
   
rxAddBigIcon: PROCEDURE EXPOSE !_msg_!. java_path
    crlf = D2C(13)D2C(10)
    bigicons_dir = VALUE( 'BIGICONS',, 'ENVIRONMENT' )
    bigicon = FILESPEC( 'N', ARG(1) )
    objid = ARG(2)
    IF LENGTH( bigicons_dir ) > 0 THEN
    DO
        IF STREAM( ( bigicons_dir'\'bigicon ), 'C','QUERY EXISTS') = '' THEN
           IF SysCopyObject( ARG(1), bigicons_dir ) = 0 THEN
              RETURN 1
        IF STREAM( bigicons_dir'\bigicons.txt', 'C', 'QUERY EXIST' ) <> '' THEN
        DO
            f_size = STREAM( bigicons_dir'\bigicons.txt', 'C', 'QUERY SIZE' )
            IF f_size > 0 THEN
            DO
                input = CHARIN( bigicons_dir'\bigicons.txt', 1, f_size )
                CALL STREAM bigicons_dir'\bigicons.txt', 'C', 'CLOSE'
                PARSE UPPER VALUE input WITH pre'"'(bigicon)'"'post
                IF LENGTH( post ) > 0 THEN RETURN 2
                PARSE UPPER VALUE input WITH pre'"'(objid)'"'post
                IF LENGTH( post ) > 0 THEN RETURN 3
                PARSE VALUE input WITH pre'[OBJECTID]'mid(crlf)(crlf)'['post
                input = pre'[OBJECTID]'STRIP( STRIP( mid, 'T', D2C(10) ), 'T', D2C(13) )||crlf||LEFT( '"'objid'"', 28 )'"'bigicon'"'crlf||crlf'['post
                CALL SysFileDelete bigicons_dir'\bigicons.txt'
                CALL CHAROUT bigicons_dir'\bigicons.txt', input
                CALL STREAM bigicons_dir'\bigicons.txt', 'C', 'CLOSE'
            END
            ELSE RETURN 4
        END
    END
RETURN 0

/* Code borrowed from REXX Tips & Tricks v3.60 */
wpsObjectExist: PROCEDURE /* parameter: '<new_wps_object_id>', return: 1 exist, 0 doesn't exist, 43 error */
  PARSE ARG objID
  rc = 43               /* init return/error code 43 = routine not found */
  SIGNAL ON SYNTAX NAME ObjectExistError

  IF SUBSTR( objID, 2, 1 ) <> ":" THEN
      IF LEFT( objID, 1 ) <> "<" & RIGHT( objID, 1 ) <> ">" THEN
          objID = "<" || objID || ">"

  /* create the object and see if it fail */
  tempRC = SysCreateObject( "WPFolder", "TestObject", "<WP_NOWHERE>", "OBJECTID=" || objID || ";", "FAIL" )

  IF tempRC = 1 THEN
  DO
    CALL SysDestroyObject objID
    rc = 0
  END
  ELSE
    rc = 1

ObjectExistError:

RETURN rc

Pages: [1] 2 3