Pomen Posted September 18, 2013 Share Posted September 18, 2013 hiii...i hav created a menu form...on click of one menu(REGISTER) i want another .au3 file to open...how do i do that? also on click of another menu(HOME) i want sum labels to be displayed in the empty section below the menu bar. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("Menu", 500, 500) $home = GUICtrlCreateMenu("&HOME") $register = GUICtrlCreateMenu("®ISTER") $admission = GUICtrlCreateMenu("&ADMISSION") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $home GUICtrlCreateLabel("hello", 100, 360) EndSelect WEnd Link to comment Share on other sites More sharing options...
FireFox Posted September 18, 2013 Share Posted September 18, 2013 ShellExecute? Link to comment Share on other sites More sharing options...
MHz Posted September 18, 2013 Share Posted September 18, 2013 Hi Pomen, The menu is not such a good button to use though it does support menu items which you can add. Just create a menu item and give it the handle from the menu so it is attached to it. Then you can use the handle from the menu item to trigger the event in the loop. This will run a au3 script named test2.au3 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("Menu", 500, 500) $home = GUICtrlCreateMenu("&HOME") ; create a menu item for the script to run $run = GUICtrlCreateMenuItem("&Run a script", $home) $register = GUICtrlCreateMenu("®ISTER") $admission = GUICtrlCreateMenu("&ADMISSION") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $run ; add the name of the script into a variable $script = 'test2.au3' ; run the script Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $script & '"') EndSelect WEnd Link to comment Share on other sites More sharing options...
Pomen Posted September 18, 2013 Author Share Posted September 18, 2013 Hi Pomen, The menu is not such a good button to use though it does support menu items which you can add. Just create a menu item and give it the handle from the menu so it is attached to it. Then you can use the handle from the menu item to trigger the event in the loop. This will run a au3 script named test2.au3 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("Menu", 500, 500) $home = GUICtrlCreateMenu("&HOME") ; create a menu item for the script to run $run = GUICtrlCreateMenuItem("&Run a script", $home) $register = GUICtrlCreateMenu("®ISTER") $admission = GUICtrlCreateMenu("&ADMISSION") GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $run ; add the name of the script into a variable $script = 'test2.au3' ; run the script Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $script & '"') EndSelect WEnd i got that...but what if i want labels to be displayed within the menu page i.e. below the menu bar. den how do i do it? Link to comment Share on other sites More sharing options...
Solution MHz Posted September 19, 2013 Solution Share Posted September 19, 2013 Labels below the menu bar. Labels are quite easy to add. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("Menu", 500, 500) ; 5 labels created here GUICtrlCreateLabel('label 1', 5, 0, 100) GUICtrlCreateLabel('label 2', 105, 0, 100) GUICtrlCreateLabel('label 3', 205, 0, 100) GUICtrlCreateLabel('label 4', 305, 0, 100) GUICtrlCreateLabel('label 5', 405, 0, 100) $home = GUICtrlCreateMenu("&HOME") ; create a menu item for the script to run $run = GUICtrlCreateMenuItem("&Run a script", $home) $register = GUICtrlCreateMenu("®ISTER") $now = GUICtrlCreateMenuItem("&Now", $register) $admission = GUICtrlCreateMenu("&ADMISSION") $accept = GUICtrlCreateMenuItem("&Accept", $admission) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $run ; add the name of the script into a variable $script = 'test2.au3' ; run the script Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $script & '"') If @error Then MsgBox(0x30, 'Run a script', 'test2.au3 did not run') Case $msg = $now MsgBox(0, 'Now', 'Time to register') Case $msg = $accept MsgBox(0, 'Accept', 'I can register it now') EndSelect WEnd 5 labels for you. Link to comment Share on other sites More sharing options...
Pomen Posted September 20, 2013 Author Share Posted September 20, 2013 Labels below the menu bar. Labels are quite easy to add. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> GUICreate("Menu", 500, 500) ; 5 labels created here GUICtrlCreateLabel('label 1', 5, 0, 100) GUICtrlCreateLabel('label 2', 105, 0, 100) GUICtrlCreateLabel('label 3', 205, 0, 100) GUICtrlCreateLabel('label 4', 305, 0, 100) GUICtrlCreateLabel('label 5', 405, 0, 100) $home = GUICtrlCreateMenu("&HOME") ; create a menu item for the script to run $run = GUICtrlCreateMenuItem("&Run a script", $home) $register = GUICtrlCreateMenu("®ISTER") $now = GUICtrlCreateMenuItem("&Now", $register) $admission = GUICtrlCreateMenu("&ADMISSION") $accept = GUICtrlCreateMenuItem("&Accept", $admission) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $run ; add the name of the script into a variable $script = 'test2.au3' ; run the script Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $script & '"') If @error Then MsgBox(0x30, 'Run a script', 'test2.au3 did not run') Case $msg = $now MsgBox(0, 'Now', 'Time to register') Case $msg = $accept MsgBox(0, 'Accept', 'I can register it now') EndSelect WEnd 5 labels for you. thank u... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now