Jump to content

Recommended Posts

Posted

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!

Posted

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)

 

Posted
  On 2/24/2017 at 5:23 PM, 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)

 

Expand  

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.

  • Moderators
Posted

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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