### Author Topic: REXX script to set default folder 'Open As'?  (Read 934 times)

#### Dariusz Piatkowski

• Sr. Member
• Thank You
• -Given: 13
• -Receive: 8
• Posts: 433
##### REXX script to set default folder 'Open As'?
« on: June 06, 2018, 05:56:08 pm »
I am migrating my OS/2 based media (photo & video albums for starters) to our NAS box (ZyXel 325v2). The NAS box configuration does not support EAs. The vendor has been non-responsive to my inquiries to make the change, and since this is not a widely used NAS product the community supported changes/enhancements are scarce, ie I haven't found a way to implement the required smb.conf changes on the NAS Samaba server.

OK, so this means that by using NetDrive and Samba plug-in I have a SHADOW of the NAS Photo folder on my Desktop, however, since the shadow does not support EAs I am unable to default the standard 'Open As' to use the XWP's "Xview" mode. Or at least, when I set it following a re-boot, that change is not persistent and will revert back to the standard 'Icon view' following a re-boot.

Therefore, my thinking is to write a REXX script to be executed as part of the WPS start-up routine, to set the 'Open As' to 'Xview' mode. That way any future attempts to open the folder will produce the structure I am looking for.

Sooo...any ideas how to go about this? I have some REXX experience, mostly reading scripts and writting some small stuff, but this type of stuff is well beyond my comfort zone.

Thanks everyone!

#### Pete

• Hero Member
• Thank You
• -Given: 1
• -Receive: 28
• Posts: 640
##### Re: REXX script to set default folder 'Open As'?
« Reply #1 on: June 06, 2018, 09:36:38 pm »
Hi Dariusz

A few years ago I had a Linksys nas with the ea problem. I rectified that by installing an open source version of the os.

No idea if you can do that with the ZyXel 325v2 but it may be worth looking into - maybe https://www.nas4free.org/ would be a place to start.

Regards

Pete

#### André Heldoorn

• Sr. Member
• Thank You
• -Given: 38
• -Receive: 9
• Posts: 291
##### Re: REXX script to set default folder 'Open As'?
« Reply #2 on: June 06, 2018, 10:42:15 pm »
Quote
write a REXX script to be executed as part of the WPS start-up routine, to set the 'Open As' to 'Xview' mode. That way any future attempts to open the folder will produce the structure I am looking for.
Create a WPProgram object (SAMPLE.CMD) instead of a WPFolder object? The WPProgram can open a folder with any supported view.

Code: [Select]
/* SAMPLE.CMD */CALL RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData'view="XVIEW"                      /* Adjust if needed              */mydir="N:\AS\My Images\2018\06"   /* Points to folder to be opened */CALL SysSetObjectData mydir,"OPEN="||view||";"   /* Open       */CALL SysSetObjectData mydir,"OPEN="||view||";"   /* Foreground */EXIT

#### Andreas Schnellbacher

• Sr. Member
• Thank You
• -Given: 1
• -Receive: 16
• Posts: 314
##### Re: REXX script to set default folder 'Open As'?
« Reply #3 on: June 07, 2018, 01:44:21 am »
Dariusz, I don't fully understand what you expect to work with the NAS and what you want to achieve.

File objects store their settings in EAs, abstract objects use the OS2.INI plus the object handles of OS2SYS.INI for that. Shadow objects are abstract objects.

The XView setting for a folder, formerly 'Split view', is not a standard WPS setting. The three standard views are saved in its .CLASSINFO EA, while the XView object handles are saved in OS2.INI -> XWorkplace:SplitViews.
This was wrong, as written by Rich. Corrected: The views are saved in a folder's .CLASSINFO EA.

So, it appears to me that you don't have to worry about anything.
« Last Edit: June 08, 2018, 09:12:46 pm by Andreas Schnellbacher »

#### Dariusz Piatkowski

• Sr. Member
• Thank You
• -Given: 13
• -Receive: 8
• Posts: 433
##### Re: REXX script to set default folder 'Open As'?
« Reply #4 on: June 07, 2018, 04:13:07 am »
Pete,
I did look at some open source projets like the stuff on nas-central.org (Entware-ng) in the past, but never pursued it beyond just the research part of it. Basically I could not find anything pre-made which simply required me to deploy the setup, all the solutions required some hands-on trial and error approach which left me a tad uneasy about leaving all of my media on such a 'custom' device afterwards.

André,
Thanks, that could be an option if I can not get this configured. Ideally, I would like to write thd REXX code to programmatically execute the equivalent of doing the setup work to default the folder shadow object to open up in the Xview mode instead of the default Icon mode.

Andreas,
The write-up above in my response to André explains it. I have a shadow of the folder which resides on my NAS box, which stores the photos, present on my OS/2 desktop. I thought that I should be able to adjust the object settings of the shadown object just as you pointed out in your post. However, that has not turned out to be possible. Any changes I make are simply lost upon a re-boot. This may be caused by the fact that this is a NetDrive transport object if you will, I simply do not know, but that shadow folder does not behave like other native OS/2 shadow folders do.

I will dig into this a tad more, for example attempting to find the OS2.ini=>Xworkpalce:SplitViews reference to this shadow folder. As I make the defaul 'Open As' change it should be reflected in the OS2.INI file itself.

#### André Heldoorn

• Sr. Member
• Thank You
• -Given: 38
• -Receive: 9
• Posts: 291
##### Re: REXX script to set default folder 'Open As'?
« Reply #5 on: June 07, 2018, 10:13:15 am »
Quote
I would like to write thd REXX code to programmatically execute the equivalent of doing the setup work to default the folder shadow object to open up in the Xview mode instead of the default Icon mode.

I'm not using a NAS nor XVIEW. OPEN opens a WPFolder with a specified supported setting (e.g. "OPEN=XVIEW"). The WPS setup string to (try to) change the default view is "DEFAULTVIEW=XVIEW".

So enter the right folder name, remove one of the (nearly) identical SysSetObjectData-lines, and replace OPEN by DEFAULTVIEW. Perhaps first try to set a different default view first, like TREE, to test the concept, because XVIEW is a guessed name of a view.

If you are using NetDrive, then you may have to insert a command to connect to the drive in question first, like ...

'@ND.EXE automnt NAS.NDC'

... to try to make sure that the WPFolder does exist. Please note that this whole method tries to set a DEFAULTVIEW. That operation may fail. The sample itself doesn't print any error message.

If my copy of the toolkit documentation is anything to go by, then a WPShadow object doesn't support DEFAULTVIEW. Hence the need to (try to) change the default view of the folder itself.

Code: [Select]
/* SAMPLE.CMD */CALL RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData''@ND.EXE automnt NAS.NDC'CALL SysSetObjectData 'N:\AS drive\My Images\2018\06','DEFAULTVIEW=XVIEW'EXIT
BTW: if one upgrades eCenter of eCS 1.x by using xCenter, large or small package, will e.g. the appearance of the "eButton" (eCS-button) change too? Or is it a seamless upgrade? My WPFolder objects only show the 3 default view options.
« Last Edit: June 07, 2018, 10:25:33 am by André Heldoorn »

#### Andreas Schnellbacher

• Sr. Member
• Thank You
• -Given: 1
• -Receive: 16
• Posts: 314
##### Re: REXX script to set default folder 'Open As'?
« Reply #6 on: June 07, 2018, 07:52:28 pm »
oo.exe by Rich Walsh might provide the easiest option: (The U or U1 switch for the open action could work.) Instead of modifying settings for the objects to open, create oo.exe program objects with the required parameters (see oo.txt) on your desktop. These program objects should be started minimized and close on exit. Add a folder icon. Then they feel like a hard link, are permanent and can be saved.

If you can't get oo.exe to work for XView, you can also use a REXX script for that.

----

