Author Topic: How to force a folder 'refresh' from REXX?  (Read 1334 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 32
  • Posts: 1002
  • Karma: +21/-0
    • View Profile
How to force a folder 'refresh' from REXX?
« on: April 11, 2020, 04:30:43 pm »
I want to be able to run an on-demand (scheduled most likely) forced refresh of a particular folder, is there a call in REXX that would allow me to do so?

Basically I'm thinking the equivalent of 'RMB=>Refresh Now'.

Reason being: the built-in logic of XWP refresh causes frequent traps here (not hard trap, but soft trap) where XWP folders stop populating, this always requires either a Desktop re-start, or a complete re-boot. Since shutting this feature OFF I have been able to maintain pretty good WPS stability and rarely have the need today to force a re-boot.

However, there are certain folders, like my NAS LOG directory (where I'm sending all the various system LOGs) which of course are being populated very frequently and which my machine has a hard time detecting on a timely basis. Result being that from CLI I can see LOG udpates having been done, but through WPS these updated entries do not show up.

My thinking therefore is to schedule a forced refresh, run every 5 mins (I will play around with this) so that such particular folders are always up-to-date.

The NAS box access is through NetDrive and is a Samba share, I am currently using RL Walsh's OO.EXE to set the default folder view on several NAS folders to XVIEW, but as best as I can tell there is no option there for me to do a folder refresh.

Thanks!

Andreas Schnellbacher

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 39
  • Posts: 724
  • Karma: +12/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #1 on: April 11, 2020, 04:57:41 pm »
Code: [Select]
/**/

CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
CALL SysLoadFuncs

Dir = STRIP( ARG( 1))
IF LEFT( Dir, 1) = '"' THEN
   PARSE VAR Dir '"'Dir'"'

CALL SysSetObjectData Dir, 'MENUITEMSELECTED=503;'

EXIT
« Last Edit: April 11, 2020, 10:13:57 pm by Andreas Schnellbacher »

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 32
  • Posts: 1002
  • Karma: +21/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #2 on: April 11, 2020, 06:35:49 pm »
Hi Andreas,

Code: [Select]
/**/

CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
CALL SysLoadFuncs

Dir = STRIP( ARG( 1))
IF LEFT( Dir) = '"' THEN
   PARSE VAR Dir '"'Dir'"'

CALL SysSetObjectData Dir, 'MENUITEMSELECTED=503;'

EXIT

Thank you.

There is a small correction to the above, where you want to check for the presence of " character you need to pass number of places to the LEFT function, therefore what works here is:

Code: [Select]
IF LEFT( Dir,1) = '"' THEN

I assume 'MENUITEMSELECTED=503' references the 'Folder Refresh' function? If so, what's the best place for me to check to understand all these? I have the "OS/2 REXX from Bark to Byte" book here, so now that you've pointed me  to the SysSetObjectData call I am able to go a bit further with this...

Remy

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 15
  • Posts: 414
  • Karma: +0/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #3 on: April 11, 2020, 06:48:05 pm »
Hi Dariusz,

Don't create any rexx and just use the provide tool under ArcaOS.

See here:
https://www.arcanoae.com/wiki/arcaos/post-install-tips-hints/

Under chapter :
Shadows in Tree view folders are not immediately rendered at desktop startup

(this update followed a ticket I opened in the past due to folder not correctly refreshed etc...)

Andreas Schnellbacher

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 39
  • Posts: 724
  • Karma: +12/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #4 on: April 11, 2020, 10:20:41 pm »
Code: [Select]
IF LEFT( Dir,1) = '"' THEN
Sure. Changed above.

If you still need the loop or scheduling function in REXX, even though Remy has made another suggestion, ask here.

Andreas Schnellbacher

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 39
  • Posts: 724
  • Karma: +12/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #5 on: April 11, 2020, 10:34:55 pm »
I assume 'MENUITEMSELECTED=503' references the 'Folder Refresh' function? If so, what's the best place for me to check to understand all these?
It took a while, but I've found it in REXX Tips & Tricks:

Code: [Select]
start view /s rxtt36 "IDs for the setup string MENUITEMSELECTED"

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 32
  • Posts: 1002
  • Karma: +21/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #6 on: April 11, 2020, 10:43:18 pm »
Hi Remy,
...Don't create any rexx and just use the provide tool under ArcaOS.

See here:
https://www.arcanoae.com/wiki/arcaos/post-install-tips-hints/...

Good suggestion, but it is not quite the problem I am seeing. During re-boot all is good...but as the NAS located folder is updated at the source (NAS) the changes take a long time, or sometimes never get reflected on the OS/2 side of things (so WPS). This is the reason why I want to force the folder refresh to happen on on-going basis.

Your link did give me some other ideas though, the suggestion made there is to use OO.EXE to issue a listing of folder contents (where output goes to nul), thus forcing a refresh of the folder. Since I am already using OO.EXE that may keep things more consistent.

The thing is that the results I'm getting are somewhat incosistent, namely, I can point to that NAS folder through it's objectid or through the actual filesystem name:
Code: [Select]
[G:\util\misc]oo /I 0x36C68
36C68  ----  XFolder  "V:\PUBLIC\SYSLOG"

[G:\util\misc]oo /I 0x3C7E6
3C7E6  ----  XFolder  "V:\PUBLIC\SYSLOG\202004"

[G:\util\misc]oo /I v:\public\syslog\202004
3C7E6  ----  XFolder  "V:\PUBLIC\SYSLOG\202004"

[G:\util\misc]oo /L v:\public\syslog\202004
0 objects in V:\PUBLIC\SYSLOG\202004

The attempt to list the contents "/L" shows 0 objects...but I certainly have files there:

Code: [Select]
[G:\]dir V:\PUBLIC\SYSLOG\202004

The volume label in drive V is NETDRIVE.
Directory of V:\PUBLIC\SYSLOG\202004

 4-09-20   6:15a     <DIR>           0  .
 4-09-20   6:15a     <DIR>           0  ..
 4-07-20  11:58p     60644           0  192.168.1.1_20200407.txt
 4-05-20   6:43p     33464           0  192.168.1.10_20200405.txt
 4-03-20  10:52p     84015           0  192.168.1.1_20200403.txt
 4-02-20  10:50p      7451           0  192.168.1.10_20200402.txt
 4-09-20   6:15a      2351           0  192.168.1.10_20200409.txt
 4-08-20  11:57p     72364           0  192.168.1.1_20200408.txt
 4-08-20  10:47p      7053           0  192.168.1.10_20200408.txt
 4-10-20  11:52p      2644           0  192.168.1.10_20200410.txt
 4-06-20  11:34p     57043           0  192.168.1.1_20200406.txt
 4-02-20  10:30p     82303           0  192.168.1.1_20200402.txt
 4-09-20  11:24p     63599           0  192.168.1.1_20200409.txt
 4-10-20  11:59p     56475           0  192.168.1.1_20200410.txt
 4-05-20  11:59p     57198           0  192.168.1.1_20200405.txt
 4-02-20  11:00p      2351           0  192.168.1.10_20200403.txt
 4-04-20  10:57p     71024           0  192.168.1.1_20200404.txt
 4-11-20   1:52p      3860           0  192.168.1.10_20200411.txt
 4-01-20   9:58p      3468           0  192.168.1.10_20200401.txt
 4-11-20   4:27p     56320           0  192.168.1.1_20200411.txt
 4-01-20  10:48p     64493           0  192.168.1.1_20200401.txt
       21 file(s)     788120 bytes used
                   2308202 M bytes free

Assuming that '/L' only shows non-file objects in folder (as the OO.EXE) help explains I thought I would test on the parent folder (V:\PUBLIC\SYSLOG) which certainly will show the data specific log folder (202004), still that returns 0 as well.

I will try this out though, maybe enough to force a refresh.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Thank You
  • -Given: 15
  • -Receive: 32
  • Posts: 1002
  • Karma: +21/-0
    • View Profile
Re: How to force a folder 'refresh' from REXX?
« Reply #7 on: April 11, 2020, 10:46:54 pm »
Andreas,

I assume 'MENUITEMSELECTED=503' references the 'Folder Refresh' function? If so, what's the best place for me to check to understand all these?
It took a while, but I've found it in REXX Tips & Tricks:

Code: [Select]
start view /s rxtt36 "IDs for the setup string MENUITEMSELECTED"

Yup, got it, I was able to find it, excellent pointer, thank you again!