<https://www.autoitscript.com/forum/topic/151114-need-some-help-setting-guictrls-to-variables/>
<http://schema.org/text>
"OK, so please, please, please bear with me... Today is LITERALLY the first day I've ever messed with AutoIt. I had heard about it, never used it. I'm not a programmer, I'm a small time web developer (meaning I know CSS, HTML, and barely enough PHP to get by), so the theory and structure is familiar...-ish.... \n\nI've got just about everything down pat with my little script... it's design is to take user input and generate a file and then launch Outlook with the ImportPRF switch importing that file into the existing Outlook profile (eliminating the need to create another POP3 account, since my organization disables PST files by GPO). \n\nI've got everything set up right (I think), but when I do this: \n\nfilewrite(\"C:\\Temp\\File.txt\", $string &amp; @CRLF)\nfilewrite(\"C:\\Temp\\File.txt\", $another-string &amp; @CRLF)\nfilewrite(\"C:\\Temp\\File.txt\", $a-third-string &amp; @CRLF)\n\nI do not get the anticipated values of the strings.... In fact, the only string that behaves as it should is the one I set manually with an If-ElseIf-Then statement. \n\nWhat I want it to do (and it's very clearly commented) is this:  \nit opens, if outlook is open, closes it. it asks 2 questions (the answers are to be set as strings), one is a text box, one is a radio selection. It finds the path of Outlook.exe and sets that as $path. \n\nThen, a user clicks the big, obnoxiously obvious button and it sets the answers as strings, outputs some manual text and the string answers to file, and launches: \n  \n\n$path\\outlook.exe /importprf C:\\Temp\\outputted_text.txt    ;---obviously better coded in the script\n\nI just dont know how to do it. I've Google'd my brains out trying to find the answer, but it's just way more complicated than I can do... \n\nAny help guys??? \n\nHere's my complete source:  \n  \n\n#include &lt;GUIConstantsEx.au3&gt;\n\n;---Create the gui layout and brand it as such\n\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) \nGUISetState(@SW_SHOW)\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\n;---Start polling for information...\n   ;---Text input\n\nGUISetFont(12, 400)\nGUICtrlCreateLabel(\"Please enter your voicemail extension:\", 35, 155)\n$voiceMail = GUICtrlCreateInput(\"\", 310, 153, 75, 25)\n\n   ;---Radio Buttons!!!\n\nGUICtrlCreateLabel(\"Choose your VoiceMail server:\", 35, 188)\n$svrRadio = GUICtrlCreateRadio(\"CHG\", 265, 185)\n$svrRadio = GUICtrlCreateRadio(\"DAL\", 265, 215)\n\n;---Now, let's see what our working directory will be...\n\nIf FileExists(\"C:\\Program Files (x86)\\Microsoft Office\\Office14\\outlook.exe\") Then\n   GUISetFont(12, 600)\n   dim $path = \"C:\\Program Files (x86)\\Microsoft Office\\Office14\"\n   GUICtrlCreateLabel(\"Detected 32 bit Outlook 2010 on 64 bit Windows\", 35, 270)\n   GUICtrlSetColor(-1, 0x0000fA)\n   \n\t  ElseIf FileExists(\"C:\\Program Files\\Microsoft Office\\Office14\\outlook.exe\") Then\n\t\t GUISetFont(12, 600)\n\t\t dim $path = \"C:\\Program Files\\Microsoft Office\\Office14\"\n\t\t GUICtrlCreateLabel(\"Detected 32/64 bit Outlook 2010 on 32/64 bit Windows\", 35, 270)\n\t\t \n\t\t\tElseIf FileExists(\"C:\\Program Files (x86)\\Microsoft Office 15\\root\\office15\\outlook.exe\") Then\n\t\t\t   GUISetFont(12, 600)\n\t\t\t   dim $path = \"C:\\Program Files (x86)\\Microsoft Office 15\\root\\office15\"\n\t\t\t   GUICtrlCreateLabel(\"Detected 32 bit Outlook 2013 on 64 bit Windows\", 35, 270)\n\t\t\t   \n\t\t\t\t  ElseIf FileExists(\"C:\\Program Files\\Microsoft Office 15\\root\\office15\\outlook.exe\") Then\n\t\t\t\t\t GUISetFont(12, 600)\n\t\t\t\t\t dim $path = \"C:\\Program Files\\Microsoft Office 15\\root\\office15\"\n\t\t\t\t\t GUICtrlCreateLabel(\"Detected 32/64 bit Outlook 2013 on 32/64 bit Windows\", 35, 270)\n\n\n;---Just in case the user has Office installed in a non %programfiles% location\n\t\t\t\t\t \n\t\t\t\t  Else \n\t\t\t\t\t GUISetFont(14, 900)\n\t\t\t\t\t GUICtrlCreateLabel(\"Unable to detect installed Windows/Outlook version.\", 35, 270)\n\t\t\t\t\t GUICtrlSetColor(-1, 0xff0000)\n\t\t\t\t\t GUISetFont(12, 400)\n\t\t\t\t\t GUICtrlCreateLabel(\"Please copy and paste the path that contains outlook.exe in the box below.\", 35, 300)\n\t\t\t\t\t $path = GUICtrlCreateInput(\"\", 35, 320, 535, 25)\nEndIf\n\n;---Let them know what it is we're running (like they really care...)\n\nIf IsDeclared($path) Then\n   GUICtrlCreateLabel(\"Executing \" &amp; $path &amp; \"\\outlook.exe\", 35, 360)\n   GUICtrlCreateLabel(\" /importprf c:\\temp\\voicemail.txt\", 45, 390)\nEndIf\n\n;---Make sure they've never tried the migration before. And if they have, KILL IT WITH FIRE!!!\n\nIf FileExists(\"C:\\Temp\\Voicemail.txt\") Then\n   GUICtrlCreateLabel(\"Deleting previously used Migration Settings\", 45, 400)\n   FileDelete(\"C:\\Temp\\Voicemail.txt\")\nEndIf\n\n;---Pretty, pretty button. Once clicked, it SHOULD set all the selections to their assigned strings and then execute the command\n\nGUICtrlCreateButton('  Click Here to Migrate Your Voicemail  ', 146, 550)\n\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\n   \nIf ProcessExists('outlook.exe') Then\n\t  $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.')\n\t  ProcessClose('outlook.exe')\n\t  Sleep(2000)\n\t\t If Not ProcessExists('outlook.exe') Then\n\t\t\tGUISetFont(13, 800)\n\t\t\tGUICtrlCreateLabel(\"Outlook is not running. We may continue.\", 140, 100)\n\t\t\tGUICtrlSetColor(-1, 0x00af00)\n\t\t Else\n\t\t\t\n\t\t\tGUISetFont(13, 800)\n\t\t\tGUICtrlCreateLabel(\"Unable to close Outlook. Quitting in 10 seconds.\", 110, 100)\n\t\t\tGUICtrlSetColor(-1, 0xff0000)\n\t\t\tSleep(10000)\n\t\t\tExit\n\t\t EndIf\n   Else\n\t  GUISetFont(13, 800)\n\t  GUICtrlCreateLabel(\"Outlook is not running. We may continue.\", 140, 100)\n\t  GUICtrlSetColor(-1, 0x00af00)\n   EndIf\n\n;---This is what we want to execute AFTER the strings have been set upon button pressing\n\nFileWrite(\"c:\\temp\\migrate_voicemail.txt\", \"some things here:\" &amp; $voicemail &amp; @CRLF)\nFileWrite(\"c:\\temp\\migrate_voicemail.txt\", \"some more things here:\" &amp; $chgRadio &amp; @CRLF)\nFileWrite(\"c:\\temp\\migrate_voicemail.txt\", \"even more things here:\" &amp; $dalRadio &amp; @CRLF)\n\n;---Launches Outlook and imports our generated text file into the already existing Outlook profile, eliminating the need for a 2nd profile/PST\n\nRun(@comspec &amp; ' c/ start' &amp; '\"' &amp; $path &amp; '\\outlook.exe /importpfr c:\\temp\\migrage_voicemail' &amp; \"'\", @SW_HIDE)\n\n;---The following part seemed pretty important in the tutorial, so I'm going to leave it here....\n\nWhile 1\n   $msg = GUIGetMsg()\n   \n   ;---I think this allows you to close the window using the little red 'X'...\n   \n   Select\n\t  Case $msg = $GUI_EVENT_CLOSE\n\t\t ExitLoop\n   EndSelect\nWEnd\n\n\nAnd a screenshot of how it looks  \n\n \n\nAny help would be appreciative... \n"
<https://www.autoitscript.com/forum/topic/151114-need-some-help-setting-guictrls-to-variables/?tab=comments#comment-1081388>