Friday, April 18, 2025

Embed image data directly in an autohotkey script

Have an AutoHotkey GUI that uses images and you want to imbed those images INTO your script code? (and not have to use a path to an image file?)

The script will convert your image files into autohotkey data that can exist in your AHK script.

1> Download this conversion tool

computoredge.com/AutoHotkey/Downloads/Image2Include.ahk

2> Run the tool

Pick the image file that you want to include into your script

(This example an image called "colors.png", which is a TV style color bar pattern, is used)

3> Click the CONVERT IMAGE button


            Script shows a "successfully created!" at the bottom

4> Click on "SHOW SCRIPT"

You'll see something like this.  Not the first portion "Create_colors_png".  That is the name that you use in your code for the image name.


5> COPY all of the code and PASTE it somewhere in your script.
It would be suggested to put it at the very bottom.

6> If you have some gui code already that is loading a picture, you just replace the dir/image name with the following code syntax

% "HBITMAP:*" . Create_colors_png()

(NOTE!  You need to have the double parathesis at the end!  don't forget those)

Here's a quick example GUI that will show the image, in my example, a color bar pattern

gui, add, Picture,  , % "HBITMAP:*" . Create_colors_png()
Gui, Show
msgbox press key to continue

; # This #Include file was generated by Image2Include.ahk, you must not change it!
; ############################################################
Create_colors_png(NewHandle := False) {
Static hBitmap := 0

...rest of code copy/pasted from the conversion script

And if you run it, will look like this:


If this tutorial has been of any help to you, I'd love to know! 
If you have suggestions of how to improve it, let me know in the comments!  Thanks!


Tuesday, April 8, 2025

Install Windows Python in OBS

This is a GitHub link that goes into this in way more detail.  
GitHub - zooba/obs-python: A Python bundle for integration with OBS scripting

Here's the basic steps

  1. Go to this releases page and select the most recent version of Python
    Download the WIN64 version (at time of writing v21.2.16.1)
  2. Extract the ZIP file somewhere on your system that you prefer.
    (The Microsoft Windows included zip tool gives file errors, I used 7zip and worked perfectly, in case you run into similar issues)
  3. In OBS, open "Tools" - "Scripts"
  4. Select "Python Settings" tab and browse to the directory you extracted the ZIP file

It should reflect "Loaded Python Version: X"



If this tutorial has been of any help to you, I'd love to know! 
If you have suggestions of how to improve it, let me know in the comments!  Thanks!