_:n922ccf39cebe4b1a847922f6498a5272xb0
<http://schema.org/text>
"You're reading the state of the checkbox before the user even sees it, and then you're not reading it ever again. So that means that whatever the user clicks on won't make any difference because it's not being seen.  Plus, because it's being read before anyone clicks on it, the $svr variable won't ever get a value, because neither of them are 1 when you do the GUICtrlRead. \n\nI'm not 100% sure this is how you want it, but this should be closer to what you're trying to get to. \n #include &lt;GUIConstantsEx.au3&gt;\nGlobal $voiceMail, $svrRadio[2], $svr, $path, $button, $alert\n;---Create the gui layout and brand it as such\nGUICreate(\"Voicemail to Outlook 2010 Migration Tool\", 600, 600)\nGUISetIcon(\"C:\\Apps\\mhk.ico\")\nGUICtrlCreatePic(\"C:\\Apps\\mhk.jpg\", 20, 20, 100, 100)\nGUICtrlCreatePic(\"C:\\Apps\\mhk.jpg\", 480, 20, 100, 100)\nGUISetBkColor(0xffffff)\nGUISetFont(15, 800)\nGUICtrlCreateLabel(\"Voicemail Migration Tool\", 180, 25)\nGUISetFont(12, 400)\nGUICtrlCreateLabel(\"This allows users to setup Outlook 2010\", 160, 60)\nGUICtrlCreateLabel(\"to receive voicemails in their inbox.\", 180, 75)\nGUICtrlCreateLabel(\"________________________________________________________\", 50, 120)\n;---Start polling for information...\n;---Text input\nGUISetFont(12, 400)\nGUICtrlCreateLabel(\"Please enter your voicemail extension:\", 35, 155)\n$voiceMail = GUICtrlCreateInput(\"\", 310, 153, 75, 25)\n;---Radio Buttons!!!\nGUICtrlCreateLabel(\"Choose your VoiceMail server:\", 35, 188)\n$svrRadio[0] = GUICtrlCreateRadio(\"CHG\", 265, 185)\n$svrRadio[1] = GUICtrlCreateRadio(\"DAL\", 265, 215)\n\n;---Now, let's see what our working directory will be...\nGlobal $path = \"\"\nIf FileExists(\"C:\\Program Files (x86)\\Microsoft Office\\Office14\\outlook.exe\") Then\nGUISetFont(12, 600)\n$path = \"C:\\Program Files (x86)\\Microsoft Office\\Office14\"\nGUICtrlCreateLabel(\"Detected 32 bit Outlook 2010 on 64 bit Windows\", 35, 270)\nGUICtrlSetColor(-1, 0x0000fA)\nElseIf FileExists(\"C:\\Program Files\\Microsoft Office\\Office14\\outlook.exe\") Then\nGUISetFont(12, 600)\n$path = \"C:\\Program Files\\Microsoft Office\\Office14\"\nGUICtrlCreateLabel(\"Detected 32/64 bit Outlook 2010 on 32/64 bit Windows\", 35, 270)\nElseIf FileExists(\"C:\\Program Files (x86)\\Microsoft Office 15\\root\\office15\\outlook.exe\") Then\nGUISetFont(12, 600)\n$path = \"C:\\Program Files (x86)\\Microsoft Office 15\\root\\office15\"\nGUICtrlCreateLabel(\"Detected 32 bit Outlook 2013 on 64 bit Windows\", 35, 270)\nElseIf FileExists(\"C:\\Program Files\\Microsoft Office 15\\root\\office15\\outlook.exe\") Then\nGUISetFont(12, 600)\n$path = \"C:\\Program Files\\Microsoft Office 15\\root\\office15\"\nGUICtrlCreateLabel(\"Detected 32/64 bit Outlook 2013 on 32/64 bit Windows\", 35, 270)\n\n;---Just in case the user has Office installed in a non %programfiles% location\nElse\nGUISetFont(14, 900)\nGUICtrlCreateLabel(\"Unable to detect installed Windows/Outlook version.\", 35, 270)\nGUICtrlSetColor(-1, 0xff0000)\nGUISetFont(12, 400)\nGUICtrlCreateLabel(\"Please copy and paste the path that contains outlook.exe in the box below.\", 35, 300)\n$path = InputBox(\"\", \"Please copy and paste the path that contains outlook.exe in the box below.\")\nEndIf\n;---Let them know what it is we're running (like they really care...)\nIf $path &lt;&gt; \"\" Then\nGUICtrlCreateLabel(\"Executing \" &amp; $path &amp; \"\\outlook.exe\", 35, 360)\nGUICtrlCreateLabel(\" /importprf c:\\temp\\voicemail.txt\", 45, 390)\nEndIf\n\n;---Pretty, pretty button. Once clicked, it SHOULD set all the selections to their assigned strings and then execute the command\n$button = GUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)\nGUISetFont(7, 400)\nGUICtrlCreateLabel(\"© 2013 [My Company]. All Rights Reserved.\", 190, 587)\nGUISetState(@SW_SHOW)\n;--This alerts whether Outlook is actively running or not and kills it if it is.\n;---It appears at the top, but was loading before all the other stuff, and it didn't look as neat that way\nIf ProcessExists('outlook.exe') Then\n$outlook_open = MsgBox(0, 'Outlook is still running!', 'Press Ok to close Outlook automatically. You may save any open documents that you have before clicking OK.')\nProcessClose('outlook.exe')\n;---It was taking a second or so for ProcessClose to close Outlook and was thusly still seeing the Outlook process\n;-running and forcing the script to close. Making it wait 2 seconds before continuing is the obvious fix :P\nSleep(2000)\nIf Not ProcessExists('outlook.exe') Then\n  GUISetFont(13, 800)\n  GUICtrlCreateLabel(\"Outlook is not running. We may continue.\", 140, 100)\n  GUICtrlSetColor(-1, 0x00af00)\nElse\n  GUISetFont(13, 800)\n  GUICtrlCreateLabel(\"Unable to close Outlook. Quitting in 10 seconds.\", 110, 100)\n  GUICtrlSetColor(-1, 0xff0000)\n  Sleep(10000)\n  Exit\nEndIf\nElse\nGUISetFont(13, 800)\nGUICtrlCreateLabel(\"Outlook is not running. We may continue.\", 140, 100)\nGUICtrlSetColor(-1, 0x00af00)\nEndIf\n;---The following part seemed pretty important in the tutorial, so I'm going to leave it here....\nGlobal $hFile, $hFile2\nWhile 1\n$msg = GUIGetMsg()\nSelect\n  Case $msg = $GUI_EVENT_CLOSE\n   ExitLoop\n  Case $msg = $button\n   ;---Make sure they've never tried the migration before. And if they have, KILL IT WITH FIRE!!!\n   If GUICtrlRead($svrRadio[0]) = 1 Then\n    $svr = \"IP_address_1\"\n   ElseIf GUICtrlRead($svrRadio[1]) = 1 Then\n    $svr = \"IP_Address_2\"\n   EndIf\n   ;If FileExists($hFile) Then\n   ;GUICtrlCreateLabel(\"Deleting previously used Migration Settings\", 45, 400)\n   ;FileDelete($hFile)\n   ;EndIf\n            $hFile = FileOpen(\"C:\\Temp\\voicemail.txt\", 2)\n   FileWriteLine($hFile, \"$voiceMail: \" &amp;$voiceMail &amp; @CRLF)\n   FileWriteLine($hFile, \"$svrRadio[0]: \" &amp; $svrRadio[0] &amp; @CRLF)\n   FileWriteLine($hFile, \"$svrRadio[1]: \" &amp; $svrRadio[1] &amp; @CRLF)\n   FileWriteLine($hFile, \"$path: \" &amp; $path &amp; @CRLF)\n   FileWriteLine($hFile, \"$svr: \" &amp; $svr &amp; @CRLF)\n   FileWriteLine($hFile, @CRLF)\n            FileClose($hFile)\n            $hFile2 = FileOpen(\"C:\\Temp\\voicemail2.txt\", 2)\n   FileWriteLine($hFile2, \"$voiceMail:\" &amp; GUICtrlRead($voiceMail) &amp; @CRLF)\n   FileWriteLine($hFile2, \"$svrRadio[0]:\" &amp; GUICtrlRead($svrRadio[0]) &amp; @CRLF)\n   FileWriteLine($hFile2, \"$svrRadio[1]:\" &amp; GUICtrlRead($svrRadio[1]) &amp; @CRLF)\n   FileWriteLine($hFile2, \"$path:\" &amp; $path &amp; @CRLF)\n   FileWriteLine($hFile2, \"$svr:\" &amp; $svr &amp; @CRLF)\n   FileWriteLine($hFile2, @CRLF)\n            FileClose($hFile2)\n   ;Run(@comspec &amp; ' c/ start' &amp; '\"' &amp; $path &amp; '\\outlook.exe /importpfr C:\\Temp\\File.text' &amp; \"'\", @SW_HIDE)\n   $alert = MsgBox(0, \"Message\", 'Your outlook should launch and prompt for your voicemail password.')\n  Case $msg = $alert\n   ;Exit\nEndSelect\nWEnd\n"
<https://www.autoitscript.com/forum/topic/151114-need-some-help-setting-guictrls-to-variables/?tab=comments#comment-1081388>