Portfolio Call Log Time Sheet Spreadsheets Scripts Web Apps Toll Fraud Prevention

 

Scripts

Problem: Many tasks are repetitive. Doing the same thing again and again manually isn't efficient if the computer can do the tasks for you.

Solution: Make custom scripts to perform any of the tasks you need.

There are a variety of scripting programs available. I started scripting with AutoIT because it had been easy for me to learn it, it's free, and there's a large online community of users with whom you can collaborate.


This sample file demonstrates how using a script can dramatically improve efficiency.
One of the SEO strategies I've heard requires a separate page for every keyword you want to target. The pages can be identical with the exception of the keyword on each of the pages. Additionally, it requires a Site Map page that contains a link to each page so the search engines will find everything.

This demonstration uses Texas cities as the target keyword. The script will make one file for each Texas city and an additional file containing links to each of the city files. Click the image to open the video in a new window.

The script in the demonstration video is below.

 

 

#cs ----------------------------------------------------------------------------

  AutoIt Version: 3.2.13.7 (beta)
  Author:     Scott Bartley

  Script Function:
      Creates webpages based on a template and a list of cites. This script will output one file for each city and a file containing a link to each city file it makes.

#ce ----------------------------------------------------------------------------

#include <File.au3>
#include
<Array.au3>

Dim $cities
Dim
$i = 0

_FileReadToArray ( @ScriptDir & "\" & "TexasCities.txt", $cities ) ;edit filename as necessary

FileOpen ( "_links.htm", 1 ) ;creates the _links.htm file

ProgressOn("Progress Meter",$i & " files created", "0 percent") ;starts a progress bar

While $i < $cities[0]; $cities[0] is the first element of the array and is equal to the number of cities. $cities[1] is the first city
      ;this creates the files
      $i+=1
      FileCopy(@ScriptDir
& "\" & "Template.htm",@ScriptDir & "\" & $cities[$i] & ".htm"); Copies the template to a file with the city as the filename
      _ReplaceStringInFile(@ScriptDir & "\" & $cities[$i] & ".htm","*****city",$cities[$i],0,1); Replaces the city name's placeholder with the actual city name.

      ;this creates an htm file containing links to the files previously created. Edit the path as needed.
      FileWrite ( "_links.htm", "<a href=" & StringReplace($cities[$i]," ","%20") & ".htm>" & $cities[$i] & "</a> ")

      ;Set Progress bar position
      ProgressSet( 100*$i/$cities[0], $i & " files created",Int(100*$i/$cities[0]) & " percent complete")
WEnd

FileClose ( "_links.htm" )

;Completion Notification
ProgressOff
() ;turns off the progress bar
If
$i = $cities[0] Then
      MsgBox(0,"File Maker Complete",$i & " city files where created. _links.htm contains links to all " & $i & " files.")
Else
      MsgBox(48,"File Maker Complete with errors",$i
& " city files where created. _links.htm contains links to all " & $i & " files.")
EndIf