Jump to content

auto fill a combo


Recommended Posts

hi all

is it posb to auto fil la combo from a text file can autoit do that i'm thinking i could use a FileReadLine and a set data i'm trying to get it so when i open the gui the combo is filled with the text in the file is this posb i'm not even sure i can do this or not ?

thank you

mike

Link to comment
Share on other sites

hi all

is it posb to auto fil la combo from a text file can autoit do that i'm thinking i could use a FileReadLine and a set data i'm trying to get it so when i open the gui the combo is filled with the text in the file is this posb i'm not even sure i can do this or not ?

thank you

mike

Check out this (Not tested)

Dim $array
$file = "Filename.ext"
_FileReadToArray($file,$array)
GUICtrlSetData($hControl,_ArrayToString($array))
[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]
Link to comment
Share on other sites

 Sure, you can. :D

;This part goes above the gui

$file = FileOpen("C:\list of goodies.txt", 0)
  
; Check if file opened for reading OK
  If $file = -1 Then
     MsgBox(0, "Error", "Unable to open file.")
     Exit
  EndIf
  
; Read in lines of text until the EOF is reached
  While 1
     $line = FileReadLine($file)
     If @error = -1 Then ExitLoop
      $listItems = $listItems & $line & "|"    ;Don't forget the delimiter
  WEnd
  
  FileClose($file)
  
;create your gui then set the data
  
  GUICtrlSetData(-1, $listItems)

I have a nice script that allows me to access various things on network PC's and I have multiple tabs that all read from the same txt file and display different info.

Edited by muncherw
Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
Link to comment
Share on other sites

 Sure, you can. :D

;This part goes above the gui

$file = FileOpen("C:\list of goodies.txt", 0)
  
; Check if file opened for reading OK
  If $file = -1 Then
     MsgBox(0, "Error", "Unable to open file.")
     Exit
  EndIf
  
; Read in lines of text until the EOF is reached
  While 1
     $line = FileReadLine($file)
     If @error = -1 Then ExitLoop
      $listItems = $listItems & $line & "|"    ;Don't forget the delimiter
  WEnd

  
  FileClose($file)
  
;create your gui then set the data
  
  GUICtrlSetData(-1, $listItems)

I have a nice script that allows me to access various things on network PC's and I have multiple tabs that all read from the same txt file and display different info.

thank you i got it to work man was that hard for me to fig out for some reson i thought the GUICtrlSetData($Input_9,$listItems) had to be inside the loop but it

thanks for helping me pull that off :D

thank you to colafrysen

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...