Guest AX5 Posted January 16, 2010 Share Posted January 16, 2010 Im haveing a problem. The button1 should open the file that yuo hade selected in List1 and display in Edit1 expandcollapse popup#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Include <File.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form", 473, 295, 190, 130) $List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER)) $Edit1 = GUICtrlCreateEdit("", 208, 24, 249, 249, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "Quest") $Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP) $Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $path = "img\list\" $a = _FileListToArray($path) For $x = 1 To $a[0] $b = StringSplit($a[$x],".") GUICtrlSetData ( $List1, $b[1] ) next While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1) ShellExecute($a[$d],"",$path, $Edit1) EndSelect WEnd Link to comment Share on other sites More sharing options...
BrettF Posted January 16, 2010 Share Posted January 16, 2010 Where are you setting the data when you click the button? You have removed a lot from your example compared to your original code... What I would do is use _GUICtrlListBox_GetCurSel($hWnd) to get the selected then (if I read your code correctly and can remember what _FileListToArray returns...) get the selected file from the array by $a[$index + 1] (horrible naming too. Try naming your variable $aFileList or something sensible). Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Guest AX5 Posted January 16, 2010 Share Posted January 16, 2010 Where are you setting the data when you click the button? You have removed a lot from your example compared to your original code... What I would do is use _GUICtrlListBox_GetCurSel($hWnd) to get the selected then (if I read your code correctly and can remember what _FileListToArray returns...) get the selected file from the array by $a[$index + 1] (horrible naming too. Try naming your variable $aFileList or something sensible). Cheers, Brett I only need to fix the button to display the data from the List box to EDIT1 Link to comment Share on other sites More sharing options...
BrettF Posted January 16, 2010 Share Posted January 16, 2010 GUICtrlSetData. You have more that 100 posts. You should have worked that function out by now... Surely! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Guest AX5 Posted January 17, 2010 Share Posted January 17, 2010 (edited) Im having a small problem. My Script does not open the file in in to edit1 only the file name not opening the file so you can see. Im only using .txt file in the list section $path = "img\list\" $a = _FileListToArray($path) For $x = 1 To $a[0] $b = StringSplit($a[$x],".") GUICtrlSetData ( $List1, $b[1] ) next While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1) GUICtrlSetData($Edit1,"" & $a[$d]) EndSelect WEnd Edited January 17, 2010 by AX5 Link to comment Share on other sites More sharing options...
BrettF Posted January 17, 2010 Share Posted January 17, 2010 You want to put the contents of the file into the edit? You're not thinking. You've got 105 posts now. How can you not think? Sit back. Read your code? ARE YOU EVER TELLING THE EDIT BOX WHAT ITS MEANT TO DISPLAY! For reading the file look at FileRead. Setting the data see post #4 in this thread. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
wolf9228 Posted January 17, 2010 Share Posted January 17, 2010 Im haveing a problem. The button1 should open the file that yuo hade selected in List1 and display in Edit1 expandcollapse popup#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Include <File.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form", 473, 295, 190, 130) $List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER)) $Edit1 = GUICtrlCreateEdit("", 208, 24, 249, 249, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "Quest") $Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP) $Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $path = "img\list\" $a = _FileListToArray($path) For $x = 1 To $a[0] $b = StringSplit($a[$x],".") GUICtrlSetData ( $List1, $b[1] ) next While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1) ShellExecute($a[$d],"",$path, $Edit1) EndSelect WEnd Only In RichEdit can review photos ... expandcollapse popup#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Include <File.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form", 473, 295, 190, 130) $List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER)) $Pic = GUICtrlCreatePic("", 208, 24, 249, 249, BitOR($SS_CENTERIMAGE,$SS_SUNKEN,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER)) GUICtrlSetData(-1, "Quest") $Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP) $Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $path = "img\list\" $a = _FileListToArray($path) For $x = 1 To $a[0] $b = StringSplit($a[$x],".") GUICtrlSetData ( $List1, $b[1] ) next While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1) ShellExecute(@ScriptDir & "\" & $path & $a[$d],"", "") GUICtrlSetImage($Pic,@ScriptDir & "\" & $path & $a[$d], 0) EndSelect WEnd صرح السماء كان هنا Link to comment Share on other sites More sharing options...
Guest AX5 Posted January 17, 2010 Share Posted January 17, 2010 Only In RichEdit can review photos ... expandcollapse popup#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #Include <File.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form", 473, 295, 190, 130) $List1 = GUICtrlCreateList("", 16, 24, 177, 97, BitOR($LBS_SORT,$WS_HSCROLL,$WS_BORDER)) $Pic = GUICtrlCreatePic("", 208, 24, 249, 249, BitOR($SS_CENTERIMAGE,$SS_SUNKEN,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER)) GUICtrlSetData(-1, "Quest") $Button1 = GUICtrlCreateButton("Display", 64, 152, 75, 25, $WS_GROUP) $Pic1 = GUICtrlCreatePic("img\img.jpg", 0, 0, 473, 295, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $path = "img\list\" $a = _FileListToArray($path) For $x = 1 To $a[0] $b = StringSplit($a[$x],".") GUICtrlSetData ( $List1, $b[1] ) next While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button1 $d = _ArraySearch($a, GUICtrlRead($List1), 0, 0, 0, 1) ShellExecute(@ScriptDir & "\" & $path & $a[$d],"", "") GUICtrlSetImage($Pic,@ScriptDir & "\" & $path & $a[$d], 0) EndSelect WEnd No. I want the text inside of the file in the list opens in Edit1 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