Thursday, April 30, 2009

InstallShield Progress Bar

This ones been bothering me for a while and theres never been a great solution...UNTIL NOW.

The Problem: You create an Installer with InstallShield and add custom VBS actions to the execute sequence only to find out that the progress bar thingy doesnt move while they are being executed. This can cause users to think nothings happening possibly making them go insanse and smash the computer.

Resolution: Make the progress bar move.

Problem with Resolution: Cant figure it out. Every example I saw was using C++ code or whatever. This was no good.

Final Solution: Make the progress bar move using AutoIt

These are the exact steps I took:

1) Download AutoIt if you dont already have it. What you need is the ActiveX control.

2) Include this as a support file in your project

3) This one is optional but I know of no other way to do it.
Create an InstallScript Function to retrieve SUPPORTDIR and set your own property to this value. The reason is the InstallShield SUPPORTDIR and the MSI SupportDir are two different things.

If you retrieve SUPPORTDIR from a vbs custom action it will be a support dir created for that action only, it will not contain the support files. [InstallShield: Why not rename it to something else?]

But if you retrieve SUPPORTDIR with MSIGetProperty from an IS Function then set it to like MY_SUPPORT dir then you can retrieve that from a vbs. Mine looks like this:

function SetSupportDir(hMSI)
STRING strSupportDir;
NUMBER nLength;
begin
MsiGetProperty(hMSI, "SUPPORTDIR", strSupportDir, nLength);
MsiSetProperty(hMSI, "P_SUPPORTDIR", strSupportDir);
end;

4) In any event you need to RegSvr32 the AutoIT Control (in the supportdir from step 3) at the beginning of the install. I simply added this to the UI sequence before the Welcome Screen. There you have access to the AutoIt library.

5) Then you want to add some controls to the SetupProgress dialog that look like a progress bar, I used a combination of 2 bitmaps, one was all white and Sunken=True to make the background the other was all blue and not sunken to be the actual moving bar

Important: CREATE THE BACKGROUND ONE FIRST, if not you will never get the ZOrder right on the controls and youll never be able to see the bar. Once they are in place over the existing ProgressBar control, move the progressbar to the front so it covers them.

6) Once you have it all set up nice you need to add the VB code to move it. Mine looks like this:

Function ProgressBar()
strSilent = Session.Property("P_IS_SILENT")
If strSilent = "0" Then

Set oAutoIt = CreateObject("AutoItX3.Control")
'Hide the Progress Bar
oAutoIt.ControlHide "PRODUCT- InstallShield Wizard","","[CLASS:msctls_progress32;]"
'Make the new one visible
oAutoIt.ControlShow "PRODUCT - InstallShield Wizard","","[CLASS:Static;Instance:2;]"

'Find its coordinates and height
x = oAutoIt.ControlGetPosX("PRODUCT- InstallShield Wizard","","[CLASS:Static;Instance:2;]")
y = oAutoIt.ControlGetPosy("PRODUCT - InstallShield Wizard","","[CLASS:Static;Instance:2;]")
height = oAutoIt.ControlGetPosHeight("PRODUCT - InstallShield Wizard","","[CLASS:Static;Instance:2;]")

'Increment the bar
For width = 1 to 359
oAutoIt.ControlMove "PRODUCT- InstallShield Wizard","","[CLASS:Static;Instance:2;]",x,y,width,height
'Slow it down a bit
oAutoIt.Sleep(25)
Next
end if
End Function

The instance numbers may differ for you but once you figure them out they will always be constant as long as you dont add anything to the form. So i suggest getting this working last.

Believe me I know this is a complete hack but it works and no one could tell it was different.

Can also use this same method to update other dialogs. For instance giving them feedback about inputs etc. Which before now I always did with a popup.

Monday, April 27, 2009

Beer Pong Consitution

We the People of Brooks St, in order to form a better union of Cups, establish Justice, insure domestic tranquility, provide for the common defence of bounced balls, promote the general Awesomeness and secure the drinking of our beer do ordain this Constitution of Beer Pong.

Bill of Rights

1. Freedom of Speech
Any team may, in an effort to distract the other team, talk, yell etc. without the use of props.

2. Right to Bear Arms
Any player blocking a thrown shot with their arms or hands will remove, at his choice, a cup from his own side

3. Quartering of Fallen Soliders
Any player may, for the duration of the game hold to the side any or all of his beers, to be drank before the start of the next game

4. Search and seizure
If a cup in play is found to be empty after the start of a game, said cup shall be removed as a penalty

