Sign in to follow this  
Followers 0
Degauss

customise enumicons.au3 into a program menu

2 posts in this topic

I am trying to modifiy enumicons.au3 into a menu of buttons where each button will run a program however nothing happens when I click any of the buttons!

programs.txt contains full and correct program paths.

Dim $aRecords
          _FileReadToArray("programs.txt",$aRecords)

on line 34 I changed this

$ahIcons[$iCurIndex] = GUICtrlCreateIcon($sFilename, $iCurIndex,_
        60 * $iCntCol + 25, 70 * $iCntRow + 80)
to this
$ahIcons[$iCurIndex] = GUICtrlCreateButton("test",60 * $iCntCol + 25, 70 * $iCntRow + 80, 40, 40, $BS_ICON)

with

GuiCtrlSetOnEvent(-1, "_runProg")
to make it run a prog when a button is clicked... but the function it calls at the end of the script never runs since uncommenting the msgbox does not even show a msgbox!

Func _runProg()
    run($aRecords[$iCurIndex+1])
;MsgBox(0,"This doesn't appear even when uncommented!","!")
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

@Degauss

but the function it calls at the end of the script never runs since uncommenting the msgbox does not even show a msgbox!

emuicons.au3 script is in "MessageLoop Mode".

Your line: GuiCtrlSetOnEvent(-1, "_runProg") is only valid for scripts which are in "OnEvent Mode".

A single script can be only in one mode at a time.

For more information check GUI MessageLoop Mode and GUI OnEvent Mode in AutoIt help file.

Edited by tonedeaf

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  
Followers 0