AHK: Making a User Interface with Graphics

GUI

So you wanna prettify your user interface? Maybe make some custom buttons and use your own image instead of the default grey box on the left?

It’s actually not as difficult as I was expecting. All you need is a program like Photoshop or Gimp to make the .png, .jpg or .tif for your background and any buttons.

Before Getting Started

The recipe in the above script calls for just two images. The background and the DECIPHER button. These were tailored to work with the code I posted last week for deciphering the Caesar Shift with AutoHotkey.

It took less than 10 minutes to throw those together with Gimp:

Background


Because Gimp is marvelous.

Useful Commands

Inserting the pictures only requires learning these two new commands, in addition to the ones in this previous post.

Gui, Add, Picture, x# y# H# W#, FilePathOfBackgroundImage
*The x  and y are coordinates for placement, h is height and w is width in pixels

Gui, Add, Picture, x# y# H# W# gLabel, FilePathOfButton
*The g specifies a label which will have code attached further down
Label
:
{
Do this when Button is pressed
}

A Breakdown

CodeExplained
What exactly does this do?

Last you’ll need a .txt file with enciphered text. For now, it only works with Caesar Shifts. Here’s a passage in ROT7 if you want to try:

“H avdls, Aol Opajooprlyz Nbpkl av aol Nhshef zhfz, pz hivba aol tvza thzzpclsf bzlmbs aopun hu pualyzalsshy opajooprly jhu ohcl. Whyasf pa ohz nylha wyhjapjhs chsbl. Fvb jhu dyhw pa hyvbuk fvb mvy dhytao hz fvb ivbuk hjyvzz aol jvsk tvvuz vm Qhnshu Ilah; fvb jhu spl vu pa vu aol iypssphua thyisl-zhuklk ilhjolz vm Zhuayhnpubz C, puohspun aol olhkf zlh chwvyz; fvb jhu zsllw bukly pa ilulhao aol zahyz dopjo zopul zv ylksf vu aol klzlya dvysk vm Rhryhmvvu; bzl pa av zhps h tpupyhma kvdu aol zsvd olhcf Ypcly Tvao; dla pa mvy bzl pu ohuk-av-ohuk-jvtiha; dyhw pa yvbuk fvby olhk av dhyk vmm uvepvbz mbtlz vy hcvpk aol nhgl vm aol Yhcluvbz Ibnishaaly Ilhza vm Ayhhs (zbjo h tpuk-ivnnpunsf zabwpk hupths, pa hzzbtlz aoha pm fvb jhua zll pa, pa jhua zll fvb); fvb jhu dhcl fvby avdls pu ltlynlujplz hz h kpzaylzz zpnuhs, huk vm jvbyzl kyf fvbyzlsm vmm dpao pa pm pa zapss zlltz av il jslhu luvbno.”

Ideally the script will make that giant tangle of gibberish into this:

GIFLowRes

 

Advertisements
Tagged , , , , , ,

2 thoughts on “AHK: Making a User Interface with Graphics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: