Owen Barnes

super hacker guru-man kami extraodinaire

© 2015, All rights reserved.

Outlook Email Signatures

This is a script I wrote to handle creation of an HTML signature for Outlook.

It loads an HTML template, and replaces special tags/keywords with details loaded from the users AD account. As my company has a few variants of the banner image used, the script accepts a parameter/argument to specify which banner should be loaded (XYZ). We also restrict the mobile from being loaded in the signature to higher up staff. Setting the 2nd parameter to 0 turns it off, 1 turns it on.

Notes:

  • Script expects the template to be saved as SignatureTemplate.html
  • The mobile section in this script does have a bit of HTML in it. This must be changed to suit your template file.

Usage:

cscript OutlookSignature.vbs XYZ 0

 

'OutlookSignature.vbs
'Author: Owen Barnes
'Website: http://ombarnes.net
'
'Purpose: Deploy company email signature, grabs template and 
' replaces the following values with user data from AD:
' %fullname%
' %jobtitle%
' %address%
' %mobile%
' %banner% 
' %bannerlink%
'
' Updates required registry settings to use Signature. 
'
'

 Dim strSigName
 Dim strFullName, strTitle, strAddress, BannerLink
 Dim boolUpdateStyle
 Dim SignatureArray()
 
 Const HKEY_CURRENT_USER = &H80000001 
 Const ForReading = 1
 
'==================================================================
' Get script arguments - sets which Signature is used
'==================================================================
 'Default to XYZ signature without mobile if script run manually (ie without parameters)
 if WScript.Arguments.Count = 0 then
 	strSigName = "XYZ Signature"
 	strSig = "XYZ"
 else 'Set signature to one specified in arguments
 	strSigName = WScript.Arguments(0) & " Signature"
 	strSig = WScript.Arguments(0)
 	'Enable mobile if specified
 	if WScript.Arguments.Count = 2 then
 		blMobile = WScript.Arguments(1)
 	end if
 end if
 
 wscript.echo "Generating " & strSigName & vbCrLf

'==================================================================
'Setup banner and banner link
'================================================================== 

strBanner = "http://randomwebsiteurl.com/signature/banner_" & strSig & ".jpg"
strBannerLink = "http://www.google.com.au"

'==================================================================
' Get Users AD information
'==================================================================
 Dim objSysInfo, objUser

 Set objSysInfo = CreateObject("ADSystemInfo")
 Set objUser = GetObject("LDAP://" & objSysInfo.Username)

 strFullName = objUser.displayname
 strTitle = objUser.title
 
 strStreet = objUser.streetAddress
 strPOBox = objUser.postOfficeBox
 strCity = objUser.l
 strState = objUser.st
 strPostcode = objUser.postalCode
 
 if strPOBox = "" then 
 strAddress = strStreet & " " & strCity & " " & strState & " " & strPostcode
 else
 strAddress = strPOBox & " " & strCity & " " & strState & " " & strPostcode
 end if
 
 strMobile = objUser.mobile
 
 Set objUser = Nothing
 Set objSysInfo = Nothing
wscript.echo "Gathered user AD information"
'==================================================================
' Set Signature Folder
'==================================================================
 Dim objShell
 Set objShell = CreateObject("WScript.Shell")
 strSigFolder = ObjShell.ExpandEnvironmentStrings("%appdata%") & "\Microsoft\XYZ_Signatures\"
 Set objShell = Nothing

'==================================================================
' Define filenames and variables
'==================================================================
 Dim objFSO, objFile
 Set objFSO = CreateObject("Scripting.FileSystemObject")

 'If folder does not exist (ie new profile), then create it

 If Not (objFSO.FolderExists(strSigFolder)) Then
 Call objFSO.CreateFolder(strSigFolder)
 End If

 'Define signature filename
 strSigFile = strSigFolder & strSigName & ".htm"
 strSigFileTxt = strSigFolder & strSigName & ".txt"
 
 ' If signature exists, overwrite (true) or leave alone (false)?
 boolUpdateStyle = true
 

'==================================================================
' Load Signature templates and replace tags with AD values
'================================================================== 


 Set objFSO = CreateObject("Scripting.FileSystemObject") 
 Set objTextFile = objFSO.OpenTextFile("SignatureTemplate.html", ForReading) 

 'If user is part of the mobile group, add mobile number to phone number block
 if blMobile = 1 then
 strMobileHTML = "<span>M: </span><span class=""phoneaddressspan"">" & strMobile & "</span>"
 else 
 'If mobile is not specified, remove from html
 strMobileHTML = ""
 end if

 
 
 ReDim SignatureArray(1)

 'read template, replacing the special keywords with appropriate values and load into array
 Do Until objTextFile.AtEndOfStream 
 strNextLine = objTextFile.Readline 

 strNextLine = Replace(strNextLine,"%fullname%",strFullName)
 strNextLine = Replace(strNextLine,"%jobtitle%",strTitle)
 strNextLine = Replace(strNextLine,"%address%",strAddress)
 strNextLine = Replace(strNextLine,"%mobile%",strMobileHTML)
 
 strNextLine = Replace(strNextLine,"%banner%",strBanner)
 strNextLine = Replace(strNextLine,"%bannerlink%",strBannerLink)
 
 'Add to array
 ReDim Preserve SignatureArray(UBound(SignatureArray) + 1)
 SignatureArray(UBound(SignatureArray)) = strNextLine
 
 'wscript.echo strNextLine
 Loop 
