forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VDSIPP - HTTP download fails if network is slow
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Wed Feb 19, 2003 10:20 am    Post subject: Reply with quote

The transfer size etc is read from the file you are downloading using the:

INTERNET HTTP,DOWNLOAD,1,%%URL,%F\geoamp.zip

command.

It does not matter what the file is called just make sure that <httpclient> is the same....


Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 10:28 am    Post subject: Reply with quote

Mac wrote:
From the VDS help file...


OK, thanks Mac. I missed that Smile

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 10:30 am    Post subject: Reply with quote

Aaaa, yeah that number again. Laughing

I had some problems understanding that at first. Guess it's kinda like a session ID. Now I get it. Thanks a lot guys. Your help is much appreciated.

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 10:52 am    Post subject: Reply with quote

Uhhm. Just little old me again.

Look at my code now:
Code:
rem This is my first go at using any extension at all with VDS.
rem I've only been using VDS for about three days now and love it more each time I use it :)

%%Title = GeoTrail Downloader
%%Version = 1.0
Title %%Title
  DIALOG CREATE,%%Title,-1,0,473,110
  DIALOG ADD,GROUP,GROUP1,8,8,448,48,Download File
  DIALOG ADD,EDIT,EDIT1,24,16,432,24,http://www.geotrail.no/lastned/geoamp.zip
  DIALOG ADD,BUTTON,BUTTON1,64,280,88,24,&Save file as
  DIALOG ADD,BUTTON,BUTTON2,64,376,90,24,Start &download
  DIALOG ADD,STATUS,STATUS1,Remember to click on @CHR(34)Save file as@CHR(34) before downloading.
  DIALOG ADD,MENU,&Help,H&elp|E,&About|A,-,E&xit|X
  DIALOG SHOW
  DIALOG DISABLE,BUTTON2

rem Calls the extenion into memory.
EXTERNAL VDSIPP.DLL

:evloop
wait event,1
goto @event()
:timer
   rem retrieve the total size to transfer
   %%size = @internet(http,content-length,1)
   rem retrieve the amount of bytes left to transfer
   %%left = @internet(http,transferbytes,1)
   %%per = @fdiv(100,%%size)
   %%per1 = @fmul(%%per,%%left)
   %%per2 = @format(%%per1,9.0)
   rem P2 is dialog name for the progress bar
  dialog set,p2,%%per2
goto evloop
rem Old EVLOOP:
rem :EVLOOP
rem   WAIT EVENT
rem   goto @event()

:HelpMENU
  info Thanks for trying this simple little downloader.@cr()@cr()This is my first attempt at using HTTP Protocols in pure script programming.@cr()And it seems to work perfectly on my machine.@cr()But"," if you should experience any problems"," please let me know by emailing me at robert"@"geotrail.no
goto EVLOOP

:AboutMENU
  info %%Title v%%Version@cr()Thanks to all the people at VDSWorld for helping me :)@cr()@cr()Written by Robert Olsen <robert"@"geotrail.no>
goto EVLOOP

:ExitMENU
  goto Close
 
:BUTTON1BUTTON
  %F = @DIRDLG(Select where you want to download the file.)
If %F
DIALOG SET,STATUS1,%F
  DIALOG ENABLE,BUTTON2
  DIALOG DISABLE,BUTTON1
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
End
goto EVLOOP

