/* This AutoHotkey V2.0 demonstration script shows how to write a database driven AutoHotkey app. The Picture/Sound filenames located in the PictureSound.ini data file configure the GUI windows and the associated action. After the user clicks on an image, AutoHotkey looks up the name of the sound file in an INI file and plays it. The script uses the image file name as the II file Key. After loading a series of images, the script plays a different sound for each image. Using the INI file as a lookup table saved me from writing a different subroutine (or at least If condition) for each Picture control in the GUI window. V2.0 Tip: The V1.1 GuiControlGet command disappears in V2.0 in favor of the ControlGetText function. In this "Bind" version, we drop the extra commands complete and move directly to the SoundPlay command. In fact, we no longer need the INI file format. Any old text file will do. */ PictureSound := GuiCreate() Loop Read, "PictureSounds.ini" { If A_Index = 1 Continue picture_array := StrSplit(A_LoopReadLine, "=") PictureSound.Add("Picture","w50 h-1",picture_array[1]) .OnEvent("Click",Func("AudioPlay").bind(picture_array[2])) } PictureSound.Show("AutoSize Center") AudioPlay(Sound) { SoundPlay Sound }