"load" command?
Forum rules
Be kind.
Be kind.
-
- Posts: 136
- Joined: Sun Jun 04, 2023 3:32 am
- Location: Berkeley, CA, US, Earth
- Contact:
"load" command?
Gotten back to playing with this thing, and I came across the "load" command. It looks straightforward but doesn't seem to do anything useful. Yes, I know about "put url" and that of course works fine, but this is something else, and I'm working at the engine level so I can't just use put, I don't see any use the "load" command in the ide, so it really looks like this is some prehistoric artifact that maybe never did work properly.
Has anyone used the load command before? Any idea what it takes to get it working? The dictionary entries don't help (and don't work either).
Has anyone used the load command before? Any idea what it takes to get it working? The dictionary entries don't help (and don't work either).
- OpenXTalkPaul
- Posts: 2633
- Joined: Sat Sep 11, 2021 4:19 pm
- Contact:
Re: "load" command?
Not sure what you're looking at in the engine source, but there's syntax for TWO different forms of the 'load' command that I know of.
The one used with revLibURL:
And the one that is for loading Extension Modules:
The one used with revLibURL:
Code: Select all
load [URL] url [with message callbackMessage]
Code: Select all
load extension {from file filePath | from data moduleData} [ with resource path resourcePath ]
-
- Posts: 136
- Joined: Sun Jun 04, 2023 3:32 am
- Location: Berkeley, CA, US, Earth
- Contact:
Re: "load" command?
Right. I got that. I'm trying to use the 'load url' form to load a file, which should load the file into cache memory.
What I get is an error that the load has started but never finishes.
What I get is an error that the load has started but never finishes.
-
- Posts: 442
- Joined: Sat Sep 11, 2021 4:37 pm
- Contact:
Re: "load" command?
I've used load for network I/O, but not local file I/O.
strace show anything useful?
- tperry2x
- Posts: 3210
- Joined: Tue Dec 21, 2021 9:10 pm
- Location: Somewhere in deepest darkest Norfolk, England
- Contact:
Re: "load" command?
You can use the load command on local files, not just network locations:
From the dictionary:
Code: Select all
on mousedown
put "file://home/user/Documents/delivery-address.odt" into tLocalfile
load URL tLocalfile
put URL tLocalfile into tData
if line 1 of tData is not empty then answer "loaded something" & return &¬
line 1 of tdata
end mousedown
Use the load command to pre-fetch a file from the Internet in order to speed up access when using it in an expression with the URL keyword.
To use a file that has been downloaded by the load command, refer to it using the URL keyword as usual. When you request the original URL, OpenXTalk uses the cached file automatically.
-
- Posts: 136
- Joined: Sun Jun 04, 2023 3:32 am
- Location: Berkeley, CA, US, Earth
- Contact:
Re: "load" command?
Yep - that's what the dictionary says.
But that has the same result if you comment the "load" command. And since the load command is not blocking, you're not necessarily giving enough time for it to complete.
Try this (and press the button a couple of times):
At any rate, I've realized that the "load" command isn't really going to do what I want, so this is no longer a burning issue for me.
But that has the same result if you comment the "load" command. And since the load command is not blocking, you're not necessarily giving enough time for it to complete.
Try this (and press the button a couple of times):
Code: Select all
on mousedown
local tLocalfile
put "file://home/user/Documents/delivery-address.odt" into tLocalfile
load URL tLocalfile with message "loaded"
put the result & cr after msg
end mousedown
on loaded
put "the file is loaded into cache memory" & cr after msg
end loaded
- richmond62
- Posts: 4833
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: "load" command?
Dunno how often I'd rely on that!what the dictionary says

https://richmondmathewson.owlstown.net/
- tperry2x
- Posts: 3210
- Joined: Tue Dec 21, 2021 9:10 pm
- Location: Somewhere in deepest darkest Norfolk, England
- Contact:
Re: "load" command?
Yes, just really for illustrative purposes, just so show that the load command is used to preload either a local or remote URL in. As it's a 1kb file in this case, loaded from a local SSD, then it is fetched in time. I know what you mean though, seems to have limited use.
- tperry2x
- Posts: 3210
- Joined: Tue Dec 21, 2021 9:10 pm
- Location: Somewhere in deepest darkest Norfolk, England
- Contact:
Re: "load" command?
Just imagine, when it's sorted out though - it should actually be a useful thing to have.richmond62 wrote: ↑Sat Dec 14, 2024 7:13 pmDunno how often I'd rely on that!what the dictionary says![]()
-
- Posts: 136
- Joined: Sun Jun 04, 2023 3:32 am
- Location: Berkeley, CA, US, Earth
- Contact:
Re: "load" command?
Yes, but whether it actually does that or not is a question.just so show that the load command is used to preload
The fact that the load command always returns an error in the result and seems never to finish loading isn't encouraging.
- tperry2x
- Posts: 3210
- Joined: Tue Dec 21, 2021 9:10 pm
- Location: Somewhere in deepest darkest Norfolk, England
- Contact:
Re: "load" command?
I think you are right. If I use:
Code: Select all
wait until URLStatus(tLocalfile) is "cached"
I stopped using all internal URL commands provided by the engine, in favour of system installed curl or wget - as they are a lot more reliable. For me at least, all the put URL / get URL commands seem to be sporadic. Sometimes they work, sometimes not.
-
- Posts: 442
- Joined: Sat Sep 11, 2021 4:37 pm
- Contact:
Re: "load" command?
Does the error also occur when using the load command to download from the Internet?
-
- Posts: 136
- Joined: Sun Jun 04, 2023 3:32 am
- Location: Berkeley, CA, US, Earth
- Contact:
Re: "load" command?
No, seems to be happy with https:// urls. Just not file://
-
- Posts: 442
- Joined: Sat Sep 11, 2021 4:37 pm
- Contact:
Re: "load" command?
I've never heard of this being tested with local files. It perhaps could be made to work by mapping the syntax to what happens with "put url".
But since you have "put url", what were you looking for "load url" to do differently?
-
- Posts: 136
- Joined: Sun Jun 04, 2023 3:32 am
- Location: Berkeley, CA, US, Earth
- Contact:
Re: "load" command?
I'm implementing global constants so they can be defined in one file and #included. I originally thought the load mechanism would be the best way of getting a text file into memory but it turns out that's not the case anyway.
Who is online
Users browsing this forum: Google [Bot] and 4 guests