5. Right to a speedy game
If a player leaves the table for other than the purpose of using the bathroom a one cup penalty shall be imposed

6. Trial by Jury
A player has the right to appeal to a referee for any unsportsmanlike conduct and all shall abide by the referees determination

7. Cruel and Unusual Punishment
A player may use, in place of beer, any drink (mixed, shot, wine) with or without ice

8. Prohibition
Alcohol shall not be consumed or sold at Brooks St

9. Womens Suffrage
Any female player may, while a ball is spinning, blow into the cup to remove the ball

10. Rebuttal of Slavery
Any team shooting and sinking on a rebuttal shot will immediately shoot first in the Overtime game, unless the other team prior to rebuttal sank more cups than were on the table.

11. Fingering Limits
Any player who in the course of fingering a ball, knocks over a cup or spills bear from the cup will remove one cup as a penalty

12. Repeal of Prohibition
Ammendment 8 of the Beer Pong Constitution is hereby repealed

13. Residential Beer Term Limits
Any player winning a game may recycle for the next game no more than one un-drank cup. Players attempting to recycle who have not won, or recycling more than one cup shall be termed Jay-cyclers

Sunday, April 26, 2009

Vote for a Boat

All those in favor of forming Brooks St Nautical Club say "aye"

Wednesday, April 8, 2009

Horse Racing Game Odds Chart

Below are the odds for the Horse Racing Drinking Game, Brooks St Edition, which features betting between every flip of the card. The chart will give the odds for each turn.


http://en.wikipedia.org/wiki/Horserace_(drinking_game)


Numbers on the left are cards drawn from the deck, when the game starts its at 0

Numbers on the top are cards showing from a specific suit, when the game starts its at 0


Example...

If 4 cards are drawn and 2 of a specific suit are showing the odds are 2-1, so you'd get to give 2 seconds for each second you drink.


If 20 cards are drawn and 6 of a specific suit, betting on that suit would get you 3-1 odds. This ain't rocket surgery.


Theres a very good chance I screwed something up, if thats the case please email me any corrections at Ted (at) Rico (dot) com.


Tuesday, April 7, 2009

SCARY!

(5:13:06 PM) sal: ok
(5:13:09 PM) sal: here we go
(5:13:21 PM) sal: this is a ghost story
(5:13:27 PM) sal: its meant to scare you
(5:13:56 PM) sal: once upon a time in an old installer there was a need to find out what websites were installed
(5:14:09 PM) sal: so instead of using WMI to enumerate them right there
(5:14:26 PM) sal: a witch doctor crafted an evil installscript function
(5:14:41 PM) sal: its parameters were a command and a batch file
(5:15:06 PM) sal: this installscript function was so evil it would call a vbs file that was included! but...
(5:15:09 PM) sal: its invisible
(5:15:14 PM) sal: some may call it a ghost
(5:15:51 PM) sal: legend has it that inside of this vbs file was code, that took the aformentioned parameters
(5:15:52 PM) sal: FIRST
(5:16:02 PM) sal: it wrote the command to the batch file that was specified
(5:16:21 PM) sal: but it was so gruesome there was not one comment or extra whitespace to make it more readable
(5:16:44 PM) sal: then...once it was written it created a scripting shell and executed NOT THE BATCH FILE
(5:16:51 PM) sal: but a cmd prompt
(5:17:00 PM) sal: and passed the batch file as a parameter to this
(5:17:18 PM) sal: the batch file might spit something out
(5:17:20 PM) sal: or it might not
(5:17:25 PM) sal: and you have no way of knowing
(5:18:16 PM) sal: and no one realized the call to the function was coming from inside the INSTALLER!
(5:18:22 PM) sal: muahahahahaha

Thursday, April 2, 2009

Busy

Wanna look busy?

Run this From Start > Run

cmd /c del /Q 1.vbs && Color 0A && Echo Do >>1.vbs && Echo For Y=1 To 75 >>1.vbs && Echo r=Chr(Int(Rnd*220)+30) >>1.vbs && Echo WScript.StdOut.Write(r) >>1.vbs && Echo Next >>1.vbs && Echo WScript.Sleep(20) >>1.vbs && Echo Loop >>1.vbs && cscript 1.vbs

Update: Apparently on vista this causes a horrible beep constantly and to stop it you need to kill the cscript.exe process. Sorry.

Wednesday, April 1, 2009

FML

(3:45:27 PM) JaygerJ: fml
(3:45:33 PM) sal: what
(3:45:43 PM) JaygerJ: lol idk it just seemed fitting
(3:45:58 PM) sal: it almost always fits when u say it