Problem with WebOpen

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Problem with WebOpen

Post by Rado1 »

I'm not sure it is a bug or my mistake, but the following behavior is suspicious:

in the attached project I wanted to read (later process) ZGE wiki pages. It uses WebOpen component several times, each time for one defined page. At the moment it has 2 pages defined. The application works correctly if started the first time in Preview (Alt+Enter). If started the second time, it reads just one page, and if started 3rd and more times, it does not read any page.

After some more tests I observed that the problem is not in WebOpen component itself, but in recursion of activation the same WebOpen component from its own OnResult section. This recursion is has probably some side effects causing the undesired behavior. In meantime I have another version of the project without recursion, which works fine.
Attachments
ZgeHelp.zgeproj
ZGE project
(1.33 KiB) Downloaded 555 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Cool idea to process ZGE wiki pages from ZGE itself :)

You are probably right it is the recursion that is the problem. Let me know if you find anything else, this component hasn't been tested much.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Fixed in the latest beta, thanks Ville!
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Continuing with the idea of creating ZGE help from wiki pages, I would like to use WebOpen component also for downloading pictures (and maybe also other kind of binary files). I know, the original idea of WebOpen was different, but maybe its extension would not be very difficult.

The idea is to download a binary file from WebOpen.Url and put its content to the specified byte array WebOpen.ResultArray which can be saved to a local file by means of the File component.

At the moment, the WebOpen does not change the content of the specified WebOpen.ResultArray and the WebOpen.ResultString contains just first characters of the picture content (for instance, "‰PNG" for .png).

The attached project file contains an example of how I would like to use the WebOpen and File components.
Attachments
DownloadPicture.zgeproj
ZGE project
(709 Bytes) Downloaded 546 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,

In case you don't want to wait you could use a Array that is big enough to fit the largest file you want to support and a simple PHP script to determine the file-size. For instance ..

Code: Select all

$header = get_headers($_GET['url'], 1);
echo $header['Content-Length'];
.. that you then query using something like "http://www.mysite.com/getfilesize.php?u ... /image.png". Alternatively you could simply use the WinINet functions directly.

But i'm sure Ville will fix it soon :)

K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Hi Kjell, I would like to avoid PHP or external libraries, such as WinINet, if possible. Originally, I wanted to create the "ZGE help builder" in Java or C++, which would be easier, but creating a ZGE project for that is more interesting and challenging. Rado1.
Post Reply