Jump to content
Sign in to follow this  
johnmcloud

InetGet and Filename

Recommended Posts

Hi guys, i have a doubt using InetGet

I have made this script:

SplashTextOn("", "Downloading...", 200, 40, -1, -1, 1, "",10,"")
Local $hDownload = InetGet("https://github.com/test/test/zipball/master", @WorkingDir & "\Test.zip", 1, 1)
Do
    Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
SplashOff()
MsgBox(0, "", "Completed")

The script work, but i have made the filename ( Test.zip )

So i have this question:

1) Can automatically script set the original filename?

2) Can automatically script set the extension? (optional, i think is not possible)

Thanks

Share this post


Link to post
Share on other sites

Have a look in my signature for _InetGetProgress.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Thanks guinness,but i need a little help.

I don't understand how to use it :D

Sorry

EDIT:

I have add the example to your script:

Global $sFilePath, $sFileURL
$sFileURL = "https://github.com/test/test/zipball/master"
$sFilePath = _InetGetProgress($sFileURL, @TempDir & "")
If @error Then
    MsgBox(64, "Error", "Check the URL or your Internet Connection!")
Else
    MsgBox(64, "Success", "Downloaded >> " & $sFilePath)
EndIf

It work , but i have a wrong filename ( the filename is not "master" ) and no extension. What i'm doing wrong?

Edited by johnmcloud

Share this post


Link to post
Share on other sites

If the URL doesn't have the filename tacked onto the end of it then have a look at this example by Yashied >>

Edit: Though it might not work for your URL, give it a try.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

If the URL doesn't have the filename tacked onto the end of it then have a look at this example by Yashied >>

Edit: Though it might not work for your URL, give it a try.

I have try it but same problem. I don't understad this limitation, but is not a problem for now, i'll set the filename manually.

Thanks

Edited by johnmcloud

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jahar
      I have an AutoIT script It monitors 2 websites for content that applys to me and the services that I provide. One site is : www.Freelancer.com The other: www.PeoplePerHour.com Both sites publish new jobs on their site hourly or so. My AutoIT app, will view those sites and present new jobs to me in a grid that pops up on my screen. Lately, the app has stopped showing me any jobs from PeoplePerHour.
       
      For freelancer.com,  Inetget is giving full html but for peopleperhour, now its not coming.
      Func _CheckPPH()
          Local Static $hTimer = 0
          Local Static $hDownload = 0
          Local $aTitlesandUrls = 0
          Local Static $sTempFile = ""
          If $hTimer = 0 Then $hTimer = TimerInit()
          If $hDownload = 0 Then
              $sTempFile = _WinAPI_GetTempFileName(@TempDir)
              ConsoleWrite("Checking PPH..." & @CRLF)
              ConsoleWrite(">Downloading..." & @CRLF)
      ;~         $hDownload = InetGet("http://www.peopleperhour.com/freelance-jobs", $sTempFile, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
              $hDownload = InetGet("http://www.peopleperhour.com/freelance-jobs", $sTempFile, $INET_FORCERELOAD)
      ;~         Return 0
          EndIf
      ;~     Sleep(30)
      ;~     Local $isCompleted = InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
      ;~     Local $isError = InetGetInfo($hDownload, $INET_DOWNLOADERROR)
      ;~     Sleep(30)
      ;~     If TimerDiff($hTimer) > 3000 And $isError Then
      ;~         ConsoleWrite("!PPH Fail" & @CRLF)
      ;~         InetClose($hDownload)
      ;~         $hDownload = 0
      ;~         Return 0
      ;~     EndIf
      ;~     Sleep(30)
          Local $Show = 0
      ;~     If TimerDiff($hTimer) > 3000 And $isCompleted Then
          If $hDownload > 0 Then
              ConsoleWrite("+Downloaded..." & @CRLF)
              Local $sPPHHtml = FileRead($sTempFile)
              $aTitlesandUrls = _StringBetween($sPPHHtml, '"title">' & @LF, 'time>')
      ;~         _ArrayDisplay($aTitlesandUrls)
              Local $aPPH[0][4]
              Local $sTitle = ""
              Local $sUrl = ""
              Local $sID = ""
              Local $sDate = ""
              Local $iRet=0
              Sleep(30)
              For $i = 0 To UBound($aTitlesandUrls) - 1
                  $sTitle = _StringBetween($aTitlesandUrls[$i], '<a title="', '" class')
                  $sUrl = _StringBetween($aTitlesandUrls[$i], 'href="', '">')
                  $sDate = _GetDate($aTitlesandUrls[$i])
                  If IsArray($sTitle) And IsArray($sUrl) Then
                      $sID = _GetID($sUrl[0])
      ;~                 _ArrayAdd($aPPH, $sDate & "|" & $sTitle[0] & "|" & $sUrl[0] & "|" & $sID)
                      $iRet = _BuildPopupsPPH($sID, $sDate, "PPH: " & $sTitle[0], $sUrl[0])
                      If $iRet Then $Show+=1
                  EndIf
              Next
              Sleep(30)
      ;~         If $Show > 0 Then ShowLatestJobs()
      ;~         _ArrayDisplay($aPPH)
              FileDelete($sTempFile)
              InetClose($hDownload)
              $hDownload = 0
              $hTimer = 0
              Return $Show
          EndIf
          Sleep(30)
      EndFunc   ;==>_CheckPPH
    • By Colduction
      Hi guys! i want to write speedy and very fast code to check if chosen filename exists then add "-1" at end of it and if chosen filename exists again, add "-2" instead of "-1" and check filename until be unique.
       
      For Example: I have to write "Filename.txt" in C:\ directory with FileOpen then check if "Filename.txt" exists in that directory then rename chosen filename to "Filename-2.txt" and if exists again in directory, rename chosen filename to "Filename-3.txt" and do this work until to find unique number to add end of filename.




       
      ====================== SOLUTION by @Subz ======================
       
    • By Tippex
      I have a problem with FileOpenDialog using long default filenames ... they always get truncated. 
      For example: 
      "A Long FileName.mpg" as a default would prompt as just "FileName.mpg" (but scrolling left will show it named correctly).
      Does anyone know of a fix for this please (I didn't spot it in a Forum search), or is it one for the bug tracker?
      #include <FileConstants.au3> #include <MsgBoxConstants.au3> Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT), "A Long FileName.mpg") Thanks,
    • By Tersion
      Why I can't get more than two simultaneously background downloads?
      Simultaneously background downloads with InetGet() works! It was just server limitation from which I downloaded files.
    • By leb
      Hello there,
      I am using the function InetGet example in the help files on a website and getting the error 13. First, I searched the help files and the forum for a list of errors to consult to no avail. I suspect this is a 400's server reply based error but it would be nice to get more info about it.
      Please help, thanks.
      L
×
×
  • Create New...