Hi all,
I wrote a little script intended to show up a GUI with a list you can select a program to load from.
The problem is that the selected program, once loaded, is heavily slowed down so the script must be "heavy" while running in the background...
here is the code:
I am not a coder so there should be something of macroscopic i cannot see...![:sweating:]()
If you have some idea on how to improve this "badly-drawn-boy" please tell me
Thanks for the help!
I wrote a little script intended to show up a GUI with a list you can select a program to load from.
The problem is that the selected program, once loaded, is heavily slowed down so the script must be "heavy" while running in the background...
here is the code:
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIScrollbars_Ex.au3" #include <GuiListView.au3> #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") Local $hGUI $hGUI = GUICreate("Select Program To Run", 250, 150,-1,-1,$WS_POPUP+$WS_BORDER) GUISetBkColor(0x3790e8) $listview = GUICtrlCreateListView("Select Program - press 1 to Run", 0, 0, 250,150, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetColumnWidth($listview, 0, 245) GUICtrlSetBkColor(-1,0x3790e8) $P1= GUICtrlCreateListViewItem("Program #1", $listview); ID 4 GUICtrlSetColor (-1, 0xFFFFFF) $P2= GUICtrlCreateListViewItem("Program #2", $listview); ID 5 GUICtrlSetColor (-1, 0xFFFFFF) $P3= GUICtrlCreateListViewItem("Program #3", $listview); ID 6 GUICtrlSetColor (-1, 0xFFFFFF) $win= GUICtrlCreateListViewItem("Exit to Windows", $listview); ID 7 GUICtrlSetColor (-1, 0xFFFFFF) $shutdown= GUICtrlCreateListViewItem("Shut Down PC", $listview); ID 8 GUICtrlSetColor (-1, 0xFFFFFF) GUISetState(@SW_SHOW) ;shows the gui/menu/list While 1 $GUIlistitem = GUICtrlRead($listView); reads the ID of the selected item in the list ;SplashTextOn ( "title", $GUIlistitem) if Not (ProcessExists("P1.exe") Or ProcessExists("P2.exe") Or ProcessExists("P3.exe")) Then If $GUIlistitem==4 And _IsPressed(31) Then ;31 -> Key 1 RunWait("C:/Programs/P1.exe") nocycle() EndIf If $GUIlistitem==5 And _IsPressed(31) Then ;31 -> Key 1 RunWait("C:/Programs/P2.exe") nocycle() EndIf If $GUIlistitem==6 And _IsPressed(31) Then ;31 -> Key 1 RunWait("C:/Programs/P3.exe") nocycle() EndIf If $GUIlistitem==7 And _IsPressed(31) Then ;31 -> Key 1 Exit nocycle() EndIf If $GUIlistitem==8 And _IsPressed(31) Then ;31 -> Key 1 Shutdown(1) nocycle() EndIf Sleep(200) EndIf WEnd Func nocycle() While _IsPressed(31, $hDLL) Sleep(500) WEnd EndFunc DllClose($hDLL)
I am not a coder so there should be something of macroscopic i cannot see...
![:sweating:](http://aut1.autoit-cdn.com/forum/public/style_emoticons/default/sweating.gif)
If you have some idea on how to improve this "badly-drawn-boy" please tell me
Thanks for the help!