Arclite86 Posted November 3, 2014 Share Posted November 3, 2014 I got a function: in the #Region ### START Koda GUI section ### Form= the function #EndRegion ### END Koda GUI section ### section If $msg = $message Then MsgBox($MB_SYSTEMMODAL, "Info", "info " ) After the msgbox I would like to give a other big function, is this possible? Link to comment Share on other sites More sharing options...
guinness Posted November 3, 2014 Share Posted November 3, 2014 If....Then MyFunction() EndIf If this doesn't work, then I'm afraid you didn't make yourself clear. AutID 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
MikahS Posted November 3, 2014 Share Posted November 3, 2014 (edited) not possible in one line if statements. Edited November 3, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Arclite86 Posted November 3, 2014 Author Share Posted November 3, 2014 yeah its a big script about 40 lines without the Myfunction() its just the script in Myfunction() do I have to do this in the While Switch EndSwitch WEnd and how because I failed at that, Do i need to show the whole script where im talking about? Link to comment Share on other sites More sharing options...
guinness Posted November 3, 2014 Share Posted November 3, 2014 yeah its a big script about 40 lines without the Myfunction() its just the script in Myfunction() do I have to do this in the While Switch EndSwitch WEnd and how because I failed at that, Do i need to show the whole script where im talking about? Maybe wise if you do. MikahS 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Arclite86 Posted November 3, 2014 Author Share Posted November 3, 2014 Ok, Global $iIndex = 0 #Region ### START Koda GUI section ### Form= $Form1_1_1_1 = GUICreate("program", 814, 713, 697, 101) _GUIExtender_Init($Form1_1_1_1) $List1 = GUICtrlCreateList("", 0, 64, 145, 358) GUICtrlSetData(-1, "") $List2 = GUICtrlCreateList("", 144, 64, 65, 358) GUICtrlSetData(-1, "") $List3 = GUICtrlCreateList("", 208, 64, 65, 358) GUICtrlSetData(-1, "") $List4 = GUICtrlCreateList("", 344, 64, 153, 358) GUICtrlSetData(-1, "") $List5 = GUICtrlCreateList("", 496, 64, 65, 358) GUICtrlSetData(-1, "") $List6 = GUICtrlCreateList("", 560, 64, 121, 230) GUICtrlSetData(-1, "") $List7 = GUICtrlCreateList("", 680, 64, 65, 230) GUICtrlSetData(-1, "") $List8 = GUICtrlCreateList("", 744, 64, 65, 230) GUICtrlSetData(-1, "") $List9 = GUICtrlCreateList("", 272, 64, 65, 358) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) Local $helpmenu, $infoitem, $exititem, $recentfilesmenu Local $viewmenu, $viewstatusitem Local $statuslabel, $msg, $file $filemenu = GUICtrlCreateMenu("&File") $fileitem = GUICtrlCreateMenuItem("Open", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $helpmenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $filemenu) GUICtrlSetState(-1, $GUI_DISABLE) $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu) $message4 = GUICtrlCreateMenuItem("message", $filemenu) ; here I would like to have a function If $msg = $message Then MsgBox($MB_SYSTEMMODAL, "Info", " " & $1newfile) The function: expandcollapse popupLocal $newfile = StringReplace($file, "Openfile.txt", "") $1newfile = ($newfile & ("lists\list")) Global $iIndex = 0, $sListData1 = ($1newfile & ("1")) Global $sListFile1 = ($1newfile & ("1")) Global $iIndex = 0, $sListData2 = ($1newfile & ("2")) Global $sListFile2 = ($1newfile & ("2")) Global $iIndex = 0, $sListData3 = ($1newfile & ("3")) Global $sListFile3 = ($1newfile & ("3")) Global $iIndex = 0, $sListData4 = ($1newfile & ("4")) Global $sListFile4 = ($1newfile & ("4")) Global $iIndex = 0, $sListData5 = ($1newfile & ("5")) Global $sListFile5 = ($1newfile & ("5")) Global $iIndex = 0, $sListData6 = ($1newfile & ("6")) Global $sListFile6 = ($1newfile & ("6")) Global $iIndex = 0, $sListData7 = ($1newfile & ("7")) Global $sListFile7 = ($1newfile & ("7")) Global $iIndex = 0, $sListData8 = ($1newfile & ("8")) Global $sListFile8 = ($1newfile & ("8")) Global $iIndex = 0, $sListData9 = ($1newfile & ("9")) Global $sListFile9 = ($1newfile & ("9")) Global $iIndex = 0, $sListData10 = ($1newfile & ("10")) Global $sListFile10 = ($1newfile & ("10")) Global $iIndex = 0, $sListData11 = ($1newfile & ("11")) Global $sListFile11 = ($1newfile & ("11")) Global $iIndex = 0, $sListData12 = ($1newfile & ("12")) Global $sListFile12 = ($1newfile & ("12")) Global $iIndex = 0, $sListData13 = ($1newfile & ("13")) Global $sListFile13 = ($1newfile & ("13")) ; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) _GUICtrlListBox_SetCurSel($List1, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile2) Then $sListData2 = FileRead($sListFile2) EndIf ; Load data read from the file GUICtrlSetData($List2, $sListData2) _GUICtrlListBox_SetCurSel($List2, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile3) Then $sListData3 = FileRead($sListFile3) EndIf ; Load data read from the file GUICtrlSetData($List3, $sListData3) _GUICtrlListBox_SetCurSel($List3, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile4) Then $sListData4 = FileRead($sListFile4) EndIf ; Load data read from the file GUICtrlSetData($List4, $sListData4) _GUICtrlListBox_SetCurSel($List4, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile5) Then $sListData5 = FileRead($sListFile5) EndIf ; Load data read from the file GUICtrlSetData($List5, $sListData5) _GUICtrlListBox_SetCurSel($List5, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile6) Then $sListData6 = FileRead($sListFile6) EndIf ; Load data read from the file GUICtrlSetData($List6, $sListData6) _GUICtrlListBox_SetCurSel($List6, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile7) Then $sListData7 = FileRead($sListFile7) EndIf ; Load data read from the file GUICtrlSetData($List7, $sListData7) _GUICtrlListBox_SetCurSel($List7, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile8) Then $sListData8 = FileRead($sListFile8) EndIf ; Load data read from the file GUICtrlSetData($List8, $sListData8) _GUICtrlListBox_SetCurSel($List8, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile9) Then $sListData9 = FileRead($sListFile9) EndIf ; Load data read from the file GUICtrlSetData($List9, $sListData9) _GUICtrlListBox_SetCurSel($List9, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile10) Then $sListData10 = FileRead($sListFile10) EndIf ; Load data read from the file GUICtrlSetData($money, $sListData10) _GUICtrlListBox_SetCurSel($money, $sListData10) How can I activate this function properly Link to comment Share on other sites More sharing options...
guinness Posted November 3, 2014 Share Posted November 3, 2014 I will leave it to some expert to help you, as I am royally confused. AutID 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Arclite86 Posted November 3, 2014 Author Share Posted November 3, 2014 (edited) basically I got 9 lists and the function reads from the notepads: from list1 to list9 I only want a Load and save system for this lists, thats all Edited November 3, 2014 by Arclite86 Link to comment Share on other sites More sharing options...
kylomas Posted November 3, 2014 Share Posted November 3, 2014 In If $msg = $message Then MsgBox($MB_SYSTEMMODAL, "Info", " " & $1newfile) How is $msg being populated??? Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
kylomas Posted November 3, 2014 Share Posted November 3, 2014 (edited) ArcLite86, This is the same as >this thread...please stick to one thread. You are not getting help because you are not presenting your need/problem clearly. The code that you are posting is neither runnable nor logical. From the code that you posted in this thread I can see that you either did NOT understand my response to your previous post, or, chose to ignore it. Regardless, I'll try one more time. basically I got 9 lists and the function reads from the notepads: from list1 to list9 I only want a Load and save system for this lists, thats all The following does the above. If this is not what you intend post back with explicit details. The TXT files are in the directory that the script is run from. #include <GUIConstantsEx.au3> #include <File.au3> #include <array.au3> #AutoIt3Wrapper_Add_Constants=n local $gui010 = guicreate('') local $aSize = wingetclientsize($gui010) local $cmb010 = guictrlcreatecombo('',20,20,300,200) guisetstate() ; populate the combo box with the contents of the array ($aFiles) local $aFiles = _filelisttoarray(@scriptdir,'*.txt',default,true) for $1 = 1 to $aFiles[0] guictrlsetdata($cmb010,$aFiles[$1]) Next guictrlsetdata($cmb010,$aFiles[1]) ; set default entry for the combo box while 1 switch guigetmsg() case $gui_event_close Exit case $cmb010 ; ; do whatever you want with the selection from the combo box ; ConsoleWrite('Contents of file = ' & fileread(guictrlread($cmb010)) & @CRLF) EndSwitch WEnd Again, I would encourage you to read the Help file. The code that you posted indicates a lack of understanding of some basics fundamental to the language. kylomas edit:spelling Edited November 3, 2014 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Arclite86 Posted November 4, 2014 Author Share Posted November 4, 2014 No this is not what I wanted because when I select one directory it puts the name of the directory in the list instead of the content of the lists Again, I would encourage you to read the Help file. The code that you posted indicates a lack of understanding of some basics fundamental to the language. I got the whole menu from the help file: Local $helpmenu, $infoitem, $exititem, $recentfilesmenu Local $viewmenu, $viewstatusitem Local $statuslabel, $msg, $file $filemenu = GUICtrlCreateMenu("&File") $fileitem = GUICtrlCreateMenuItem("Open", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $helpmenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $filemenu) GUICtrlSetState(-1, $GUI_DISABLE) $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu) $message4 = GUICtrlCreateMenuItem("message", $filemenu) ; here I would like to have a function If $msg = $message Then MsgBox($MB_SYSTEMMODAL, "Info", " " & $1newfile) Why the hell is it so hard to open a text.file for a list?? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 Arclite86,The problem is not that it is "hard to open a text.file for a list" - the problem is that none of us have the remotest idea of what you are actually trying to do, which makes it very difficult to help you in any sensible way. The code you posted above is little help as it appears completely random, with no interconnectivity, and, for the most part, less than runnable. >So what is the overall aim of this script - what is it supposed to do? For example, you state:I got 9 lists and the function reads from the notepadsWhat "notepads"? Do you mean instances of Windows' Notepad? Edit controls that you have created - but which appear nowhere in your code? Paper notepads on the desks of those who run the script? Can you see why we are confused? Please take the time to write something which clearly explains the purpose of this script - then we might understand what you want and be able to offer you the help you need. As it is you stand little chance of getting any further replies as there is little point in posting code which may or may not have any bearing on your problem. >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...
BrewManNH Posted November 4, 2014 Share Posted November 4, 2014 I'd like to add, post a RUNNABLE script that attempts to show what you want to do, even if it doesn't work completly correctly. Make it as complete as possible, you might actually figure out where you're going wrong in the process, and then we can see what you are trying to do, or at least we all hope so. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Arclite86 Posted November 4, 2014 Author Share Posted November 4, 2014 Ok sorry if i wasn't clear: I would like to have to have an openfile that opens text files and reads the content and put it in a list this is the code for that the list: $List1 = GUICtrlCreateList("", 0, 64, 105, 370, BitOR($WS_BORDER, $WS_VSCROLL)) This is the code for reading the text and put it in the list above ; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) _GUICtrlListBox_SetCurSel($List1, $iIndex) this is give the $slistData1 the directory (bellow) Global $iIndex = 0, $sListData1 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list1.txt" Global $sListFile1 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list1.txt" but this works: Global $sListFile1 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list1.txt" but this isn't Global $iIndex = 0, $sListData1 = ($1newfile & ("1")) Global $sListFile1 = ($1newfile & ("1")) my question is why: The code above is the same directory as the code therefor, but I need the use a variable so I can open different files and not only: "C:Usersjoesoef pcDesktopautoittwitter programmalijstenlist1.txt" I already know how to find the directory code that I found from the help file: While 1 $msg = GUIGetMsg() If $msg = $fileitem Then $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) EndIf If $msg = $viewstatusitem Then If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED) GUICtrlSetState($statuslabel, $GUI_HIDE) Else GUICtrlSetState($viewstatusitem, $GUI_CHECKED) GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop Local $newfile = StringReplace($file, "Openfile.txt", "") $1newfile = ($newfile & ("lists\list")) ; my code If $msg = $infoitem Then MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") If $msg = $message Then MsgBox($MB_SYSTEMMODAL, "Info", " " & $1newfile) WEnd GUIDelete() the code above opens the directry: C:Usersjoesoef pcDesktopautoittwitter programmalijstenlijsten2weigt lossOpenfile.txt but it needs to open: C:Usersjoesoef pcDesktopautoittwitter programmalijstenlijsten2weigt losslists1 C:Usersjoesoef pcDesktopautoittwitter programmalijstenlijsten2weigt losslists2 C:Usersjoesoef pcDesktopautoittwitter programmalijstenlijsten2weigt losslists3 ...... C:Usersjoesoef pcDesktopautoittwitter programmalijstenlijsten2weigt losslists9 so when it opens: C:Usersjoesoef pcDesktopautoittwitter programmalijstenlijsten2weigt lossOpenfile.txt I deleted the "Openfile.txt" with Local $newfile = StringReplace($file, "Openfile.txt", "") and than $1newfile = ($newfile & ("lists\list")) and than to find the directy Global $iIndex = 0, $sListData1 = ($1newfile & ("1")) Global $sListFile1 = ($1newfile & ("1")) the lists $List1 = GUICtrlCreateList("", 0, 64, 145, 358) GUICtrlSetData(-1, "") $List2 = GUICtrlCreateList("", 144, 64, 65, 358) GUICtrlSetData(-1, "") $List3 = GUICtrlCreateList("", 208, 64, 65, 358) GUICtrlSetData(-1, "") $List4 = GUICtrlCreateList("", 344, 64, 153, 358) GUICtrlSetData(-1, "") $List5 = GUICtrlCreateList("", 496, 64, 65, 358) GUICtrlSetData(-1, "") $List6 = GUICtrlCreateList("", 560, 64, 121, 230) GUICtrlSetData(-1, "") $List7 = GUICtrlCreateList("", 680, 64, 65, 230) GUICtrlSetData(-1, "") $List8 = GUICtrlCreateList("", 744, 64, 65, 230) GUICtrlSetData(-1, "") $List9 = GUICtrlCreateList("", 272, 64, 65, 358) GUICtrlSetData(-1, "") and than to read and put in the lists ; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) _GUICtrlListBox_SetCurSel($List1, $iIndex) I think I explained everyting if there are more question please ask me Link to comment Share on other sites More sharing options...
Arclite86 Posted November 4, 2014 Author Share Posted November 4, 2014 (edited) the working script: expandcollapse popup$_FF_COM_TRACE = True #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <FF.au3> #include <staticConstants.au3> #include <IE.au3> #include <String.au3> #include <Excel.au3> #include <FileConstants.au3> #include <IE.au3> #include <String.au3> #include <GUIConstantsEx.au3> #include "GUIExtender.au3" Local $oIE ;, BitOR($WS_BORDER, $WS_VSCROLL) ;_FFStart( "https://www.google.nl" ) ;WinSetState ( "Google - Mozilla Firefox", "", @SW_MINIMIZE ) ;~ _GUIExtender_Init($Form1_1_1_1) For $i = 1 To 13 FileDelete(@ScriptDir & "\list" & $i & ".txt") FileWrite(@ScriptDir & "\list" & $i & ".txt", "text " & $i) Next #Region ### START Koda GUI section ### Form= $Form1_1_1_1 = GUICreate("program", 814, 713, 697, 101) $List1 = GUICtrlCreateList("", 0, 64, 145, 358) GUICtrlSetData(-1, "") $List2 = GUICtrlCreateList("", 144, 64, 65, 358) GUICtrlSetData(-1, "") $List3 = GUICtrlCreateList("", 208, 64, 65, 358) GUICtrlSetData(-1, "") $List4 = GUICtrlCreateList("", 344, 64, 153, 358) GUICtrlSetData(-1, "") $List5 = GUICtrlCreateList("", 496, 64, 65, 358) GUICtrlSetData(-1, "") $List6 = GUICtrlCreateList("", 560, 64, 121, 230) GUICtrlSetData(-1, "") $List7 = GUICtrlCreateList("", 680, 64, 65, 230) GUICtrlSetData(-1, "") $List8 = GUICtrlCreateList("", 744, 64, 65, 230) GUICtrlSetData(-1, "") $List9 = GUICtrlCreateList("", 272, 64, 65, 358) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) Local $helpmenu, $infoitem, $exititem, $recentfilesmenu Local $viewmenu, $viewstatusitem Local $statuslabel, $msg, $file $filemenu = GUICtrlCreateMenu("&File") $fileitem = GUICtrlCreateMenuItem("Open", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $helpmenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $filemenu) GUICtrlSetState(-1, $GUI_DISABLE) $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu) $message4 = GUICtrlCreateMenuItem("message", $filemenu) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 $msg = GUIGetMsg() If $msg = $fileitem Then $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) EndIf If $msg = $viewstatusitem Then If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED) GUICtrlSetState($statuslabel, $GUI_HIDE) Else GUICtrlSetState($viewstatusitem, $GUI_CHECKED) GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop Local $newfile = StringReplace($file, "Openfile.txt", "") $1newfile = ($newfile & ("lists\list")) Global $iIndex = 0, $sListData1 = ($1newfile & ("1")) Global $sListFile1 = ($1newfile & ("1")) Global $iIndex = 0, $sListData2 = ($1newfile & ("2")) Global $sListFile2 = ($1newfile & ("2")) Global $iIndex = 0, $sListData3 = ($1newfile & ("3")) Global $sListFile3 = ($1newfile & ("3")) Global $iIndex = 0, $sListData4 = ($1newfile & ("4")) Global $sListFile4 = ($1newfile & ("4")) Global $iIndex = 0, $sListData5 = ($1newfile & ("5")) Global $sListFile5 = ($1newfile & ("5")) Global $iIndex = 0, $sListData6 = ($1newfile & ("6")) Global $sListFile6 = ($1newfile & ("6")) Global $iIndex = 0, $sListData7 = ($1newfile & ("7")) Global $sListFile7 = ($1newfile & ("7")) Global $iIndex = 0, $sListData8 = ($1newfile & ("8")) Global $sListFile8 = ($1newfile & ("8")) Global $iIndex = 0, $sListData9 = ($1newfile & ("9")) Global $sListFile9 = ($1newfile & ("9")) Global $iIndex = 0, $sListData10 = ($1newfile & ("10")) Global $sListFile10 = ($1newfile & ("10")) Global $iIndex = 0, $sListData11 = ($1newfile & ("11")) Global $sListFile11 = ($1newfile & ("11")) Global $iIndex = 0, $sListData12 = ($1newfile & ("12")) Global $sListFile12 = ($1newfile & ("12")) Global $iIndex = 0, $sListData13 = ($1newfile & ("13")) Global $sListFile13 = ($1newfile & ("13")) ; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) _GUICtrlListBox_SetCurSel($List1, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile2) Then $sListData2 = FileRead($sListFile2) EndIf ; Load data read from the file GUICtrlSetData($List2, $sListData2) _GUICtrlListBox_SetCurSel($List2, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile3) Then $sListData3 = FileRead($sListFile3) EndIf ; Load data read from the file GUICtrlSetData($List3, $sListData3) _GUICtrlListBox_SetCurSel($List3, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile4) Then $sListData4 = FileRead($sListFile4) EndIf ; Load data read from the file GUICtrlSetData($List4, $sListData4) _GUICtrlListBox_SetCurSel($List4, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile5) Then $sListData5 = FileRead($sListFile5) EndIf ; Load data read from the file GUICtrlSetData($List5, $sListData5) _GUICtrlListBox_SetCurSel($List5, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile6) Then $sListData6 = FileRead($sListFile6) EndIf ; Load data read from the file GUICtrlSetData($List6, $sListData6) _GUICtrlListBox_SetCurSel($List6, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile7) Then $sListData7 = FileRead($sListFile7) EndIf ; Load data read from the file GUICtrlSetData($List7, $sListData7) _GUICtrlListBox_SetCurSel($List7, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile8) Then $sListData8 = FileRead($sListFile8) EndIf ; Load data read from the file GUICtrlSetData($List8, $sListData8) _GUICtrlListBox_SetCurSel($List8, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile9) Then $sListData9 = FileRead($sListFile9) EndIf ; Load data read from the file GUICtrlSetData($List9, $sListData9) _GUICtrlListBox_SetCurSel($List9, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile10) Then $sListData10 = FileRead($sListFile10) EndIf If $msg = $infoitem Then MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") WEnd GUIDelete() #EndRegion ### END Koda GUI section ### if you run this I would only reads the directory and sets the name of the directory instead of the content. this is what the text file is showing (what it needs to show in the lists) ExtWeightLoss|samomidi|mnt_weightloss|weight__loss|Scoat5|_Zibee_|iWeightLossCom|WeightLossTwins|WeightDietLoss|thegreatmiracle|AWeightLossTea|TLSWeightLoss|weightlossjuice|weightlossbitch|7weightloss7|TLSWeightLoss|losefatnowblog........etc Edited November 4, 2014 by Arclite86 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 Arclite86, Some light dawns - but not a lot. First thing - you need to get all the file read code into a separate function:expandcollapse popup$_FF_COM_TRACE = True #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> ;#include <FF.au3> #include <staticConstants.au3> #include <IE.au3> #include <String.au3> #include <Excel.au3> #include <FileConstants.au3> #include <IE.au3> #include <String.au3> #include <GUIConstantsEx.au3> #include "GUIExtender.au3" Local $oIE ;, BitOR($WS_BORDER, $WS_VSCROLL) ;_FFStart( "https://www.google.nl" ) ;WinSetState ( "Google - Mozilla Firefox", "", @SW_MINIMIZE ) ;~ _GUIExtender_Init($Form1_1_1_1) For $i = 1 To 13 FileDelete(@ScriptDir & "\list" & $i & ".txt") FileWrite(@ScriptDir & "\list" & $i & ".txt", "text " & $i) Next #Region ### START Koda GUI section ### Form= $Form1_1_1_1 = GUICreate("program", 814, 713, 697, 101) $List1 = GUICtrlCreateList("", 0, 64, 145, 358) GUICtrlSetData(-1, "") $List2 = GUICtrlCreateList("", 144, 64, 65, 358) GUICtrlSetData(-1, "") $List3 = GUICtrlCreateList("", 208, 64, 65, 358) GUICtrlSetData(-1, "") $List4 = GUICtrlCreateList("", 344, 64, 153, 358) GUICtrlSetData(-1, "") $List5 = GUICtrlCreateList("", 496, 64, 65, 358) GUICtrlSetData(-1, "") $List6 = GUICtrlCreateList("", 560, 64, 121, 230) GUICtrlSetData(-1, "") $List7 = GUICtrlCreateList("", 680, 64, 65, 230) GUICtrlSetData(-1, "") $List8 = GUICtrlCreateList("", 744, 64, 65, 230) GUICtrlSetData(-1, "") $List9 = GUICtrlCreateList("", 272, 64, 65, 358) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) Local $helpmenu, $infoitem, $exititem, $recentfilesmenu Local $viewmenu, $viewstatusitem Local $statuslabel, $msg, $file $filemenu = GUICtrlCreateMenu("&File") $fileitem = GUICtrlCreateMenuItem("Open", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $helpmenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $filemenu) GUICtrlSetState(-1, $GUI_DISABLE) $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu) $message4 = GUICtrlCreateMenuItem("message", $filemenu) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 $msg = GUIGetMsg() If $msg = $fileitem Then ConsoleWrite("Hit" & @CRLF) $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) _FillLists($file) EndIf EndIf If $msg = $viewstatusitem Then If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED) GUICtrlSetState($statuslabel, $GUI_HIDE) Else GUICtrlSetState($viewstatusitem, $GUI_CHECKED) GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop If $msg = $infoitem Then MsgBox($MB_SYSTEMMODAL, "Info", "Only a test...") WEnd GUIDelete() #EndRegion ### END Koda GUI section ### Func _FillLists($file) Local $newfile = StringReplace($file, "Openfile.txt", "") $1newfile = ($newfile & ("lists\list")) Global $iIndex = 0, $sListData1 = ($1newfile & ("1")) Global $sListFile1 = ($1newfile & ("1")) Global $iIndex = 0, $sListData2 = ($1newfile & ("2")) Global $sListFile2 = ($1newfile & ("2")) Global $iIndex = 0, $sListData3 = ($1newfile & ("3")) Global $sListFile3 = ($1newfile & ("3")) Global $iIndex = 0, $sListData4 = ($1newfile & ("4")) Global $sListFile4 = ($1newfile & ("4")) Global $iIndex = 0, $sListData5 = ($1newfile & ("5")) Global $sListFile5 = ($1newfile & ("5")) Global $iIndex = 0, $sListData6 = ($1newfile & ("6")) Global $sListFile6 = ($1newfile & ("6")) Global $iIndex = 0, $sListData7 = ($1newfile & ("7")) Global $sListFile7 = ($1newfile & ("7")) Global $iIndex = 0, $sListData8 = ($1newfile & ("8")) Global $sListFile8 = ($1newfile & ("8")) Global $iIndex = 0, $sListData9 = ($1newfile & ("9")) Global $sListFile9 = ($1newfile & ("9")) Global $iIndex = 0, $sListData10 = ($1newfile & ("10")) Global $sListFile10 = ($1newfile & ("10")) Global $iIndex = 0, $sListData11 = ($1newfile & ("11")) Global $sListFile11 = ($1newfile & ("11")) Global $iIndex = 0, $sListData12 = ($1newfile & ("12")) Global $sListFile12 = ($1newfile & ("12")) Global $iIndex = 0, $sListData13 = ($1newfile & ("13")) Global $sListFile13 = ($1newfile & ("13")) ; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) Else MsgBox($MB_SYSTEMMODAL, "Error", $sListFile1 & " does not exist") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) _GUICtrlListBox_SetCurSel($List1, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile2) Then $sListData2 = FileRead($sListFile2) EndIf ; Load data read from the file GUICtrlSetData($List2, $sListData2) _GUICtrlListBox_SetCurSel($List2, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile3) Then $sListData3 = FileRead($sListFile3) EndIf ; Load data read from the file GUICtrlSetData($List3, $sListData3) _GUICtrlListBox_SetCurSel($List3, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile4) Then $sListData4 = FileRead($sListFile4) EndIf ; Load data read from the file GUICtrlSetData($List4, $sListData4) _GUICtrlListBox_SetCurSel($List4, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile5) Then $sListData5 = FileRead($sListFile5) EndIf ; Load data read from the file GUICtrlSetData($List5, $sListData5) _GUICtrlListBox_SetCurSel($List5, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile6) Then $sListData6 = FileRead($sListFile6) EndIf ; Load data read from the file GUICtrlSetData($List6, $sListData6) _GUICtrlListBox_SetCurSel($List6, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile7) Then $sListData7 = FileRead($sListFile7) EndIf ; Load data read from the file GUICtrlSetData($List7, $sListData7) _GUICtrlListBox_SetCurSel($List7, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile8) Then $sListData8 = FileRead($sListFile8) EndIf ; Load data read from the file GUICtrlSetData($List8, $sListData8) _GUICtrlListBox_SetCurSel($List8, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile9) Then $sListData9 = FileRead($sListFile9) EndIf ; Load data read from the file GUICtrlSetData($List9, $sListData9) _GUICtrlListBox_SetCurSel($List9, $iIndex) ; Read saved file if it exists-------- If FileExists($sListFile10) Then $sListData10 = FileRead($sListFile10) EndIf EndFuncNow you only run the code when you select the "Open" menu item and not every pass through the loop. Next, you get the filename in the lists because that is what you set as the default content:Global $iIndex = 0, $sListData1 = ($1newfile & ("1")) ; <<<<<<<<<< Global $sListFile1 = ($1newfile & ("1"))When you try to read the file, you only reset that default value if the file exists:; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) ; Only reset here EndIf ; Load data read from the file GUICtrlSetData($List1, $sListData1) ; So if the file does not exist you still have the default (filename) you set earlier _GUICtrlListBox_SetCurSel($List1, $iIndex)I suggest you add some errorchecking to see if the file you are trying to open is indeed opened - I suggest something like this:; Read saved file if it exists-------- If FileExists($sListFile1) Then $sListData1 = FileRead($sListFile1) Else MsgBox($MB_SYSTEMMODAL, "Error", $sListFile1 & " does not exist") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIfNow you can tell if you trying to open the correct files and if you succeeded.Try that and see what you get returned in those message boxes - I think you will find that you are not trying to open the files that you think you are. 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...
Arclite86 Posted November 4, 2014 Author Share Posted November 4, 2014 Thank you so much this was the solution: expandcollapse popupGlobal $iIndex = 0, $sListData1 = ($1newfile & ("1.txt")) Global $sListFile1 = ($1newfile & ("1.txt")) Global $iIndex = 0, $sListData2 = ($1newfile & ("2.txt")) Global $sListFile2 = ($1newfile & ("2.txt")) Global $iIndex = 0, $sListData3 = ($1newfile & ("3.txt")) Global $sListFile3 = ($1newfile & ("3.txt")) Global $iIndex = 0, $sListData4 = ($1newfile & ("4.txt")) Global $sListFile4 = ($1newfile & ("4.txt")) Global $iIndex = 0, $sListData5 = ($1newfile & ("5.txt")) Global $sListFile5 = ($1newfile & ("5.txt")) Global $iIndex = 0, $sListData6 = ($1newfile & ("6.txt")) Global $sListFile6 = ($1newfile & ("6.txt")) Global $iIndex = 0, $sListData7 = ($1newfile & ("7.txt")) Global $sListFile7 = ($1newfile & ("7.txt")) Global $iIndex = 0, $sListData8 = ($1newfile & ("8.txt")) Global $sListFile8 = ($1newfile & ("8.txt")) Global $iIndex = 0, $sListData9 = ($1newfile & ("9.txt")) Global $sListFile9 = ($1newfile & ("9.txt")) Global $iIndex = 0, $sListData10 = ($1newfile & ("10.txt")) Global $sListFile10 = ($1newfile & ("10.txt")) Global $iIndex = 0, $sListData11 = ($1newfile & ("11.txt")) Global $sListFile11 = ($1newfile & ("11.txt")) Global $iIndex = 0, $sListData12 = ($1newfile & ("12.txt")) Global $sListFile12 = ($1newfile & ("12.txt")) Global $iIndex = 0, $sListData13 = ($1newfile & ("13.txt")) Global $sListFile13 = ($1newfile & ("13.txt")) thank you very much melba Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 4, 2014 Moderators Share Posted November 4, 2014 Arclite86,Delighted that I could help. 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...
Arclite86 Posted November 9, 2014 Author Share Posted November 9, 2014 Hi After trying to start an other function it wont react no more, it seems that it stays in that function (Func _FillLists($file)) how can I solve that? Link to comment Share on other sites More sharing options...
TheSaint Posted November 9, 2014 Share Posted November 9, 2014 I suggest you post your full code again, so that it can be seen where this other function is located. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) 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