VBS Script – Embedding Images

Disclaimer: I am not responsible for the misuse of this script.

Description

I wanted to easily access some low res proofs via web page where I was able to scroll down and view all images rather than view them in a sideshow presentation.

Script

‘************************************************************************************************
‘ File:    Rip Em!
‘ Author:  Hassan Maynard



‘************************************************************************************************

Title = “Rip Em!”
Version = “v1.0″

Dim strDirectory, strFile, num

num1 = 0
num2 = 0
num3 = 1

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Const ForAppending = 8

Do

URL = “WEBSITE URL” & num1 & num2 & num3 & “.JPG”

strDirectory = “C:\”
strFile = “\Rip_em.html”

Link = URL

sDate = Date
sTime = Time

If objFSO.FileExists(strDirectory & strFile) then

Else

Set objTextFile = objFSO.OpenTextFile _
(strDirectory & strFile, ForAppending, True)

objTextFile.WriteLine(“<head><title>Rip’em! – Created by Hassan Maynard</title></head> <Body BGCOLOR=” & chr(34) & “#FFFFFF” & chr(34) & ” TEXT =” & chr(34) & “#000000″ & chr(34) & ” LINK =” & chr(34) & “#39bbe5″ & chr(34) & ” VLINK =” & chr(34) & “#e539aa” & chr(34) & ” ALINK =” & chr(34) & “#6139e5″ & chr(34) & “></Body><H1>Rip’em!</H1> <b><i>Created by Hassan Maynard</i></b></b><br><br>”)

objTextFile.Close

End If

If num3 > 9 Then
num2 = “”
Else
End If

If num3 > 99 Then
num1 = “”

counter = num1 & num2 & num3

Else
End If

Set objTextFile = objFSO.OpenTextFile _
(strDirectory & strFile, ForAppending, True)

objTextFile.WriteLine(“Picture ” & num1 & num2 & num3 & ” added on ” & sDate & ” at ” & sTime & “<br><br> <img src=” & LINK & “> <br><br>”)

objTextFile.Close

num3 = num3 +1

Loop Until counter = 500

Set objExplorer = CreateObject(“InternetExplorer.Application”)

with objExplorer
.Navigate “file:///C:/Rip_em.html”
.ToolBar = 0
.StatusBar = 0
.Visible = 1
End with

do while objExplorer.readystate<>4 : wscript.sleep 50 : loop

Task

This script records the image link on a specified website and current/system date & time. It then looks for a local html file named rip_em.html on the local “C” drive. If the file exists the document will open to be edited, if not the file will be created. The script then starts creating entries for each image. Example: Picture 063 added on 12/27/2009 at 12:00PM. This continues until the counter has reached the last number specified. After this is complete Internet Explorer opens up with the images.

rip_em_example

Leave a Reply