Latest Posts


VBS Option Box – Simple VBScript MsgBox / Dialog Box with Options

I needed to create a basic script to execute a user selected routine but needed a simple way to capture the users choice. Like a MsgBox but with multiple options.
Here’s some nice simple code for a VBScript Option Box in case you want to do the same.

First we create a very basic HTML file which will act as the dialog box. (the options and buttons)…

<HTML>
<HEAD>
<TITLE>Make a selection</TITLE>
<SCRIPT language="VBScript">

Sub OKClick
If MenuOption(0).Checked Then
ChosenOption.Value = "Option 1"
End If
If MenuOption(1).Checked Then
ChosenOption.Value = "Option 2"
End If
If MenuOption(2).Checked Then
ChosenOption.Value = "Option 3"
End If
End Sub

Sub CancelClick
ChosenOption.Value = "Cancelled"
End Sub

</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<BR>
<B>Please select an option:</B><P>
<input type="radio" name="MenuOption" checked="true">Option 1<BR>
<input type="radio" name="MenuOption">Option 2<BR>
<input type="radio" name="MenuOption">Option 3
<P>
<input type="Button" value="OK" onClick="OKClick()">
<input type="Button" value="Cancel" onClick="CancelClick()">
<input type="hidden" name="ChosenOption">

</CENTER>
</BODY>
</HTML>

The hidden input above is used to store the users chosen option.
The VBScript below, opens the HTML file and loops while waiting for this chosen option value to change.
When this chosen option value changes the VBScript captures this chosen option in a variable so it knows what the user selected.

Set objExplorer = CreateObject("InternetExplorer.Application")

objExplorer.Navigate "file:///C:\Script\option.htm"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 230
objExplorer.Visible = 1

Do While (objExplorer.Document.All.ChosenOption.Value = "")
Wscript.Sleep 250
Loop

strSelection = objExplorer.Document.All.ChosenOption.Value

objExplorer.Quit

Wscript.Sleep 250

Select Case strSelection
Case "Option 1"
Wscript.Echo "You selected Option 1."
Case "Option 2"
Wscript.Echo "You selected Option 2."
Case "Option 3"
Wscript.Echo "You selected Option 3."
Case "Cancelled"
Wscript.Quit
End Select

Of course, instead of echoing the selected option you would put the code you want to run under each case.

This is a nice flexible solution allowing you to easily add/remove options.

You can do away with the OK button and, in the HTML, add onClick="OKClick()" to the radio button elements, so the user only needs to click once on the option they want.


If this info helps you out, tweet me to say thanks or

Because I’m so nice you can download the VBS and HTML files in this handy VBS Option Box Script Zip(851 bytes)
Note: make sure to put the HTML file in "C:\Script\" to test. (Or change the line in the .VBS file pointing to the location of the HTML file.


Dreamweaver CS3 won’t start in Windows 7

I’m still using Dreamweaver CS3 for some web stuff. It does all I need it to do, or at least it did until it suddenly just decided to not load anymore!

I tried rebooting, tried running as admin, tried running in compatibility mode etc.
Finally I found that there now appears to be a some kind of issue with Windows Aero, on my laptop at least.
So, after much frustration I finally got it to work.

If your Dreamweaver CS3 has stopped loading in Windows 7 you can get it to work by just changing these settings …

1. Right click the Dreamweaver shortcut and then click “Properties”.
2. Click the “Compatability” tab.
3. Under the “Settings” section:
Tick “Disable visual themes” and “Disable desktop composition”
(It does seem to work without ticking “Disable visual themes”, but a couple of times it didn’t start so I left mine ticked just in case.)

You’ll notice that you lose your nice aero transparency / colours etc but at least you can now use Dreamweaver CS3 on Windows 7 again!

You could disable Windows Aero completely, or just the Aero Peek feature, but seems overkill to change the entire OS appearance just for the sake of one misbehaving application.

If this helped you please tweet me (@alanhart) or comment below to let me know!

Netflix move display to second monitor – Windows 8 Metro UI

Move the Netflix Windows 8 App (and any other MetroUI application) to your second monitor.

You can use these basic Win 8 keyboard shortcuts to toggle which monitor Netflix appears on…

Windows Key + PgUp (Move Tiles to the Left)
Windows Key + PgDown (Move Tiles to the Right)

Easy as pie!

If this little tip has helped you, please share\tweet this and mention me (@alanhart)

I’m an Individual by Jezilyn Martyn supporting BeatBullying

One of my lovely twitter followers has released her lovely anti-bullying single, ‘I’m an individual’ a percentage of the proceeds go to beatbullying uk

Please check it out and download if you like it (or even if you dont – it’s for a good cause!)

Listen & Buy on iTunes.
Listen & Buy on Amazon:

 

URL Redirect Check Tool – 301 Redirect Checker

I have made simple Redirect Check Tool.This tool can quickly and easily tell you if an URL redirects to another, the URL where it redirects to and the response headers returned by the server.

This is useful for SEO purposes and also if you have asked your web hosting company to make 301 redirect changes on your behlaf and you wish to check everything redirects OK

