AlmarM 22 Posted February 4, 2011 (edited) Hiya!Whats the easiest way to get the correct map names from an URL?Example:http://www.example-site.com/images/background.gif -> DesktopDir/site/images/background.gifhttp://www.example-site.com/images/buttons/hover.gif -> DesktopDir/site/images/buttons/hover.gifhttp://www.example-site.com/img/navbar/shine.gif -> DesktopDir/site/img/navbar/shine.gifhttp://www.example-site.com/spacer.gif -> DesktopDir/site/spacer.gifWhat im trying to do is:Grab whole HTML code from an URLSave it to a .htmlGet all images inside the siteSave those images into the correct mapsHope it's clear. AlmarM Edited February 4, 2011 by AlmarM MinesweeperA minesweeper game created in autoit, source available._Mouse_UDFAn UDF for registering functions to mouse events, made in pure autoit.2D Hitbox EditorA 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Share this post Link to post Share on other sites
jvanegmond 306 Posted February 4, 2011 $url = "DesktopDir/site/" & StringReplace($url, "http://www.example-site.com/", "") For a generic URL, find the 3rd / and then StringMid it. github.com/jvanegmond Share this post Link to post Share on other sites
AlmarM 22 Posted February 6, 2011 $url = "DesktopDir/site/" & StringReplace($url, "http://www.example-site.com/", "") For a generic URL, find the 3rd / and then StringMid it. Thanks for that! But what if the images are saved on a different URL? Example: http://www.spele.nl/ http://proxy.spele.nl/img/1/9/7/1/9/s.jpg I can't do a StringReplace on the base URL here, any fast solutions to get the img base URL? MinesweeperA minesweeper game created in autoit, source available._Mouse_UDFAn UDF for registering functions to mouse events, made in pure autoit.2D Hitbox EditorA 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Share this post Link to post Share on other sites
iamtheky 927 Posted February 6, 2011 (edited) provided they are in tags on the source URL you could grab them all this way. #include <IE.au3> $oIE = _IECreate ("http://www.foxnews.com/" , 0 , 0) $oImgs = _IEImgGetCollection($oIE) $iNumImg = @extended For $oImg In $oImgs msgbox (0, '' , $oImg.src) Next Edited February 6, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Share this post Link to post Share on other sites
GEOSoft 67 Posted February 6, 2011 (edited) This works against your example but I don't know how it will be against the actual page.$sExample = "http://www.example-site.com/images/background.gif" & @CRLF $sExample &= "http://www.example-site.com/images/buttons/hover.gif" & @CRLF $sExample &= "http://www.example-site.com/img/navbar/shine.gif" & @CRLF $sExample &= "http://www.example-site.com/spacer.gif" $aImages = StringRegExp($sExample, "(?i)http://.+?/(.+?\.[gjbp][a-z2]{2,3})", 3) If NOT @Error Then For $i = 0 To Ubound($aImages) -1 ;; Do something here Next EndIfEDIT: Modified the expression to also catch the very rare .jp2 files.EDIT 2: If I missed any file extensions just add the first character of the extension into the [gjbp] group.EDIT 3: Fixed the example string by adding @CRLF Edited February 6, 2011 by GEOSoft GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!" Share this post Link to post Share on other sites
guinness 1,518 Posted February 6, 2011 In the example GEOSoft provided I keep getting >> images/background.gifhimg/navbar/shine.gifh 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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Share this post Link to post Share on other sites
GEOSoft 67 Posted February 6, 2011 I'll fix that. It's because I left out the @CRLFs GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!" Share this post Link to post Share on other sites
AlmarM 22 Posted February 9, 2011 Thanks for that GEO! But when I visit this site: http://www.spele.nl/ and use _IEImgGetCollection it returns image links with http://proxy.spele.nl/ How do I get the "http://xxx.xxx.xx/" from each IEImgGetCollection link? MinesweeperA minesweeper game created in autoit, source available._Mouse_UDFAn UDF for registering functions to mouse events, made in pure autoit.2D Hitbox EditorA 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Share this post Link to post Share on other sites
GEOSoft 67 Posted February 9, 2011 (edited) Luckily I already had this saved and I think it should be what you want. It will handle http:, https: and ftp: with or without the www and it stops at the third slash if it exists. That is the first one after the // if it exists.$sSRE="(?i)href\s*=[\x22\x27]?([fh]t+ps?://[\w]*\.?.+\.[\a-z]{2,3}/?).*"This will work fine onhref="http://www.autoitscript.com/forum/topic/125066" href="https://www.autoitscript.com" href="http://dundats.mvps.org/ href="ftp://microsoft.com" href="http://proxy.spele.nl/"If you need to get something like href="../" then try this (untested)$sURL="http://proxy.spele.nl/" $sSRE="(?i)href\s*=[\x22\x27]?([fh]t+ps?://[\w]*\.?.+\.[\a-z]{2,3}/?).*" $aHref = StringRegExp(StringRegExtPeplace($sSource, "(href\s*=[\x22\x27]?)[./]+", $sURL), $sSre, 3)EDIT: Since you are using _IEImageGetCollection() it probably doesn't return the href part so change the expression to$sSRE = "(?i)(?m:^)([fh]t+ps?://[\w]*\.?.+\.[\a-z]{2,3}/?).*" Edited February 9, 2011 by GEOSoft GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!" Share this post Link to post Share on other sites