Jump to content
Sign in to follow this  

Help with Koda, clickable pictures and saving as .txt

Recommended Posts


Hello peeps. I have used coda to make a GUI with a lot of pictures, and I want them to be clickable. The goal of this script is going to be: When I click a picture (.jpg) I want to save a custom text (Each picture should result in a unique text) to a .txt file. After that I want to open an external program (.exe).

The pictures are saved on the internet, and the .txt and .exe is saved locally in the same folder as the script.

Here is my code so far:

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=c:\users\bendik\desktop\hero picker gui\form1.kxf
$Form1_1 = GUICreate("Form1", 645, 469, 193, 125)
$Pic13 = GUICtrlCreatePic("http://www.heroesofnewerth.com/images/heroes/20/icon_128.jpg", 96, 14, 40, 40, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic14 = GUICtrlCreatePic("http://www.heroesofnewerth.com/images/heroes/122/icon_128.jpg", 138, 14, 40, 40, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg

Case $Pic13
$ReplaceText = "Pic number 13"
Case $Pic14

$TextFileName = "heropicker.txt"
$FileContents = FileRead($TextFileName)
$FileContents = StringReplace($FileContents,0,$ReplaceText)

But it does not work. I am kinda new to AutoIt, and would therefore like some help!

I have tried with MsgBox just to test if the "Case $pic13" is activated, but with no results.

If anyone could help me with making this script, I would be very thankful :idea:


Ps. I also want a line for opening the .exe program from the same folder. Is there a way to determine the folder location, and then use $FolderLocation\myExe.exe ?

Edit: Will it complicate things if I have a picture beneath the pictures I want to be clicable?

Think like this: I have a green background that is a .jpg picture. Can I then add pictures above the green background and they will still be clickable?

Edit2: I tried to move $pic13 outside my form, so it got nothing below it, and added a MsgBox(0,"test","test") in the $pic13 case, and then I got a popup with the words "test". I guess my background-images are complicating things? Can I get an approve/disprove? And I still wonder about the .exe!

Edited by XplittR

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this