Enter an URL in the form below and you’ll be taken to the results page where you will see the URL header response code (type of redirect) and where the URL redirects to.

Enter URL to check

See more of my handy tools here: Tools

[tweet][/tweet]

Compare CSS Stylesheet Tool – Update

In December 2010 i made my compare stylesheet tool available on my site for everyone.

It had a few shortcomings (pointed out to me by a few of you) so I’ve made some nice additions! Hurrah!

What does it do?
For those who don’t already know, CSS is a standard used to define Web site presentation styles.
When a Web designer creates a CSS stylesheet for a site, he will evolve it through multiple versions with incremental changes.

This tool allows a web designer to clearly see the differences between two css stylesheet files (classes only, not values)

Compare CSS Stylesheets

Description
A webpage that takes two CSS files and compares the classes contained in both. Resulting differences are highlighted in red.

Updates:

  • Optional flag “(!)” can be added next to every difference for quick & easy text search.
  • Text boxes at bottom of page for easy copy and paste of CSS code (also with optional “(!)” flag for easy text search)
  • Usage:
    Click the “Compare CSS Tool” link below and simply upload the css files you want to compare and click the compare button.

    Compare CSS Tool

[tweet][/tweet]

EKM Powershop – Adwords Conversion Value – Add Order Value to Your Adwords Code

When logged into your account on the successful checkout page (Settings > Checkout > Order Complete Page)
QuickLink if you’re already logged in is: http://youraccount.ekmpowershop2.com/ekmps/shops/settings_shop_checkoutfields_6.asp

Paste the google adwords javascript with the ekm tag [ekm:totalcost_number_only] where conversion value needs to go (in both the javascript and noscript bits of the code.)

Here’s  code example (with made up conversion id and label data):
this data goes at the bottom of the successful checkout page source

 <!– Google Code for Sale Conversion Page –>

<script type=”text/javascript”>

/* <![CDATA[ */

var google_conversion_id = 1234567890;

var google_conversion_language = “en”;

var google_conversion_format = “3”;

var google_conversion_color = “ffffff”;

var google_conversion_label = “ab-CDEfghIJKlMn1_AB”;

var google_conversion_value = [ekm:totalcost_number_only];

/* ]]> */

</script>

<script type=”text/javascript” src=”http://www.googleadservices.com/pagead/conversion.js”>

</script>

<noscript>

<div style=”display:inline;”>

<img height=”1″ width=”1″ style=”border-style:none;” alt=”” src=”http://www.googleadservices.com/pagead/conversion/1234567890/?value= [ekm:totalcost_number_only] &label= ab-CDEfghIJKlMn1_AB &guid=ON&script=0″/>

</div>

</noscript>

Important:

  1. If you have more than one payment method e.g. telephone, paypal etc you will need to add this code to the source of each payment method’s “checkout complete” page.
  2. The ekm powershop database/server code escapes any (“) with a slash e.g. (\”)
    it double escapes this if the user changes something then updates the page source again
    replacing every double quote (“) in the google code with single (‘) will prevent this happening.
  3. Make sure you do a dummy run throught the checkout process and view page source on the order complete page to verify the code looks as it should.

 

If you have more than one payment method e.g. telephone, paypal etc you will need to add this code to the source of each payment method’s “checkout complete” page.

XML Twitter Feed Not Working? The Twitter Feed XML has been removed/changed

Looks like twitter have turned off XML feeds…

Here’s where you can find XML feed for your tweets:

https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=AlanHart

You can also use (Thanks to @steveclarkcouk for this one) …

https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&include_rts=true&screen_name=alanhart&count=2

(This includes all the original xml fields. Change “count=2” to retrieve more than 2 tweets)

*Obviously replace “AlanHart” with your username ;)

Hope this helps someone!

There are a few changes:

As an example: I am loading the xml into a cache file and updating this every 5 minutes (keeps it up to date but stops each webpage request hammering twitter)

I then load the XML from the cache file into a VAR:

$xml = simplexml_load_file($cache_file);

var_dump($xml); // will show the array data for debugging

And output for each tweet:

foreach($xml->channel->item as $entry) {echo ($entry->title);}

Differences i have noticed:

1. The xml is nested differently:

Used to be: $xml -> status

Now: $xml ->channel->item

2. User Profile Picture

used to be: $entry->user->profile_image_url (This no longer exists)

3. Tweet text

used to be: $entry->text (this is now: $entry->title)

4. Tweet Date

used to be: $entry->created_at (this now: $entry->pubDate)

02033011048 – phone number – keeps calling

I kept getting (and ignoring) calls from this phone number 02033011048.

Today i answered it and the girl on the other end said she was calling on behalf of a *mumbled* telecommunications / vodafone.

She said my phone was due for an upgrade, and it was (about a month ago). i told her this and she hung up.

I’m guessing this is one of those companies trying to switch me over to their account or something?

If you’ve answered one of these calls or have had a call from this number please post a comment for all to see.

Recent Posts