iverson_est Posted July 28, 2009 Share Posted July 28, 2009 Hey! Can i make somehow the GUICtrlCreateEdit text field read a variable. I want to make it read from an ini file or txt file. Basically an idea would be smthing like that $file = FileOpen("test.txt", 0) $chars = FileRead($file) GUICtrlCreateEdit ( $chars, etc... ) But the text field reads the $ as a normal letter. I am quick learner, if you help me ;D The helpfile was quite chinese for me. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 28, 2009 Moderators Share Posted July 28, 2009 iverson_est,You were pretty close, but you also need a GUI to display the edit control:#include <GUIConstantsEx.au3> $sString = FileRead(@ScriptFullPath) GUICreate("Test", 500, 500) GUICtrlCreateEdit($sString, 10, 10, 300, 300) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndReading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously - it is not that difficult, certainly easier than Chinese (unless you are Chinese of course!). You might also want look at the excellent tutorials that you will find here and here.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iverson_est Posted July 28, 2009 Author Share Posted July 28, 2009 Thank you! I am not a total noobie, tho I had the GUI and everything. My original script was like that: GuiCreate("Sample GUI", 400, 400) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) Local $vari= FileRead( "test.txt") GuiCtrlCreateEdit("$vari", 10, 110, 150, 70) GuiCtrlCreateDate("", 5, 280, 200, 20) GuiCtrlCreateLabel("(Date control expands into a calendar)", 10, 305, 200, 20) GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd I had not included the <GUIConstantsEx.au3> and variable was in "". Got it solved for now, thank you >_< Link to comment Share on other sites More sharing options...
UnknownWarrior Posted July 29, 2009 Share Posted July 29, 2009 I got a question kind of related to this... Is there anyway to 'GuiCtrlRead($EditLINE)'.... What I mean by that, read line by line in an Edit (Or even better, I would like to read line by line in a List, but seems as though you have to click on the item in there to get its value).... But yea, kinda like FileReadLine, but somehow read each line in the Edit? O.O Link to comment Share on other sites More sharing options...
GEOSoft Posted July 29, 2009 Share Posted July 29, 2009 (edited) I got a question kind of related to this... Is there anyway to 'GuiCtrlRead($EditLINE)'.... What I mean by that, read line by line in an Edit (Or even better, I would like to read line by line in a List, but seems as though you have to click on the item in there to get its value).... But yea, kinda like FileReadLine, but somehow read each line in the Edit? O.O $iCount = ControlCommand($title, "", $myedit, "GetLineCount", "") For $i = 0 to $iCount ;; This might have to be 1 To $iCount $sResult = ControlCommand($title, "", $myedit, "GetLine", $i) MsgBox(0, "Result", $sResult, 3) Next EDIT: Or #Include <GuiEdit.au3> $iCount = _GUICtrlEdit_GetLineCount($myedit) For $i = 0 to $iCount ;; This might have to be 1 To $iCount $sResult = _GUICtrlEdit_GetLine($myedit, $i) MsgBox(0, "Result", $sResult, 3) Next EDIT 2: Corrected above code. If you need it, getting the text for a list is just as simple. #include<GUIListBox.au3> $iCount = _GUICtrlListBox_GetCount($myedit) For $i = 0 To $icount $sResult = _GUICtrlListBox_GetText($myEdit, $i) MsgBox(0, "Result", $sResult, 3) Next Edited July 29, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
UnknownWarrior Posted July 29, 2009 Share Posted July 29, 2009 $iCount = ControlCommand($title, "", $myedit, "GetLineCount", "") For $i = 0 to $iCount ;; This might have to be 1 To $iCount $sResult = ControlCommand($title, "", $myedit, "GetLine", $i) MsgBox(0, "Result", $sResult, 3) Next EDIT: Or #Include <GuiEdit.au3> $iCount = _GUICtrlEdit_GetLineCount($myedit) For $i = 0 to $iCount ;; This might have to be 1 To $iCount $sResult = _GUICtrlEdit_GetLine($myedit, $i) MsgBox(0, "Result", $sResult, 3) Next EDIT 2: Corrected above code. If you need it, getting the text for a list is just as simple. #include<GUIListBox.au3> $iCount = _GUICtrlListBox_GetCount($myedit) For $i = 0 To $icount $sResult = _GUICtrlListBox_GetText($myEdit, $i) MsgBox(0, "Result", $sResult, 3) Next Aha, did not see that functions, thank you very much >_<. I suppose theres no hiding function (from me xD) that reads lines of a List? :S Link to comment Share on other sites More sharing options...
GEOSoft Posted July 29, 2009 Share Posted July 29, 2009 Aha, did not see that functions, thank you very much >_< . I suppose theres no hiding function (from me xD) that reads lines of a List? :SWell if you are talking about a list control as in GUICtrlCreateList(), that's what the 3rd block of code does. If you are talking about a list as in GUICtrlCreateListView() there is a ListView UDF in the help file too. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
UnknownWarrior Posted July 29, 2009 Share Posted July 29, 2009 Well if you are talking about a list control as in GUICtrlCreateList(), that's what the 3rd block of code does. If you are talking about a list as in GUICtrlCreateListView() there is a ListView UDF in the help file too. LOL... my bad, I overlooked your 3rd block of code, and thought it was the same thing (I thought it was odd that it looked exactly the same as the other one lol xD).Thanks, sorry for my noobess >_<. Link to comment Share on other sites More sharing options...
GEOSoft Posted July 29, 2009 Share Posted July 29, 2009 LOL... my bad, I overlooked your 3rd block of code, and thought it was the same thing (I thought it was odd that it looked exactly the same as the other one lol xD).Thanks, sorry for my noobess >_< .No problem. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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