pcjunki Posted December 27, 2018 Share Posted December 27, 2018 i'm editing a gui that has hard coded computer names in my autoit script, i'm now migrating to using txt files, so my gui will read txt files that contain the computer names. when i run my script, everything is in one line, and not showing how it is in the txt file, here is an example of my code file.txt pc1 pc2 pc3 and my autoit script... Case $Radio1 $Readfloor1 = FileRead("c:\file.txt") GUICtrlSetData($input1,$Readfloor1,1) Link to comment Share on other sites More sharing options...
water Posted December 27, 2018 Share Posted December 27, 2018 You need to provide more information! For what type of Control do you want to set the data? Input, Combo ...? 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 Link to comment Share on other sites More sharing options...
pcjunki Posted December 27, 2018 Author Share Posted December 27, 2018 (edited) sorry, i'm using combo $input1 = GUICtrlCreateCombo("", 216, 92, 233, 25, BitOR($CBS_DROPDOWN, $WS_VSCROLL)) Edited December 27, 2018 by pcjunki Link to comment Share on other sites More sharing options...
Skysnake Posted December 27, 2018 Share Posted December 27, 2018 You will need to parse the file content. You need to add "|" between the items read from the file. Think of it like this At the moment you are giving data to the combo like "pc1 pc2 pc3" which is technically a single line for the combo. What you want to do is make the data look like this "pc1|pc2|pc3" which will create separate items, leading to a display of pc1 pc2 pc3 Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
water Posted December 27, 2018 Share Posted December 27, 2018 According to the help file for GuiCtrlSetData you need to pass a list of values separated with the GUIDataSeparatorChar which is "|" by default. 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 Link to comment Share on other sites More sharing options...
water Posted December 27, 2018 Share Posted December 27, 2018 Use GUICtrlSetData($input1, StringReplace($Readfloor1, @CRLF, "|"),1) Skysnake 1 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 Link to comment Share on other sites More sharing options...
pcjunki Posted December 27, 2018 Author Share Posted December 27, 2018 i totally forgot about using "|" since that's what i have in my code to begin with...doh! @water when i use your code, it works, but there is a space between the computer names, and i have to scroll more (whines like a baby) GUICtrlSetData($input1, StringReplace($Readfloor1, @CRLF, "|"),1) Link to comment Share on other sites More sharing options...
pcjunki Posted December 27, 2018 Author Share Posted December 27, 2018 i got it, i took the "|" out of the txt files everything is working, thanks skysnake and water Link to comment Share on other sites More sharing options...
Skysnake Posted December 27, 2018 Share Posted December 27, 2018 Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
TurionAltec Posted December 29, 2018 Share Posted December 29, 2018 When reading configurations from a file, you may want to look at using .ini files. Built in functions like IniRead make it a breeze to handle 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