:BUTTON2BUTTON
If %F
     DIALOG CREATE,Downloading...,-1,0,342,86
     DIALOG ADD,GROUP,GROUP1,8,8,328,72,Download progress
     DIALOG ADD,PROGRESS,P2,32,16,312,16,0
     DIALOG ADD,TEXT,TEXT1,56,104,,,Please wait while downloading...
     DIALOG SHOW
     DIALOG DISABLE,BUTTON1
     DIALOG DISABLE,BUTTON2
     DIALOG SET,STATUS1,Download in progress...
  %%URL = @dlgtext(EDIT1)
  INTERNET HTTP,CREATE,1
  INTERNET HTTP,THREADS,1,OFF
  INTERNET HTTP,PROTOCOL,1,1
  INTERNET HTTP,USERAGENT,1,"%%Title"
  INTERNET HTTP,DOWNLOAD,1,%%URL,%F\geoamp.zip
  %S = @INTERNET(HTTP,CONTENT-LENGTH,1)
  %%FileSize = @DIV(%S,1024)
  INTERNET HTTP,DESTROY,1
  DIALOG SET,STATUS1,Download completed!
  info Download complete.@cr()@cr()The file %%URL@cr()have now been saved to@cr()%F@cr()@cr()Filesize: %%FileSize kb
  DIALOG ENABLE,BUTTON1
  DIALOG ENABLE,BUTTON2
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
  goto EVLOOP
End
 
:Close
  Exit


I know the progress bar code isn't in the right place. But I'm abit lost right now. I've made a little dialog that popsup when the download starts with a progress bar on it. But how do I get this working? After download completes I want the download progress dialog to dissapear.

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:04 am    Post subject: Reply with quote

"Error 25 line 28" if I start the program and let it set for a second.

You don't need the TIMER event until the download starts,
ya might add a var and set it to 1 during the the download,
and clear it when done (using %%dload = "").
Something like this maybe...
Code:

rem - set %%dload var to 1 while dloading --
:EVLOOP
  if %%dload
     WAIT EVENT, 1
  else
     WAIT EVENT
  end
  goto @event()

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:08 am    Post subject: Reply with quote

Cool beans.
Great idea. Thanks Mac Razz

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:12 am    Post subject: Reply with quote

Also - I get an error when I hit button2 and it tries to disable
button1, because button1 is already disabled when a folder is
chosen under button1...

BTW, I'm using Windows 95 and VDS3 - your setup may not
act exactly like mine (I had to remove the tooltip for the GROUP
too - VDS3 can't handle them on a group). Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:15 am    Post subject: Reply with quote

OOPS - wrong diagnosis. Ya can only do stuff to elements
in the selected dialog - once the new window is created, ya
hafta select dialog 0 again to enable/disable buttons in the main
window....

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:15 am    Post subject: Reply with quote

Thanks. I've fixed that now
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:21 am    Post subject: Reply with quote

Ya might wanna check this child window example, the second
post addresses TIMER events and child windows:

http://www.vdsworld.com/forum/viewtopic.php?t=98

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:26 am    Post subject: Reply with quote

Thanks for the link Mac.

This script is getting kinda out of hand Laughing
It wasen't ment to get this big. He he he. Anyways.

I'm having some problems with the progress bar dialog.

Code:
rem This is my first go at using any extension at all with VDS.
rem I've only been using VDS for about three days now and love it more each time I use it :)

%%Title = GeoTrail Downloader
%%Version = 1.0
Title %%Title
  DIALOG CREATE,%%Title,-1,0,473,110
  DIALOG ADD,GROUP,GROUP1,8,8,448,48,Download File
  DIALOG ADD,EDIT,EDIT1,24,16,432,24,http://www.geotrail.no/lastned/geoamp.zip
  DIALOG ADD,BUTTON,BUTTON1,64,280,88,24,&Save file as
  DIALOG ADD,BUTTON,BUTTON2,64,376,90,24,Start &download
  DIALOG ADD,STATUS,STATUS1,Remember to click on @CHR(34)Save file as@CHR(34) before downloading.
  DIALOG ADD,MENU,&Help,H&elp|E,&About|A,-,E&xit|X
  DIALOG SHOW
  DIALOG DISABLE,BUTTON2

rem Calls the extenion into memory.
EXTERNAL VDSIPP.DLL

:EVLOOP
If %%Download
  wait event,1
  :timer
   rem retrieve the total size to transfer
   %%size = @internet(http,content-length,1)
   rem retrieve the amount of bytes left to transfer
   %%left = @internet(http,transferbytes,1)
   %%per = @fdiv(100,%%size)
   %%per1 = @fmul(%%per,%%left)
   %%per2 = @format(%%per1,9.0)
   rem P2 is dialog name for the progress bar
   dialog set,p2,%%per2
  Else
   WAIT EVENT
end
  goto @event()
  goto evloop

rem Old EVLOOP:
rem :EVLOOP
rem WAIT EVENT
rem goto @event()

:HelpMENU
  info Thanks for trying this simple little downloader.@cr()@cr()This is my first attempt at using HTTP Protocols in pure script programming.@cr()And it seems to work perfectly on my machine.@cr()But"," if you should experience any problems"," please let me know by emailing me at robert"@"geotrail.no
goto EVLOOP

:AboutMENU
  info %%Title v%%Version@cr()Thanks to all the people at VDSWorld for helping me :)@cr()@cr()Written by Robert Olsen <robert"@"geotrail.no>
