Ojito Posted February 24, 2017 Share Posted February 24, 2017 Hey guys! At work we tend to encounter lots of unpublished images inside our client's pages (We use Sitecore). Now, the images always follow the _media/IMAGECODE.jpg -or- .png format. I'd like to create a script that opens the page source, then reads through the code and pulls all the _media/ found into a .txt so we can publish them easier. Which approach would be the best for it? Which one would you reccomend? Is it too far-fetched? I'm pretty noob with Autoit and automation in general so I'm having a bit of a logical struggle here. Any starting logical push would probably direct me to the right path . Thanks! Link to comment Share on other sites More sharing options...
Subz Posted February 24, 2017 Share Posted February 24, 2017 Here is a simple example: #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("http://www.rodsbyreid.co.nz/gallery.html") Local $oImgs = _IEImgGetCollection($oIE) Local $iNumImg = @extended Local $i = 0, $sImgs = "" For $oImg In $oImgs ;~ Show only the source for Steve Paynes 33 Cabriolet images If StringInStr($oImg.src, "images/gallery/thumbs/payne/") Then $i += 1 $sImgs &= $oImg.src & @CRLF EndIf Next Local $sTxt = "Showing " & $i & " Of " & $iNumImg & " images on the page." & @CRLF & @CRLF ;~ Save the file to script directory FileWrite(@ScriptDir & '\Steve_Paynes_HotRods.txt', $sImgs) MsgBox($MB_SYSTEMMODAL, "Img Info", $sTxt & $sImgs) _IEQuit($oIE) Ojito 1 Link to comment Share on other sites More sharing options...
Ojito Posted February 24, 2017 Author Share Posted February 24, 2017 39 minutes ago, Subz said: Here is a simple example: #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("http://www.rodsbyreid.co.nz/gallery.html") Local $oImgs = _IEImgGetCollection($oIE) Local $iNumImg = @extended Local $i = 0, $sImgs = "" For $oImg In $oImgs ;~ Show only the source for Steve Paynes 33 Cabriolet images If StringInStr($oImg.src, "images/gallery/thumbs/payne/") Then $i += 1 $sImgs &= $oImg.src & @CRLF EndIf Next Local $sTxt = "Showing " & $i & " Of " & $iNumImg & " images on the page." & @CRLF & @CRLF ;~ Save the file to script directory FileWrite(@ScriptDir & '\Steve_Paynes_HotRods.txt', $sImgs) MsgBox($MB_SYSTEMMODAL, "Img Info", $sTxt & $sImgs) _IEQuit($oIE) Thanks! This will prove amazingly. I'll play with it around a bit on the weekend and repost if I find a brickwall. Should I re-bump this thread or open a new one? Not sure, new to the forum. Link to comment Share on other sites More sharing options...
Subz Posted February 24, 2017 Share Posted February 24, 2017 No problem, if you have any questions regarding this thread just ask in this thread so that other posters know the history. Ojito 1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2017 Moderators Share Posted February 24, 2017 Ojito, Welcome to the AutoIt forums. When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. M23 Ojito 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Ojito Posted February 24, 2017 Author Share Posted February 24, 2017 Noted Melba. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now