Jump to content

Question about "InetGetSize"


Tukata
 Share

Recommended Posts

Hi,

It seems that using "InetGetSize" when not connected, it will open the dialer. But if I "Cancel" the dialer the script continue trying and does not exit. How can I Exit if user click "Cancel" on the dialer ?

Here is my script and I will appreciate any improvement you can suggest:

if $CmdLine[0] > 0 Then
$a = $CmdLine[1]; Full path to file on the web
Else
Exit 
EndIf

$Size=InetGetSize ($a)
If  $Size = 0 Then
MsgBox(48, "Error", "Error has occurred. Connection could not be established.", 3)
   EXIT
EndIf
MsgBox(4096, "Download", "Starting download now..."  & $Size  & " kb", 3)

$File= StringTrimLeft($a, 34); Extract file name and extension
$Name= StringTrimRight($File, 4); Extract file name only

$File=@ScriptDir & "\Folder\"  & $File
InetGet($a, $File, 1, 1)

While @InetGetActive
  TrayTip($Size,@InetGetBytesRead, 10, 16)
  Sleep(250)
Wend

Thank you

Tuk

Link to comment
Share on other sites

Hi,

It seems that using "InetGetSize" when not connected, it will open the dialer. But if I "Cancel" the dialer the script continue trying and does not exit. How can I Exit if user click "Cancel" on the dialer ?

Here is my script and I will appreciate any improvement you can suggest:

there are two ways to solve your problem.

1.) Change your IE setting to NOT dial any RAS connections

2.) Check if there is an internet connection (e.g. by using ping www.google.com or something else) and only call InetGetSize when you detect an internet connection. There are some "connection checking" scripts available on the forum. Use the search function of the forum.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Thanks.

I found this line of code on the forum which solved my problem.

One question about this code - will it work for all OS ?

$IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)

Thank you

Tuk

Link to comment
Share on other sites

It will work on the following systems.

Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0, Windows Me, Windows 98, or Windows 95

I hope that answers your question.

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

It will work on the following systems.

I hope that answers your question.

JS

That's actually not true. The operating system has nothing to do with the Inet functions. What's important is the version of Internet Explorer. The function in question requires Internet Explorer 4.0 or later.
Link to comment
Share on other sites

That's actually not true. The operating system has nothing to do with the Inet functions. What's important is the version of Internet Explorer. The function in question requires Internet Explorer 4.0 or later.

The page I saw on MSDN said it worked on all those versions of windows. A bit further down it said that IE 4.0 or later is required. That is why I posted what I did. I do appreciate the extra info as I didn't read that far down until you brought it to my attention.

http://msdn.microsoft.com/library/default....nectedstate.asp

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Actually, I explicitly said "Internet Explorer 4.0 or later". Anyway, I still don't understand what you are asking. The function requires Internet Explorer 4.0 or later to be installed on the system. Other browsers are irrelevant and I don't know why you are asking anything. I told you what the requirement was for the function.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...