goto EVLOOP

:ExitMENU
  goto Close
 
:BUTTON1BUTTON
  %F = @DIRDLG(Select where you want to download the file.)
If %F
DIALOG SET,STATUS1,%F
  DIALOG ENABLE,BUTTON2
  DIALOG DISABLE,BUTTON1
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
End
goto EVLOOP

:BUTTON2BUTTON
If %F
rem Start the download progress
%%Download = yes
DIALOG CREATE,Downloading...,-1,0,342,86
DIALOG ADD,GROUP,GROUP1,8,8,328,72,Download progress
DIALOG ADD,PROGRESS,P2,32,16,312,16,0
DIALOG ADD,TEXT,TEXT1,56,104,,,Please wait while downloading...
DIALOG SHOW
rem Download progress
  DIALOG SELECT,0
  DIALOG DISABLE,BUTTON2
  DIALOG SET,STATUS1,Download in progress...
  %%URL = @dlgtext(EDIT1)
  INTERNET HTTP,CREATE,1
  INTERNET HTTP,THREADS,1,OFF
  INTERNET HTTP,PROTOCOL,1,1
  INTERNET HTTP,USERAGENT,1,"%%Title"
  INTERNET HTTP,DOWNLOAD,1,%%URL,%F\geoamp.zip
  %S = @INTERNET(HTTP,CONTENT-LENGTH,1)
  %%FileSize = @DIV(%S,1024)
  INTERNET HTTP,DESTROY,1
  DIALOG SET,STATUS1,Download completed!
  info Download complete.@cr()@cr()The file %%URL@cr()have now been saved to@cr()%F@cr()@cr()Filesize: %%FileSize kb
  DIALOG ENABLE,BUTTON1
  DIALOG ENABLE,BUTTON2
rem Closes the dialog with the progress bar on it.
  DIALOG SELECT,1
  DIALOG CLOSE
  DIALOG SELECT,0 
  %%Download = ""
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
  goto EVLOOP
End
 
:Close
  Exit

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:29 am    Post subject: Reply with quote

I'd stick the progress bar on the main window until ya get
the kinks out - ya can always add a child window later... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:35 am    Post subject: Reply with quote

Yeah, you might be right.

Can I hide the status bar? And replace it with the progress bar while downloading? And when finished, the status bar shows up again?

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 11:38 am    Post subject: Reply with quote

Yep - OR ya can put the progress bar on top (or in the right
side) of the status bar, if the progress bar is added after the
status bar. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:51 am    Post subject: Reply with quote

Still can't get the progress indicator to work.
Here is what I've got right now:
Code:
rem This is my first go at using any extension at all with VDS.
rem I've only been using VDS for about three days now and love it more each time I use it :)

