English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System > Coders. Scripting

 
 
Thread Tools
Old 16 March 2018, 07:44   #1
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
[opus5][arexx] "Lister Empty..." command - problem

Hi,
there may be something wrong with:
Code:
Lister Empty [handle]
Everytime I use it it closes my port for custom handlers!!

I'm trying to finf out why my own (custom) listers do not have any cache assigned to them.
In manual it says that
Code:
 Liser Findcache [handle] [name]
will do the trick (where [name] is a custom title of a lister or its path field - none of these is working).

So far I managed to get a cache displayed for custom lister only when I use "Lister Empty [handle]" and then "Lister Findcache [handle]" without anything in the [name] parameter - but as I said before "Lister Empty" closes my port and then my script becomes useless

Anybody tried this stuff before?
Thanks.

Last edited by peceha; 16 March 2018 at 07:49.
peceha is offline  
Old 16 March 2018, 18:23   #2
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Did you read the note about caches in "Custom Handlers for Listers"?
daxb is online now  
Old 16 March 2018, 19:00   #3
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Well... just now but anyway I don't fully understand it.

Maybe let me describe what I'm trying to do so it will be easier to get the answer if it is going to work or not.

- I have a clean lister.
- I add few entries to it (Lister Addstem ...) and set them as folders.
- I assign right click menu for each item and double click action (to behave like a normal folder when double clicked)
- that lister has a custom title (so the cache name can take its name)

Now, when "a folder" is double clicked:
-the lister gets cleared
-the lister's title is set to folder's name
-the lister is being populated with new entries (type "file"), the entries are read from file
-each entry has a menu assigned to it and double click action

Because the whole operation of setting up all the item takes quite long I was hopping there would be some cache in the memory so I could use it next time I enter the same folder.

Scenario:
- I'm at the root level (the one with folders) and now I double click one of them.
Dopus reads all the items that should be displayed - it takes about 43sec for 800 entries.

-Once the lister is filled out with new items I go back to root level.

-When the root level is alredy displayed in the lister I double click the folder I just came from ... and it takes again ~40sec --->>> here I hoped some cache would take over and immediately give me the folder's content.

Could be that i'm doing here something wrong and it will never work that way

Thanks

Last edited by peceha; 16 March 2018 at 21:36.
peceha is offline  
Old 17 March 2018, 15:15   #4
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Have a look at DOpus Environment settings -> Directories Buffer (or named different). Just in case it affects the cache. In other words, check manually if the cache works: Open your lister with root level, go to your 800 entries dir, back to root and then again to the 800. Normally DOpus do automatic cache if not disabled.

I'm not sure but maybe the note says that the cache is set only at the time when"lister set ..." is done and contains the current visible entries.

There should exists an cache bug with DOpus 5.82 that might be responsible.
daxb is online now  
Old 17 March 2018, 16:04   #5
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
I checked that option:
maximum directories to cache is set 25
disable directory casching is OFF

The cache is working for "normal" folders and files (i.e. real objects on hard drive): when I browse some location on my HD and then use "cacheList" I can see all the folders I just visited - clicking on it brings me the folder's content right away.

It doesn't show my 800 entries folder there - but I think it is correct since CACHELIST will not show custom lister's cache.

Quote:
I'm not sure but maybe the note says that the cache is set only at the time when"lister set ..." is done and contains the current visible entries.
That is something!!!
I just changed the order of LISTER SET ... commands so the LISTER SET TITLE goes after all files show up in the lister .... and I'm getting somewhere - I can display custom cache but still only if I do not pass any [NAME] parameter to LISTER FINDCACHE.

Anyway, thanks for you help !! - I think it is just a matter of few hours now and I will have a working script
peceha is offline  
Old 17 March 2018, 17:06   #6
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
I have some updates on that subject - could be usefull for somobedy...

1. In opus arexx manual ("custom handlers: active" section) it says that cache is taking the name from liser's title and if it is empty/not set then from lister's path.
That is not true - lister's title has nothing to do with the cache's name - only PATH is important.

2. Unfortunately LISTER FINDCACHE, when successful, closes my port for custom handlers!! (same as LISTER EMPTY)
In other words: if custom cache is found and displayed the port is closed.

-- GAME OVER --



