Jump to content

Auto pulling from webpages


Ojito
 Share

Recommended Posts

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

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)

 

Link to comment
Share on other sites

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

  • Moderators

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

 

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...