wscript.echo "Processed HTML code"
'==================================================================
' Save array to HTML file
'==================================================================

Set objFile = objFSO.CreateTextFile(strSigFile, boolUpdateStyle, False)
If Err.Number = 0 Then
 For i = 1 to Ubound(SignatureArray)
 objFile.write SignatureArray(i) & vbCrLf
 Next
End If

wscript.echo "Saved HTML code to signature file"

'==================================================================
' Update registry - this tells Outlook to use the signature
'==================================================================


 'Update HKEY CURRENT USER to use new Sig. 
 Set objRegistry=GetObject("winmgmts:\\.\root\default:StdRegProv")
 Set WshShell = WScript.CreateObject("WScript.Shell")

 'Remove the First-Run value, otherwise Outlook ignores the NewSignature setting
 objRegistry.DeleteValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Outlook\Setup", "First-Run"
 objRegistry.DeleteValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Outlook\Setup", "First-Run"


 'Define the new signature - must match the filename without the extension
 'Configure new signature for Outlook 2007
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Common\General", "Signatures", "XYZ_Signatures"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Common\MailSettings", "NewSignature", strSig & " Signature"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Common\MailSettings", "ReplySignature", strSig & " Signature"

 'Configure new signature for Outlook 2013
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Common\General", "Signatures", "XYZ_Signatures"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Common\MailSettings", "NewSignature", strSig & " Signature"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Common\MailSettings", "ReplySignature", strSig & " Signature"
 
 set WshShell = Nothing
 set objRegistry = Nothing

wscript.echo vbcrlf & "Deployed to Outlook"
'wscript.sleep 2000
 

Insurgency

Insurgency is a great tactical FPS, focusing a great deal on teamwork. Think of it Counterstrike, but with a bit more variance in objectives, fresh level design. It includes AI based CO OP, which if you can pull together a decent team that communicates well (and doesn’t run in front of those firing, then bitching) is a great deal of fun.

There is a tutorial which runs you through the basics, but is a bit buggy and comes across as unfinished. It doesn’t quite explains things well enough at times, leaving the user not knowing what to do.

Taking part of matches, taking control of control points/objectives and of course having a good kill/death ratio will increase the amount of points you can use to select differing weapons, attachments, equipment (smoke, grenades, etc).

 

 

Beseige

Came across this fantastic little indie game on Steam a week or so ago. A puzzle game at heart, you build your contraptions to complete the objectives and progress through the levels.  You may think, ok, anyone can piece together small tank and cannon, whats the appeal?  Despite the limited parts, you can make some truly amazing machines, all but ignoring the objective (or just play in sandbox mode). There is more than one way to skin a cat, as they say. Just some examples of the creations people are coming up with:   A lot more levels are coming, and more than likely additional parts

B18C7 Build

I picked up a cheap B18C7, via a forum acquaintance whom got it from a wrecked Integra (an EK4 project he was planning from memory).   My acquaintance had already taken the head off, so I checked out the bores and threw on a new head gasket and bolted it back down. I am hoping the valve guides and stems are OK, otherwise back off with the head and get it rebuilt but I will not know until its started I have replaced the water pump, oil pan gasket – the pan itself has seen better days, valve cover gasket, water pipe o-rings, intake/exhaust gaskets, etc.   All of the water hoses will be replaced, the mix of damaged OEM piping and red silicon pipes. The hose clamps had been over tightened and damaged the ends of the tube.    The air intake had a bit of oil/muck in it, which usually happens with too much oil pressure. Hopefully thats all it was. I am missing the flywheel bolts and other bits and pieces. I have them on order and will hopefully get the gearbox on in a couple of weeks.   One intake stud needs to be drilled out and replaced, but otherwise everything else is looking ok. The plan is to get the engine assembled and dropped into the EH9 shell I have. The plans for the EG8 turbo car is still on, but the expense involved (and house owning) limits the amount I can spend and further delays things.

Rebuilt engine in

A fair bit has happened since my last post. I bought the red Civic up to road worthy standard which entailed the following:

  • Replacing the bonnet, as the old one had fatigue cracks
  • Repairing a hole near the join in the muffler to the exhaust pipe
  • Removing and replacing the master cylinder which was leaking
  • Replacing the steering wheel, which had deteriorated and broken away from the metal ring. It wasn’t worth repairing as the rubber was falling apart. Whilst I could re glue it to the metal ring it wouldn’t take long to come completely apart
  • Fixing an oil leak.  I had actually fixed this prior to taking it for the roadworthy, but as I hadn’t been able to fully clean all the oily muck off, they thought it was still leaking.