EDIT
This is crazy.
Looks like it's not LISTER FINDCACHE responsible for closing the port. That command, when the cache is found, replaces the string in lister's path - when the string is replaced the port closes.
But...there is a workaround
Add few extra lines to the script that will take care of "path" event - just put a dummy command between them and the port stays open.

So there is still a hope ...

Last edited by peceha; 17 March 2018 at 18:36.
peceha is offline  
Old 17 March 2018, 18:41   #7
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Quote:
Originally Posted by peceha View Post
1. In opus arexx manual ("custom handlers: active" section) it says that cache is taking the name from liser's title and if it is empty/not set then from lister's path.
That is not true - lister's title has nothing to do with the cache's name - only PATH is important.
You mean Arg2 right? It only contains the custom title if it has been set with "lister set title", else path string is returned like Arg4.

Quote:
2. Unfortunately LISTER FINDCACHE, when successful, closes my port for custom handlers!! (same as LISTER EMPTY)
In other words: if custom cache is found and displayed the port is closed.
Hmm... sounds strange to me that a simple command destroy your port.

Did you tried some handler flags like synctraps?

Sometimes you need to use a "lister wait", "lister refresh" or "lister query" to make things work. The "Custom Handlers, The Basics" part tells some of this (problems).

Maybe you find a working example that uses custom handler in the net.
daxb is online now  
Old 17 March 2018, 19:10   #8
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Quote:
You mean Arg2 right? It only contains the custom title if it has been set with "lister set title", else path string is returned like Arg4.
That is what I've been doing until now:
I always set custom title and then I was looking for the cache with the same name (using Arg2). But I couldn't find anything- only no argument gave some result (at that time my path was empty).
After this I started setting custom path and that name sometimes worked with FINDCACHE.
I write "sometimes" because it really works sometimes lets say 10 times in a row it doesn't work and 1 it works

I think it is beyond me.

Anyway I just set that flag you mentioned and will see if there is any proggress.

About my EDIT in the post above:
When I write the path in the path field by hand and press enter the port gets closed (but you can keep it open by adding "path" handler)
That workaround doesn't work with FINDCACHE - so there must be some other reason for closing the port.

I found one more "strange" case:
add to your code "inactive" event handler (can be just NOP)- once that code is triggered the port will not be closed after closing the lister.

Last edited by peceha; 17 March 2018 at 22:54.
peceha is offline  
Old 18 March 2018, 00:50   #9
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Sounds like a multitasking issue and/or sync/async. Things do stuff but not what you expect. Have a look at "lister wait" and try "lister set busy". If you do things on listers it may finished or not when do next actions. At least that is what I can remember when hunting for bugs I did but code looks good. A forgotten "lister refresh" is also "nice". Maybe it is just a missing command that makes your code doing crazy things.
daxb is online now  
Old 18 March 2018, 08:00   #10
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Well.. I suspect that something is just missing somewhere in my code. At the moment It just makes no sense at all
There are 2 things that are not right:
- the cache for the lister is created at random
- my port is getting closed without any obvious reason

As you suggested, I found some examples (e.g. ArcDir_xad) and trying to follow it but still no luck.

I've been using LISTER WAIT/LISTER SET BUSY but no results from that.
LISTER REFRESH shows in my scripts quite often since there is no visual update without it.

Again thanks for your help - I will not give up so easily


------------ > EDIT
Quote:
... I suspect that something is just missing somewhere in my code ...
Yes. There was something missing... one "END" statement

The script doesn't close my port at random anymore - I have to use CLOSEPORT() to close it.
All my earlier statements that something was wrong with opus5 commands were WRONG !!! (there was a mistake in my code and that is why it behaved unpredictably)

Now I only have to figure out why the custom cache is being created randomly...

Last edited by peceha; 18 March 2018 at 10:36.
peceha is offline  
Old 18 March 2018, 17:06   #11
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
If you don't find a possible cache bug post it here as code. So maybe someone may find something.
daxb is online now  
Old 18 March 2018, 17:12   #12
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Will do.
I've been trying to find out the problem from the morning - I used all possible combinations - and now I'm out of ideas.