Additional thoughts about remote Netdrive folders (I don't have actually the chance to test it):

Even when these folders are standard WPS objects, for which object handles are stored in OS2SYS.INI, they apparently don't get re-used after reboot. IBM's File and Print client might behave different. (Someone with more knowledge should correct me, if I'm wrong.)

#### Rich Walsh

• Jr. Member
• Thank You
• -Given: 0
• -Receive: 6
• Posts: 60
• O N U !
##### Re: REXX script to set default folder 'Open As'?
« Reply #7 on: June 07, 2018, 11:32:22 pm »
After the drive is mounted, run this to set the default view using 'oo.exe':

oo /a x:\path\to\folder "DEFAULTVIEW=XVIEW;"

If for some reason "XVIEW" doesn't work, you can use its numeric value instead: 26611

FYI... OS2.INI -> XWorkplace:SplitViews contains various settings that are used when a folder is opened in Xview (e.g. the window's size and position). It does not control whether a given folder opens in Xview.

#### André Heldoorn

• Sr. Member
• Thank You
• -Given: 38
• -Receive: 9
• Posts: 291
##### Re: REXX script to set default folder 'Open As'?
« Reply #8 on: June 08, 2018, 10:21:02 am »
Quote
If you can't get oo.exe to work for XView, you can also use a REXX script for that.
Yes, if oo.exe is installed then using that is recommended indeed. REXX does answer the on-topic question, but REXX may stop working when you ran out of shared memory and in this case the REXX code just is a constant one-liner.

For versions of eCS without oo.exe there's http://hobbes.nmsu.edu/download/pub/os2/dev/wps/oo-rws080-ecs12.zip, so all users of eCS can use the same full x:\ECS\BIN\OO.EXE path in a STARTUP.CMD to improve the speed of booting. Dunno where ArcaOS saved its copy of oo.exe.

Quote
oo /a x:\path\to\folder "DEFAULTVIEW=XVIEW;"

FWIW and in general. "HELP REXX SysCreateObject" refers to "A WinCreateObject setup string", like this DEFAULTVIEW setup string. If the OS/2 Toolkit is properly installed, then the OS/2 command "VIEW.EXE WPS1 WPFolder" shows all documented (default OS/2) setup strings for WPFolder objects. An example could be "ICONFILE=C:\My icons\NAS drive image folder.ICO;DEFAULTVIEW=DETAILS;ICONVIEW=FLOWED".
« Last Edit: June 08, 2018, 11:00:02 am by André Heldoorn »

#### Dariusz Piatkowski

• Sr. Member
• Thank You
• -Given: 13
• -Receive: 8
• Posts: 433
##### Re: REXX script to set default folder 'Open As'?
« Reply #9 on: June 08, 2018, 03:46:45 pm »
André and Rich,

Awesome you guys, both your methods work!!!

Also, that "oo" thing is darn spiffy...sorry, been using OS/2 for years just never realized this was out there and the flexibility it gives you. I dug up 'Version 1.10 released July 3, 2007', is that the latest one available?

Right now my approach is to include the call to oo.exe in the startup.cmd as I believe the NetDrive mapping is in-place by that time. Will test that next though as I'm not sure if the full WPS has to be up and running (namely DESKTOP is up) before oo.exe can default a setting for a shadow folder...no biggie quick test will show. If this does not work I will put a separate nas_start.cmd into my XWP Start-up folder with all the other things I have there.

Thanks again you guys!!!

#### Dariusz Piatkowski

• Sr. Member
• Thank You
• -Given: 13
• -Receive: 8
• Posts: 433
##### Re: REXX script to set default folder 'Open As'?
« Reply #10 on: July 03, 2018, 07:58:27 pm »
Guys!

Quick follow-up...is there a CLI (through CMD) way to accomplish the following:

1) Set folder icon
2) issue a "Right Mouse button" click on a folder

Here is why I'm having to do this:

1) folder icon - since the NAS does not support extended attributes I am thinking of just issuing the 'set icon' comand at boot time against all the NAS folder shadows which I have on my Desktop, yeah, ugly, but it seems to be the only way?