I didn’t have to spend very much getting it to standard thankfully, given I was taking the D15B7 out and putting my rebuilt motor in.

I spent yesterday and today removing the old motor and installing the B16A. Just have to reconnect everything, run wires for the vtec solenoid and oil pressure switch. I also need to move the accelerator cable and fuel rail from the old Civic to the new.

The next part is installing the intercooler, piping and turbo. This part is all new to me, the goal being to get it to a running state that will allow me to take it to a tuner. Fingers crossed all goes well.

Another Civic

Picked up this red Civic today as its in somewhat better shape than the blue one I currently have. The owner tried to get the Road Worthy (must have one to sell the car registered), but failed on a few things:


  • Bonnet (structural damage, the metal has fatigued and broken where the bonnet holder props it up)
  • Split CV boot
  • Worn front tyres



As I had all of the above, they brought the car over and fixed those up (thus the blue bonnet on a red car). When they took it back, they failed on more things:


  • Hole in exhaust
  • Alternator o-ring leaking
  • Master brake cylinder leaking
  • Handbrake needs adjusting
  • Front brake pads
  • Rear brake linings



So they are going to dereg this arvo for me. None of is an issue for me to fix as Im moving everything from my blue civic to this one; its just a shame they didnt service it prior to selling else they would have known. 

I wiped away some of the oily muck from the leak and found the gearbox is blue – the owner had it for 4 years and never knew  

[/URL]

First home and new wheels

Moved into my own first home over the weekend, nice 3 bedroom lowset home with a large double garage (with a thick enough concrete base to allow me to get a car lift installed, huge plus!). So glad to have my own place, have a garage (last place only had a carport that the owner used) and plenty of space. 

The new place puts me fairly close to some wreckers that have honda parts, whilst I was at one enquiring about a subframe, I had a look at their imported wheels and located a set I liked so grabbed them then and there, just managing to fit them in the car that was already carrying a house load of stuff. Fitted them yesterday:



I had a set of 16″ speedy wheels on there previously, but Im liking these 15s (Monza, unknown model, wrapped in Yokohama S.drive 195/50 tyres) . Eventually I’ll em onto my other civic once thats back up and running.

Engine rebuild completed

Adam at PEACH Performance completed the engine rebuild a couple of weeks ago. I have slowly been adding the various parts back on, and am almost ready to install back into the car.   I need to drop by Super Cheap to get some replacement exhaust studs, a tap & die set to fix another stud so I can remove it (looks like something has hit the thread, and ruined one nut already).   LSD for the gearbox is yet to turn up, so contemplating buying one locally (but dont really have 800 to spend at the moment, see below).

  

I have just purchased a home, so will be moving in the next few weeks, which means Im unlikely to get the engine in the car just yet (would be a great break in if I could).

Engine now being inspected

Engine is now at P.E.A.C.H Performance, being stripped down and inspected. Hoping to get a call this week re the condition (I know the oil rings have had it), then hopefully on with the rebuild.

Im also investigating my options for getting a diff installed and a new clutch. At the moment I’m looking at a Cusco helical diff and an Exedy Sports Organic clutch.

Failed valve rings or piston rings

Have had a fun month so far. I recently shifted houses, and was in a mad rush to try and get the road worthy for the Civic. Unfortunately, I discovered after I booked it in that the parts store had ordered the wrong bushes for the lower control arms (front and suspension bushes are cracked). They were able to get me the right ones a few days later (and gave me a discount for the trouble), but at that point it was too late to get sorted.

Oh yeah, I also had to get the old tint off the rear glass. Took it to a tint shop who said the only way to get rid of it was with a blade (the black rubbish/amonia/steamer trick does not work!). Issue with that is it kills the demister lines. So located a new screen and had it fitted.

Next day I started the car and notice it was running a bit rough and smokey, but didnt have time to look into it.

A few days later I drove the car over to the new house (still sounding/feeling rough, but no drop in power or anything) and it decided to blow an insane amount of oily smoke out the exhaust about 500 meters from the new place. I had thought the PCV was blocked, but thats OK. No oil in the intake manifold. So either the rings or the valve seals are gone.

So its not going on the road quite yet, but my plan for an engine rebuild has been accelerated as a result.

I’ve ordered/received the following:

  • ACL Race Bearings
  • ARP Head Bolts
  • ARP Rod Bolts
  • Nippon Low Compression Pistons (81.5mm)

I was having a look around Ozhonda and found someone locally selling two garret turbos, one of which they had on their Integra, running at 10-15psi. Managed to get the second garret for free, both in good condition.

Not overly impressed with the nippons, but really a given as they cast rather than machined. The tops of the pistons are quite rough.

blogs/planky/attachments/25870/smoking-up-img_20120315_224605dtjpg

Still to order/locate:

  • ARP main studs
  • Skunk2 Cams, Springs, Retainers and Valves
  • Intercooler and piping (there are kits on ebay that would cover this).