Jump to content

customise enumicons.au3 into a program menu


Degauss
 Share

Recommended Posts

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
Link to comment
Share on other sites

@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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...