2) RMB - due to the confilicts between the software on my machine if I start the NDCTL (NetDrive) from CONFIG.SYS or STARTUP.CMD I end up eventually crashing the NDCTL code, re-start gets me back up and running, but what a PITA to find out your shares have "gone away" half-way through an operation. On the other hand, if I start it up from XWP Start-Up folder it works successfully, no crash, and so that is how I'm starting it up...however, the downside to this is that as WPS comes up the NDCTL is not up and running and so the NAS folder shadows do not correctly map to the NAS yet. What shows up instead is the 'broken link' icon which of course is re-populated as soon as I RMB on the folder. So basically, I am attempting to force the WPS to recognize that the shadow now has a correct mapping...maybe there is something better than RMB???

#### André Heldoorn

• Sr. Member
• Thank You
• -Given: 38
• -Receive: 9
• Posts: 291
##### Re: REXX script to set default folder 'Open As'?
« Reply #11 on: July 10, 2018, 09:14:00 am »
Quote
Quick follow-up...is there a CLI (through CMD) way to accomplish the following:

1) Set folder icon
2) issue a "Right Mouse button" click on a folder

1. Yes. My previous reply addresses this. One of the WPFolder settings, like setting the default view.
2. Rexx scripts offer more control. Or some regular "IF NOT EXIST N:\AS\README.PDF NDCTL.EXE AUTOMNT NAS.CTL" CMD line.

OO.EXE is better than Rexx, albeit that doesn't imply that using Rexx (when you don't have to) is bad. Differences can be trivial. As trivial as costing 1 out of 1 million REXX.DLL lives per WPS IPL.
« Last Edit: July 10, 2018, 09:15:43 am by André Heldoorn »

#### Dariusz Piatkowski

• Sr. Member
• Thank You
• -Given: 13
• -Receive: 8
• Posts: 433
##### Re: REXX script to set default folder 'Open As'?
« Reply #12 on: July 15, 2018, 03:12:59 pm »
Hi André,

Quote
Quick follow-up...is there a CLI (through CMD) way to accomplish the following:

1) Set folder icon
2) issue a "Right Mouse button" click on a folder

1. Yes. My previous reply addresses this. One of the WPFolder settings, like setting the default view...

Well, your previous response points me in the general direction, albeit, even then it specifically points out the use of WinCreateObject, which is not something I should do, after all, I am not attempting to create a NEW object, instead I simply want to update an existing object.

What I was looking for would be an alternative, such as a folder equivalent of SysSetIcon. Since this is a folder I would also want the 'animated' option, meaning the different icons which refelct the Closed & Open statuses. Since these are stored in EAs I would need a function to update that, as best as I can tell that might be SysPutEA, again though, is this something that will work on a folder??? I do not know, I have not tried yet, but before I go through this I figured I would seek the hands-on experience of the group first...

Thank you though!

#### Alex Taylor

• Full Member
• Thank You
• -Given: 10
• -Receive: 15
• Posts: 233
##### Re: REXX script to set default folder 'Open As'?
« Reply #13 on: July 15, 2018, 06:01:33 pm »
What I was looking for would be an alternative, such as a folder equivalent of SysSetIcon. Since this is a folder I would also want the 'animated' option, meaning the different icons which refelct the Closed & Open statuses. Since these are stored in EAs I would need a function to update that, as best as I can tell that might be SysPutEA, again though, is this something that will work on a folder??? I do not know, I have not tried yet, but before I go through this I figured I would seek the hands-on experience of the group first...

SysSetObjectData is what you want.

Code: [Select]
folder = 'c:\some\folder'   /* or <object_id> */call SysSetObjectData folder, 'ICONFILE=c:\some\closed_folder.ico;ICONNFILE=1,c:\some\open_folder.ico;'

#### André Heldoorn

• Sr. Member
• Thank You
• -Given: 38
• -Receive: 9
• Posts: 291
##### Re: REXX script to set default folder 'Open As'?
« Reply #14 on: July 15, 2018, 10:34:20 pm »
Quote
Well, your previous response points me in the general direction, albeit, even then it specifically points out the use of WinCreateObject, which is not something I should do, after all, I am not attempting to create a NEW object, instead I simply want to update an existing object.

I'm quite sure the rather specific WPS setup string ICONFILE does occur in that previous reply of me. Which, as such, has nothing to do at all with nothing but creating NEW objects.
« Last Edit: July 15, 2018, 10:36:22 pm by André Heldoorn »