MrEd Posted June 2, 2013 Posted June 2, 2013 I am trying to create a form for selecting which VPN to use. The number of VPN's and their addresses fluctuates on a irregular basis. So I figured I could just create a 'picker' on the fly. I tried to create a test form with 10 buttons displayed in 2 columns of 5. I believe the logic is correct but the syntax is off. Local $member = 1 Local $left = 24 Local $height = 25 Local $width = 128 Local $top = 64 $Form1 = GUICreate("VPN Mega Tool", 431, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Available VPN's", 8, 16, 297, 401) While $member <= 10 ; GUICtrlCreateRadio("text",left,top[,width[,height[,style[,exStyle]]]]) ; two columns top of both 40, width of both 128, left column at 24, right column at 160 ; top to top line is 24 $radio & $member = GUICtrlCreateRadio("Button " & $member,$left,$top,$width,$height) $top = $top + 24 $member = $member + 1 If($member == 5) Then $left = 160 $top = 64 EndIf WEnd GUICtrlCreateGroup("", -99, -99, 1, 1) It throws an error at the $radio & $member line. I think it is interpreting this as NUL1 instead of $Radio1 Any pointers? Ed
water Posted June 2, 2013 Posted June 2, 2013 Could you please post the error message you get? And can you please post a working reproducer script? That makes testing much easier for us! My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Solution water Posted June 2, 2013 Solution Posted June 2, 2013 You need to store the ControlDs in an array. Something like this: #include <GUIConstantsEx.au3> Global $member = 0 Global $left = 24 Global $height = 25 Global $width = 128 Global $top = 64 $Form1 = GUICreate("VPN Mega Tool", 431, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Available VPN's", 8, 16, 297, 401) Global $Radio[10] While $member < 10 ; GUICtrlCreateRadio("text",left,top[,width[,height[,style[,exStyle]]]]) ; two columns top of both 40, width of both 128, left column at 24, right column at 160 ; top to top line is 24 $radio[$member] = GUICtrlCreateRadio("Button " & $member + 1, $left, $top, $width, $height) $top = $top + 24 $member = $member + 1 If ($member == 5) Then $left = 160 $top = 64 EndIf WEnd GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
MrEd Posted June 2, 2013 Author Posted June 2, 2013 Could you please post the error message you get? And can you please post a working reproducer script? That makes testing much easier for us! Exact error >Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3 C:\Users\Ed\Documents\AutoITscripts\selectVPNtoOpen.au3(24,9) : ERROR: syntax error It is the exact code the only thing lacking is the gui includes.
water Posted June 2, 2013 Posted June 2, 2013 Does the code I posted in #3 do what you need? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
TheSaint Posted June 2, 2013 Posted June 2, 2013 Another option you can use to join two variables, is Assign or Eval. I always forget which it is, and I can't check at the moment, but one of those does the trick. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
MrEd Posted June 2, 2013 Author Posted June 2, 2013 Yes! Thanks a million! This is my first GUI in AutoIt. Normally I just write dialog automation stuff, this is a whole new world. I tried the AutoIT 1-2-3 tutorial but it wanted the beta. I am not far enough in the curve to be playing with beta releases. I have marked it as solved and I have to check my settings, I thought I had email notifications turned on. Thanks again! Ed
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