Tomorrow I'll attach the scripts here (3) with the proper buttonBar and give some explanation how it works (it is very easy anyway).
peceha is offline  
Old 19 March 2018, 10:32   #13
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
You can find everything that is needed under following link:
http://s000.tinyupload.com/?file_id=...86112486351591
-- each arexx script has a header which I took from one of original opus arrex scripts --



1. unzip it

2. copy all files to RAM:

3. in dopus top bar menu go to: BUTONS -> LOAD and choose RAM:__buttonBank

4. when the buttons are on the screen click on LISTER (empty lister will show up)

5. click on the "square" button in lister's toolbar (2nd from left) and write some name (better without "spaces" at the moment) and press RETURN/OK - that name will show up in the lister - repeat that as many times as you want

6. double click on one of above entries - that lister will become empty (new title and new path will be set)

7. open standard dopus lister, navigate to a random folder, select many entries and click ADD FILES in the toolbar on desktop - the files (not a folders) will be added to the empty lister.

8. go up by clicking 3 dots (1st icon in the lister) and choose another entry by double clicking on it - repeat step no.7

9. now everything is set up, just keep navigating between 1st level (the one with your entries) and 2nd level (files) using doubleclick (on 1st level) and 3dots button (2nd level)



If you are lucky the cache will work right away - if not just close the lister and open new one (there is no need to repet all above steps since the whole structure is kept in the file and will be read next time you open the lister, but you can always add new entries)

There is no need to use CLI and type: +LISTER FINDCACHE .... - to do this just type the name of the folder in the lister's path and pres Return. If the path is found the cache will show up otherwise the path's string will change back to original (meaning: no cache found)

Also you can say if there is a cache in the memory just by observing how long the directory is being loaded - so it is better to add more then 30 files to it.

Sometimes the cache exists (lister's content changes when typing new path) but it is not found when double clicking the same entry/folder (???)

Very often the cache is there and the next time you enter its name it is gone.



Thanks for your interest.
peceha is offline  
Old 19 March 2018, 15:51   #14
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Better would be to post an example code snip (as small as possible) with the problem. Nobody will go the long way. Btw. did you do a "trace i" and compared the working log with the non working log?
daxb is online now  
Old 19 March 2018, 17:10   #15
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Well if I only knew how to use that "trace" command...

Anyway I will make the smallest example possible to demonstrate the problem and wiil post as a code here.
peceha is offline  
Old 19 March 2018, 21:44   #16
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Oh, how do you debug your ARexx scripts? How to use Trace command is described in AmigaOS ARexx manual or have a look at http://aminet.net/package/util/rexx/ARexxGuide2_0A what is a must-have.

In short you use the command TCO to open a trace console (not needed but is better to have debug output there). Then enter "trace i" for example somewhere in your script. At that point the trace begins. You don't need to trace everything. Only what do you think could be the causer.
daxb is online now  
Old 20 March 2018, 09:42   #17
peceha
Registered User
 
peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 282
Thanks, will check that.
You know... my arexx scripts are quite basic so there was no need for debugging... until now

Small observation:
looks like LISTER EMPTY is the one responsible for the cache (creates new empty cache for what is/will be visible in the lister). I have added that command before displaying new content for the lister (of course only if cache is not found) - and so far everything is working as expected (only make sure that your port stays open )

---------------------------------------------------------------------EDIT-------------
Hello daxb - thanks for your help!!!
Now the script is working (custom cache) and I can finish my small project (in the video below).
It shows also that the cache is working - these playlists contain about 300 files and 100 files each.
[ Show youtube player ]

Last edited by peceha; 20 March 2018 at 19:14.
peceha is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Voices8" 8 Channel Soundtracker "DemoSongI" song - "This is the Amiga with 8 Voices" DemosongIHunter request.Music 45 23 May 2022 20:07
[opus5][arexx] double click action with custom lister peceha Coders. Scripting 2 12 March 2018 20:18
FS-UAE shows "DF0: Empty" for some ADF images fberger support.FS-UAE 6 03 January 2014 22:58
"Reminder "Lincs Amiga User Group aka "LAG" Meet Sat 5th of January 2013" rockape News 4 30 January 2013 00:06
Crashes with "CPU Emulation Speed/fastest possible..." + DOpusRT command ami_stuff support.WinUAE 3 09 May 2009 21:52

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 13:36.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09665 seconds with 15 queries