%%Title = GeoTrail Downloader
%%Version = 1.0
Title %%Title
  DIALOG CREATE,%%Title,-1,0,473,110
  DIALOG ADD,GROUP,GROUP1,8,8,448,48,Download File
  DIALOG ADD,EDIT,EDIT1,24,16,432,24,http://www.geotrail.no/lastned/geoamp.zip
  DIALOG ADD,BUTTON,BUTTON1,64,280,88,24,&Save file as
  DIALOG ADD,BUTTON,BUTTON2,64,376,90,24,Start &download
  DIALOG ADD,STATUS,STATUS1,Remember to click on @CHR(34)Save file as@CHR(34) before downloading.
  DIALOG ADD,PROGRESS,P2,68,13,250,16,0 
  DIALOG ADD,MENU,&Help,H&elp|E,&About|A,-,E&xit|X
  DIALOG SHOW
  DIALOG DISABLE,BUTTON2
  DIALOG HIDE, P2

rem Calls the extenion into memory.
EXTERNAL VDSIPP.DLL

:EVLOOP
If %%Download
  :timer
   rem retrieve the total size to transfer
   %%size = @internet(http,content-length,1)
   rem retrieve the amount of bytes left to transfer
   %%left = @internet(http,transferbytes,1)
   %%per = @fdiv(100,%%size)
   %%per1 = @fmul(%%per,%%left)
   %%per2 = @format(%%per1,9.0)
   rem P2 is dialog name for the progress bar
   dialog set,p2,%%per2
  wait event,1   
Else
   WAIT EVENT
end
  goto @event()
  goto evloop

:HelpMENU
  info Thanks for trying this simple little downloader.@cr()@cr()This is my first attempt at using HTTP Protocols in pure script programming.@cr()And it seems to work perfectly on my machine.@cr()But"," if you should experience any problems"," please let me know by emailing me at robert"@"geotrail.no
goto EVLOOP

:AboutMENU
  info %%Title v%%Version@cr()Thanks to all the people at VDSWorld for helping me :)@cr()@cr()Written by Robert Olsen <robert"@"geotrail.no>
goto EVLOOP

:ExitMENU
  goto Close
 
:BUTTON1BUTTON
  %F = @DIRDLG(Select where you want to download the file.)
If %F
DIALOG SET,STATUS1,%F
  DIALOG ENABLE,BUTTON2
  DIALOG DISABLE,BUTTON1
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
End
goto EVLOOP

:BUTTON2BUTTON
If %F
rem Start the download progress
%%Download = yes
rem Download progress
  DIALOG SHOW, P2
  DIALOG DISABLE,EDIT1
  DIALOG DISABLE,BUTTON2
  DIALOG SET,STATUS1,Download in progress...
  %%URL = @dlgtext(EDIT1)
  INTERNET HTTP,CREATE,1
  INTERNET HTTP,THREADS,1,OFF
  INTERNET HTTP,PROTOCOL,1,1
  INTERNET HTTP,USERAGENT,1,"%%Title"
  INTERNET HTTP,DOWNLOAD,1,%%URL,%F\geoamp.zip
  %S = @INTERNET(HTTP,CONTENT-LENGTH,1)
  %%FileSize = @DIV(%S,1024)
  INTERNET HTTP,DESTROY,1
  DIALOG SET,STATUS1,Download completed!
  info Download complete.@cr()@cr()The file %%URL@cr()have now been saved to@cr()%F@cr()@cr()Filesize: %%FileSize kb
  DIALOG ENABLE,BUTTON1
  DIALOG ENABLE,BUTTON2
  DIALOG ENABLE,EDIT1 
  DIALOG HIDE, P2
rem Closes the dialog with the progress bar on it.
  %%Download = ""
  goto EVLOOP
Else
  info You MUST select where you want to download the file@cr()by clicking the @CHR(34)Save file as@CHR(34) button.
  goto EVLOOP
End
 
:Close
  Exit


This is kinda strange, but when I run the program in VDS then the buttons and everything else has the theme I'm using in XP. But when I compile it and run it it looks like there isn't any theme. ?

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group