swstrau118 Posted March 29, 2013 Share Posted March 29, 2013 I am trying to get the buttons to open up notepad or how to open up a file in a network drive.. Please help!! Here is the code expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ComboConstants.au3> __steam_window('STEAM - username', 1000, 600) ; WIDTH NOT SMALLER THEN 400 | HEIGHT NOT SMALLER THEN 200 === TRUST ME Func __steam_window($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT) Local $oWINDOW = GUICreate($sWINDOW_TITLE, $iWINDOW_WIDTH, $iWINDOW_HEIGHT, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU, $WS_MINIMIZEBOX), $WS_EX_LAYERED) ; BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED)) GUISetFont(8, 400, 0, 'Tahoma') GUISetBkColor(0x494E49) GUICtrlCreatePic('hdr.bmp', 0, 0, $iWINDOW_WIDTH - 16, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 0, 11, 5, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 16, 16, 11, 4, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreatePic('hdr.bmp', $iWINDOW_WIDTH - 5, 0, 5, 20, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreateGraphic(0, 20, 1, $iWINDOW_HEIGHT) GUICtrlSetColor(-1, 0x686A65) GUICtrlCreateGraphic($iWINDOW_WIDTH - 1, 20, 1, $iWINDOW_HEIGHT) GUICtrlSetColor(-1, 0x686A65) GUICtrlCreateGraphic(0, $iWINDOW_HEIGHT - 1, $iWINDOW_WIDTH, 1) GUICtrlSetColor(-1, 0x686A65) Local $oCLOSE = GUICtrlCreatePic('cls.bmp', $iWINDOW_WIDTH - 16, 5, 11, 11, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) Local $oLABELHEADER = GUICtrlCreateLabel($sWINDOW_TITLE, 6, 0, $iWINDOW_WIDTH - 22, 20, $SS_CENTERIMAGE) GUICtrlSetColor(-1, 0xD8DED3) GUICtrlSetBkColor(-1, 0x5A6A50) #cs ============================== EXAMPLE SECTION ================== #ce ============================== Local $oBUTTON_1 = GUICtrlCreateButton('Button 1', 10, 30, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') Local $oBUTTON_2 = GUICtrlCreateButton('Button 2', 10, 60, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') Local $oBUTTON_3 = GUICtrlCreateButton('Button 3', 10, 90, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') Local $oBUTTON_4 = GUICtrlCreateButton('Button 4', 10, 120, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') Local $oBUTTON_5 = GUICtrlCreateButton('Button 5', 10, 150, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') GUICtrlCreateGraphic(1, 20, 160, $iWINDOW_HEIGHT - 21) GUICtrlSetColor(-1, 0x464646) GUICtrlSetBkColor(-1, 0x464646) GUICtrlCreateGraphic(158, 20, 1, $iWINDOW_HEIGHT - 21) GUICtrlSetColor(-1, 0x3D423D) GUICtrlCreateGraphic(159, 20, 1, $iWINDOW_HEIGHT - 21) GUICtrlSetColor(-1, 0x424742) GUICtrlCreateGraphic(160, 20, 1, $iWINDOW_HEIGHT - 21) GUICtrlSetColor(-1, 0x454A45) $oLABELTOP = GUICtrlCreateLabel('HEADER TEXT', 180, 31, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) GUICtrlCreateGraphic(170, 51, $iWINDOW_WIDTH - 180, 1) GUICtrlSetColor(-1, 0x636763) GUICtrlCreateTab(180, 60, 800, 20) GUICtrlCreateTabItem("Global Information Services") GUICtrlCreateLabel('input control', 190, 100, 100, 20, BitOR($SS_RIGHT,$SS_CENTERIMAGE)) GUICtrlSetColor(-1, 0xE6ECE0) GUICtrlCreateInput('', 300, 100, 200, 20) ;Tab for DR call information First Line======================================= GUICtrlCreateTabItem("DR Call Information") GUICtrlCreateLabel('DR Call Numbers:', 180, 120, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 11, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) GUICtrlCreateLabel('Event Bridge First Line: (xxx) xxx-xxxx', 180,140, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) GUICtrlCreateLabel('Access Code: xxxxxxxx', 180,155, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) GUICtrlCreateLabel('Host Password: xxxx', 180,168, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) ;================================================================== ;Tab for DR call information Second Line======================================= GUICtrlCreateLabel('Event Bridge Second Line: (xxx) xxx-xxxx', 180,200, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) GUICtrlCreateLabel('Access Code: xxxxxxxx', 180,215, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) GUICtrlCreateLabel('Host Password: xxxx', 180,230, $iWINDOW_WIDTH - 200, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, 'Tahoma') GUICtrlSetColor(-1, 0xC4B550) ;================================================================== GUICtrlCreateGraphic(170, 30, $iWINDOW_WIDTH - 180, $iWINDOW_HEIGHT - 40) ; THIS CONTROL NEEDS TO BE LAST DUE TO OVERLAY ISSUES GUICtrlSetColor(-1, 0x686A65) #cs ============================== EXAMPLE SECTION ================== #ce ============================== GUICtrlCreatePic('cnr.bmp', 0, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, 0, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreatePic('cnr.bmp', 0, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUICtrlCreatePic('cnr.bmp', $iWINDOW_WIDTH - 1, $iWINDOW_HEIGHT - 1, 1, 1, $SS_NOTIFY, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) While 1 Local $eMSG = GUIGetMsg() Switch $eMSG Case $GUI_EVENT_CLOSE Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS) Sleep(10) Next Exit Case $oCLOSE Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS) Sleep(10) Next Exit EndSwitch WEnd EndFunc Link to comment Share on other sites More sharing options...
BrewManNH Posted March 29, 2013 Share Posted March 29, 2013 You're not looking to see if the buttons are being clicked in your While loop, check the help file for the GUICtrlCreateButton function for how to do that. BTW, please don't discuss anything to do with game interaction as far as this script goes. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
swstrau118 Posted March 29, 2013 Author Share Posted March 29, 2013 Thank, I took a look at the GuiCtrlCreateButton function and I put the function into the While loop. When I do that Notepad opens up multiple instances to where It locks up my computer. Any other ideas? Below is what my code with revised changes. Also I don't do anything with game interaction - I'm trying to create a Gui I can use to call different programs (excel spread sheet etc.. as well as displaying information on the Gui such as what's currently on the DR Information tab in the GUI. I found this GUI and really liked the format.. just trying to get the buttons to work.. Thanks for your help so far! This is the code for the buttons to declare GuiCoorMode Opt("GUICoordMode", 2) Local $oBUTTON_1 = GUICtrlCreateButton('Button 1', 10, 30, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') Local $oBUTTON_2 = GUICtrlCreateButton('Button 2', 10, 60, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') Local $oBUTTON_3 = GUICtrlCreateButton('Button 3', 10, 90, 140, 20) GUICtrlSetFont(-1, 8, 800, 0, 'Tahoma') This is the code for the While Loop with revised changes While 1 Local $eMSG = GUIGetMsg() Switch $eMSG Case $GUI_EVENT_CLOSE ExitLoop Case $eMSG = $oBUTTON_1 Run ("notepad.exe") Case $eMSG = $oBUTTON_2 MsgBox(0, 'Testing', 'Button 2 was pressed') Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS) Sleep(10) Next Exit Case $oCLOSE Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS) Sleep(10) Next Exit EndSwitch WEnd EndFunc Link to comment Share on other sites More sharing options...
BrewManNH Posted March 29, 2013 Share Posted March 29, 2013 You're mixing the syntax for Switch and Select in that last bit of code. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
swstrau118 Posted March 29, 2013 Author Share Posted March 29, 2013 (edited) I changed the syntax from switch to select and I'm getting a few errors. They are: Ref: missing wend, Error: syntax error and Error: missing wend) I put them below to where they are showing up in the code. While 1 ~REF: missing Wed Local $eMSG = GUIGetMsg() Select $eMSG ~ERROR: Syntax Error Case $GUI_EVENT_CLOSE ~ERROR: missing Wend ExitLoop Case $eMSG = $oBUTTON_1 Run ("notepad.exe") Case $eMSG = $oBUTTON_2 MsgBox(0, 'Testing', 'Button 2 was pressed') Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS) Sleep(10) Next Exit Case $oCLOSE Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW,'',$iWINDOW_TRANS) Sleep(10) Next Exit EndSelect WEnd EndFunc Edited March 29, 2013 by swstrau118 Link to comment Share on other sites More sharing options...
BrewManNH Posted March 29, 2013 Share Posted March 29, 2013 (edited) Once again, you're mixing syntax. Select and Switch use different syntax when comparing values. ; Using Select While 1 Local $eMSG = GUIGetMsg() Select Case $eMSG = $GUI_EVENT_CLOSE ExitLoop Case $eMSG = $oBUTTON_1 Run("notepad.exe") Case $eMSG = $oBUTTON_2 MsgBox(0, 'Testing', 'Button 2 was pressed') Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW, '', $iWINDOW_TRANS) Sleep(10) Next Exit Case $eMSG = $oCLOSE Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW, '', $iWINDOW_TRANS) Sleep(10) Next Exit EndSelect WEnd Or: ; Using Switch While 1 Local $eMSG = GUIGetMsg() Switch $eMSG Case $GUI_EVENT_CLOSE ExitLoop Case $oBUTTON_1 Run("notepad.exe") Case $oBUTTON_2 MsgBox(0, 'Testing', 'Button 2 was pressed') Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW, '', $iWINDOW_TRANS) Sleep(10) Next Exit Case $eMSG = $oCLOSE Local $iWINDOW_TRANS For $iWINDOW_TRANS = 255 To 0 Step -10 If $iWINDOW_TRANS > 0 Then WinSetTrans($oWINDOW, '', $iWINDOW_TRANS) Sleep(10) Next Exit EndSwitch WEnd Edited March 29, 2013 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
swstrau118 Posted April 2, 2013 Author Share Posted April 2, 2013 It's working now - I appreciate the help!! 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