Jump to content

Creating Open File


Recommended Posts

I have a List that reads the information from note : "C:UserDesktopautoitprogrammalistslist1.txt"

the is called "list1" as you can see.

But I also have other lists with different  information,("C:UserDesktopautoitprogrammaOtherAugust")

so at this moment I manual replace the note "list1" from the August fille in the "Other" map in the "Lists"  map

so it will open the other note with the other information

I would like to do this process automticy I already created a menu with a "file" drop down buttons with "Open" and "Create"

with the open I got this:

$findfiles = GUICtrlCreateMenu("Find Files", $filemenu, 1,)

So when you lay your mouse on the "Find files" option a other small menu will pop out

it this second dropdown menu I would like to have all the map names (like map:August) be shown in the second dropdown,

I would like to know how I can do this.

Edited by Arclite86
Link to comment
Share on other sites

Could you give me a little help because when I search for array in the help file  I see more than 20 different functions,and i have no idea where to start

this is my menu:

Local $defaultstatus = "Ready", $filemenu, $fileitem
    Local $helpmenu, $infoitem, $exititem, $recentfilesmenu
    Local $viewmenu, $viewstatusitem, $cancelbutton
    Local $statuslabel, $msg, $file

$filemenu = GUICtrlCreateMenu("&File")
    $fileitem = GUICtrlCreateMenuItem("Open", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $createitem = GUICtrlCreateMenuItem("create", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu("info")
    $registers = GUICtrlCreateMenu("Register")
    $savefile = GUICtrlCreateMenuItem("Save", $filemenu)
    $saveas = GUICtrlCreateMenuItem("Save as", $filemenu)
;~  GUICtrlSetState(-1, $GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1,)

but I just want the $recentfilesmenu search in  the ("C:UserDesktopautoitprogrammaOtherAugust") map and than open or replace the map

can somebody help me to just get started.

Link to comment
Share on other sites

i already tried this code :

$sPath = "C:\Users\joesoef pc\Desktop\autoit\programma\lijsten"
$hSearch = FileFindFirstFile('*.*')

;~ $hGUI = GUICreate('')
;~   $idMenu = GUICtrlCreateMenu('Files')
    $idOpen = GUICtrlCreateMenu('Open34', $filemenu)

While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $idOpen)
    WEnd


GUISetState()
While GUIGetMsg() <> -3
WEnd

It works the way I want it but somehow it opens the wrong map: "C:Usersjoesoef pcDesktopautoitprogramma"

does anybody know why this happens?
Link to comment
Share on other sites

ArcLite86,

It works the way I want it but somehow it opens the wrong map: "C:Usersjoesoef pcDesktopautoitprogramma"

 

The code you posted can't be woking the way you expect, if at all.

  1. Syntax error $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1,) as FireFox pointed out
  2. You are not creating control id's for your menu items
  3. You are not testing for control id's in your message loop
  4. $hSearch = FileFindFirstFile('*.*') is reading whatever is in the current working directory, not the dir in $sPath

To fix #2 and #3 use this menu trick from M23 or create an array to store your menu item controls.

#include <GUIConstantsEx.au3>

$sPath = @desktopdir & '\sports stations\'
$hSearch = FileFindFirstFile($sPath & '*.*')

local $gui010 = guicreate('Test File Menu',400,400)
local $mFiles = guictrlcreatemenu('&File')

; The following "trick" compliments of M23
; This relies on no intervening controls while creating menu entries

local $List_Start = guictrlcreatedummy() + 1
While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $mFiles)
WEnd
local $List_End = guictrlcreatedummy() - 1

GUISetState()

local $iMSG
while 1
    $iMSG = guigetmsg()
    switch $iMSG
        case $gui_event_close
            Exit
        case $List_Start to $List_End
            ConsoleWrite('Clicked = ' & guictrlread($iMSG,1) & @CRLF)
    EndSwitch
wend

Note the way actioned items are detected.

#4 can be fixed like this...

$sPath = @desktopdir & '\sports stations\'
$hSearch = FileFindFirstFile($sPath & '*.*')

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

Thank you kylomas

Im now try to make it work but somehow it doesnt work.

$sPath = @desktopdir & '\autoit\twitter programma\lijsten\lijsten2\'
$hSearch = FileFindFirstFile($sPath & '*.*')


local $mFiles = guictrlcreatemenu('&File')


local $List_Start = guictrlcreatedummy() + 1
While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $mFiles)
WEnd
local $List_End = guictrlcreatedummy() - 1

GUISetState()

local $iMSG
while 1
    $iMSG = guigetmsg()
    switch $iMSG
        case $gui_event_close
            Exit
        case $List_Start to $List_End
            ConsoleWrite('Clicked = ' & guictrlread($iMSG,1) & @CRLF)




$list1 = ("\list1.txt")
$list2 = ("\list2.txt")
$list3 = ("\list3.txt")
$list4 = ("\list4.txt")
$list5 = ("\list5.txt")
$list6 = ("\list6.txt")
$list7 = ("\list7.txt")
$list8 = ("\list8.txt")
$list9 = ("\list9.txt")
$list10 = ("\list10.txt")
$list11 = ("\list11.txt")
$list12 =  ("\list12.txt")
$list13 = ("\list13.txt")
$opgeslagen = @desktopdir & 'C:\Users\joesoef pc\Desktop\autoit\programma\lijsten\lijsten2\'
$laden = guictrlread($iMSG,1) & @CRLF

            MsgBox(1,"file:","" & $opgeslagen & $laden & $list1)

Global $iIndex = 0, $sListData1 = ($opgeslagen & $laden & $list1)
Global $sListFile1 = ($opgeslagen  & $laden & $list1)

Global $iIndex = 0, $sListData2 = ($opgeslagen & $laden & $list2)
Global $sListFile2 = ($opgeslagen & $laden & $list2)

Global $iIndex = 0, $sListData3 = ($opgeslagen & $laden & $list3)
Global $sListFile3 = ($opgeslagen & $laden & $list3)

Global $iIndex = 0, $sListData4 = ($opgeslagen & $laden & $list4)
Global $sListFile4 = ($opgeslagen & $laden & $list4)

Global $iIndex = 0, $sListData5 = ($opgeslagen & $laden & $list5)
Global $sListFile5 = ($opgeslagen & $laden & $list4)

Global $iIndex = 0, $sListData6 = ($opgeslagen & $laden & $list6)
Global $sListFile6 = ($opgeslagen & $laden & $list6)

Global $iIndex = 0, $sListData7 = ($opgeslagen & $laden & $list7)
Global $sListFile7 = ($opgeslagen & $laden & $list7)

Global $iIndex = 0, $sListData8 = ($opgeslagen & $laden & $list8)
Global $sListFile8 = ($opgeslagen & $laden & $list8)

Global $iIndex = 0, $sListData9 = ($opgeslagen & $laden & $list9)
Global $sListFile9 = ($opgeslagen & $laden & $list9)

Global $iIndex = 0, $sListData10 = ($opgeslagen & $laden & $list10)
Global $sListFile10 = ($opgeslagen & $laden & $list10)

Global $iIndex = 0, $sListData11 = ($opgeslagen & $laden & $list11)
Global $sListFile11 = ($opgeslagen & $laden & $list11)

Global $iIndex = 0, $sListData12 = ($opgeslagen & $laden & $list12)
Global $sListFile12 = ($opgeslagen & $laden & $list12)

Global $iIndex = 0, $sListData13 = ($opgeslagen & $laden & $list13)
Global $sListFile13 = ($opgeslagen & $laden & $list13)




If FileExists($sListFile1) Then
    $sListData1 = FileRead($sListFile1)
EndIf


GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)




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

    EndSwitch
wend

in lijst2 there are 4 maps with a list1.txt and a list4.txt

but I dont know why its not working.

Link to comment
Share on other sites

ArcLite86,

At this point I suggest that you read the The Help file and any Wiki doc that you can find on GUI management.  Your code suggests that you do NOT understand some basic concepts.

For example:

  1. GuiCtrlSetData is being used on variables that have nothing to do with GUI ctlid's
  2. You are trying to manipulate a non-existent listbox
  3. You are redefining a global variable in the msg loop

It might also help to define in detail what you are trying to do so we can help.

Good Luck,

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

I certainly did not show the whole scripts:

$_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"



#Region ### START Koda GUI section ### Form=
$Form1_1_1_1 = GUICreate("form", 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)







;~ $extand = GUICtrlCreateButton("extand", 504, 32, 65, 33)


;~ $iEdit_Section_Start = 30
;~ $iEdit_Section_Height = 250

$iEdit_Section_Start = 30
$iEdit_Section_Height = 210
$iEdit_Section = _GUIExtender_Section_Start($Form1_1_1_1, $iEdit_Section_Start, $iEdit_Section_Height)
_GUIExtender_Section_Action($Form1_1_1_1, $iEdit_Section)
; All control positions can then be related to the section start rather than the GUI  <<<<<<<<<<<<<


; Now you can check that the _Section_Height is correct and amend if necessary  <<<<<<<<<<<<<
_GUIExtender_Section_End($Form1_1_1_1)
_GUIExtender_Section_Extend($Form1_1_1_1, 0, False)




$sPath = @desktopdir & '\autoit\twitter programma\lijsten\lijsten2\'
$hSearch = FileFindFirstFile($sPath & '*.*')


local $mFiles = guictrlcreatemenu('&File')


local $List_Start = guictrlcreatedummy() + 1
While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $mFiles)
WEnd
local $List_End = guictrlcreatedummy() - 1

GUISetState()

local $iMSG
while 1
    $iMSG = guigetmsg()
    switch $iMSG
        case $gui_event_close
            Exit
        case $List_Start to $List_End
            ConsoleWrite('Clicked = ' & guictrlread($iMSG,1) & @CRLF)




$list1 = ("\list1.txt")
$list2 = ("\list2.txt")
$list3 = ("\list3.txt")
$list4 = ("\list4.txt")
$list5 = ("\list5.txt")
$list6 = ("\list6.txt")
$list7 = ("\list7.txt")
$list8 = ("\list8.txt")
$list9 = ("\list9.txt")
$list10 = ("\list10.txt")
$list11 = ("\list11.txt")
$list12 =  ("\list12.txt")
$list13 = ("\list13.txt")
$opgeslagen = @desktopdir & 'C:\Users\joesoef pc\Desktop\autoit\programma\lijsten\lijsten2\'
$laden = guictrlread($iMSG,1) & @CRLF

            MsgBox(1,"file:","" & $opgeslagen & $laden & $list1)

Global $iIndex = 0, $sListData1 = ($opgeslagen & $laden & $list1)
Global $sListFile1 = ($opgeslagen  & $laden & $list1)

Global $iIndex = 0, $sListData2 = ($opgeslagen & $laden & $list2)
Global $sListFile2 = ($opgeslagen & $laden & $list2)

Global $iIndex = 0, $sListData3 = ($opgeslagen & $laden & $list3)
Global $sListFile3 = ($opgeslagen & $laden & $list3)

Global $iIndex = 0, $sListData4 = ($opgeslagen & $laden & $list4)
Global $sListFile4 = ($opgeslagen & $laden & $list4)

Global $iIndex = 0, $sListData5 = ($opgeslagen & $laden & $list5)
Global $sListFile5 = ($opgeslagen & $laden & $list4)

Global $iIndex = 0, $sListData6 = ($opgeslagen & $laden & $list6)
Global $sListFile6 = ($opgeslagen & $laden & $list6)

Global $iIndex = 0, $sListData7 = ($opgeslagen & $laden & $list7)
Global $sListFile7 = ($opgeslagen & $laden & $list7)

Global $iIndex = 0, $sListData8 = ($opgeslagen & $laden & $list8)
Global $sListFile8 = ($opgeslagen & $laden & $list8)

Global $iIndex = 0, $sListData9 = ($opgeslagen & $laden & $list9)
Global $sListFile9 = ($opgeslagen & $laden & $list9)

Global $iIndex = 0, $sListData10 = ($opgeslagen & $laden & $list10)
Global $sListFile10 = ($opgeslagen & $laden & $list10)

Global $iIndex = 0, $sListData11 = ($opgeslagen & $laden & $list11)
Global $sListFile11 = ($opgeslagen & $laden & $list11)

Global $iIndex = 0, $sListData12 = ($opgeslagen & $laden & $list12)
Global $sListFile12 = ($opgeslagen & $laden & $list12)

Global $iIndex = 0, $sListData13 = ($opgeslagen & $laden & $list13)
Global $sListFile13 = ($opgeslagen & $laden & $list13)




If FileExists($sListFile1) Then
    $sListData1 = FileRead($sListFile1)
EndIf


GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)




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

    EndSwitch
wend

If i do this (the old way) it works pefrect but it only opens the same  file every time:

#Region ### START Koda GUI section ### Form=
$Form1_1_1_1 = GUICreate("form", 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, "")

#EndRegion ### END Koda GUI section ###


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"

Global $iIndex = 0, $sListData2 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list2.txt"
Global $sListFile2 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list2.txt"

Global $iIndex = 0, $sListData3 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list3.txt"
Global $sListFile3 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list3.txt"

Global $iIndex = 0, $sListData4 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list4.txt"
Global $sListFile4 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list4.txt"

Global $iIndex = 0, $sListData5 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list5.txt"
Global $sListFile5 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list5.txt"

Global $iIndex = 0, $sListData6 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list6.txt"
Global $sListFile6 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list6.txt"

Global $iIndex = 0, $sListData7 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list7.txt"
Global $sListFile7 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list7.txt"

Global $iIndex = 0, $sListData8 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list8.txt"
Global $sListFile8 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list8.txt"

Global $iIndex = 0, $sListData9 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list9.txt"
Global $sListFile9 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list9.txt"

Global $iIndex = 0, $sListData10 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list10.txt"
Global $sListFile10 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list10.txt"

Global $iIndex = 0, $sListData11 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list11.txt"
Global $sListFile11 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list11.txt"

Global $iIndex = 0, $sListData12 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list12.txt"
Global $sListFile12 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list12.txt"

Global $iIndex = 0, $sListData13 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list13.txt"
Global $sListFile13 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list13.txt"







; 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

What im tryind to do is to load the filles 'C:Usersjoesoef pcDesktopautoitprogrammalijstenlijsten2variablemaplist1.txt'

so when it starts up it doens't automaticly only opens :"C:Usersjoesoef pcDesktopautoitprogrammalijstenlist8.txt" like in the old script (above second script)

so before it loads I go to $mFiles the $mFiles DOES shown all the file in the  lijsten2 map then I click on map for example: map august, it says : Clicked = August

just like you coded for me then it shows a message with the directory, but then it doesnt load the content I clicked.

I realy dont know what I am doing wrong??

Link to comment
Share on other sites

I also tried this one without the ( ) but dindt work either

$_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"



#Region ### START Koda GUI section ### Form=
$Form1_1_1_1 = GUICreate("form", 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)







;~ $extand = GUICtrlCreateButton("extand", 504, 32, 65, 33)


;~ $iEdit_Section_Start = 30
;~ $iEdit_Section_Height = 250

$iEdit_Section_Start = 30
$iEdit_Section_Height = 210
$iEdit_Section = _GUIExtender_Section_Start($Form1_1_1_1, $iEdit_Section_Start, $iEdit_Section_Height)
_GUIExtender_Section_Action($Form1_1_1_1, $iEdit_Section)
; All control positions can then be related to the section start rather than the GUI  <<<<<<<<<<<<<


; Now you can check that the _Section_Height is correct and amend if necessary  <<<<<<<<<<<<<
_GUIExtender_Section_End($Form1_1_1_1)
_GUIExtender_Section_Extend($Form1_1_1_1, 0, False)




$sPath = @desktopdir & '\autoit\twitter programma\lijsten\lijsten2\'
$hSearch = FileFindFirstFile($sPath & '*.*')


local $mFiles = guictrlcreatemenu('&File')


local $List_Start = guictrlcreatedummy() + 1
While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $mFiles)
WEnd
local $List_End = guictrlcreatedummy() - 1

GUISetState()

local $iMSG
while 1
    $iMSG = guigetmsg()
    switch $iMSG
        case $gui_event_close
            Exit
        case $List_Start to $List_End
            ConsoleWrite('Clicked = ' & guictrlread($iMSG,1) & @CRLF)




$list1 = ("\list1.txt")
$list2 = ("\list2.txt")
$list3 = ("\list3.txt")
$list4 = ("\list4.txt")
$list5 = ("\list5.txt")
$list6 = ("\list6.txt")
$list7 = ("\list7.txt")
$list8 = ("\list8.txt")
$list9 = ("\list9.txt")
$list10 = ("\list10.txt")
$list11 = ("\list11.txt")
$list12 =  ("\list12.txt")
$list13 = ("\list13.txt")
$opgeslagen = @desktopdir & 'C:\Users\joesoef pc\Desktop\autoit\programma\lijsten\lijsten2\'
$laden = guictrlread($iMSG,1) & @CRLF

            MsgBox(1,"file:","" & $opgeslagen & $laden & $list1)

Global $iIndex = 0, $sListData1 = $opgeslagen & $laden & $list1
Global $sListFile1 = $opgeslagen  & $laden & $list1

Global $iIndex = 0, $sListData2 = $opgeslagen & $laden & $list2
Global $sListFile2 = $opgeslagen & $laden & $list2

Global $iIndex = 0, $sListData3 = $opgeslagen & $laden & $list3
Global $sListFile3 = $opgeslagen & $laden & $list3

Global $iIndex = 0, $sListData4 = $opgeslagen & $laden & $list4
Global $sListFile4 = $opgeslagen & $laden & $list4

Global $iIndex = 0, $sListData5 = $opgeslagen & $laden & $list5
Global $sListFile5 = $opgeslagen & $laden & $list4

Global $iIndex = 0, $sListData6 = $opgeslagen & $laden & $list6
Global $sListFile6 = $opgeslagen & $laden & $list6

Global $iIndex = 0, $sListData7 = $opgeslagen & $laden & $list7
Global $sListFile7 = $opgeslagen & $laden & $list7

Global $iIndex = 0, $sListData8 = $opgeslagen & $laden & $list8
Global $sListFile8 = $opgeslagen & $laden & $list8

Global $iIndex = 0, $sListData9 = $opgeslagen & $laden & $list9
Global $sListFile9 = $opgeslagen & $laden & $list9

Global $iIndex = 0, $sListData10 = $opgeslagen & $laden & $list10
Global $sListFile10 = $opgeslagen & $laden & $list10

Global $iIndex = 0, $sListData11 = $opgeslagen & $laden & $list11
Global $sListFile11 = $opgeslagen & $laden & $list11

Global $iIndex = 0, $sListData12 = $opgeslagen & $laden & $list12
Global $sListFile12 = $opgeslagen & $laden & $list12

Global $iIndex = 0, $sListData13 = $opgeslagen & $laden & $list13
Global $sListFile13 = $opgeslagen & $laden & $list13




If FileExists($sListFile1) Then
    $sListData1 = FileRead($sListFile1)
EndIf


GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)




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

    EndSwitch
wend
Link to comment
Share on other sites

This is the script I try to run:

$_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"



#Region ### START Koda GUI section ### Form=
$Form1_1_1_1 = GUICreate("form", 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)







;~ $extand = GUICtrlCreateButton("extand", 504, 32, 65, 33)


;~ $iEdit_Section_Start = 30
;~ $iEdit_Section_Height = 250

$iEdit_Section_Start = 30
$iEdit_Section_Height = 210
$iEdit_Section = _GUIExtender_Section_Start($Form1_1_1_1, $iEdit_Section_Start, $iEdit_Section_Height)
_GUIExtender_Section_Action($Form1_1_1_1, $iEdit_Section)
; All control positions can then be related to the section start rather than the GUI  <<<<<<<<<<<<<


; Now you can check that the _Section_Height is correct and amend if necessary  <<<<<<<<<<<<<
_GUIExtender_Section_End($Form1_1_1_1)
_GUIExtender_Section_Extend($Form1_1_1_1, 0, False)




$sPath = @desktopdir & '\autoit\twitter programma\lijsten\lijsten2\'
$hSearch = FileFindFirstFile($sPath & '*.*')


local $mFiles = guictrlcreatemenu('&File')


local $List_Start = guictrlcreatedummy() + 1
While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $mFiles)
WEnd
local $List_End = guictrlcreatedummy() - 1

GUISetState()

local $iMSG
while 1
    $iMSG = guigetmsg()
    switch $iMSG
        case $gui_event_close
            Exit
        case $List_Start to $List_End
            ConsoleWrite('Clicked = ' & guictrlread($iMSG,1) & @CRLF)




$list1 = ("\list1.txt")
$list2 = ("\list2.txt")
$list3 = ("\list3.txt")
$list4 = ("\list4.txt")
$list5 = ("\list5.txt")
$list6 = ("\list6.txt")
$list7 = ("\list7.txt")
$list8 = ("\list8.txt")
$list9 = ("\list9.txt")
$list10 = ("\list10.txt")
$list11 = ("\list11.txt")
$list12 =  ("\list12.txt")
$list13 = ("\list13.txt")
$opgeslagen = @desktopdir & 'C:\Users\joesoef pc\Desktop\autoit\programma\lijsten\lijsten2\'
$laden = guictrlread($iMSG,1) & @CRLF

            MsgBox(1,"file:","" & $opgeslagen & $laden & $list1)

Global $iIndex = 0, $sListData1 = ($opgeslagen & $laden & $list1)
Global $sListFile1 = ($opgeslagen  & $laden & $list1)

Global $iIndex = 0, $sListData2 = ($opgeslagen & $laden & $list2)
Global $sListFile2 = ($opgeslagen & $laden & $list2)

Global $iIndex = 0, $sListData3 = ($opgeslagen & $laden & $list3)
Global $sListFile3 = ($opgeslagen & $laden & $list3)

Global $iIndex = 0, $sListData4 = ($opgeslagen & $laden & $list4)
Global $sListFile4 = ($opgeslagen & $laden & $list4)

Global $iIndex = 0, $sListData5 = ($opgeslagen & $laden & $list5)
Global $sListFile5 = ($opgeslagen & $laden & $list4)

Global $iIndex = 0, $sListData6 = ($opgeslagen & $laden & $list6)
Global $sListFile6 = ($opgeslagen & $laden & $list6)

Global $iIndex = 0, $sListData7 = ($opgeslagen & $laden & $list7)
Global $sListFile7 = ($opgeslagen & $laden & $list7)

Global $iIndex = 0, $sListData8 = ($opgeslagen & $laden & $list8)
Global $sListFile8 = ($opgeslagen & $laden & $list8)

Global $iIndex = 0, $sListData9 = ($opgeslagen & $laden & $list9)
Global $sListFile9 = ($opgeslagen & $laden & $list9)

Global $iIndex = 0, $sListData10 = ($opgeslagen & $laden & $list10)
Global $sListFile10 = ($opgeslagen & $laden & $list10)

Global $iIndex = 0, $sListData11 = ($opgeslagen & $laden & $list11)
Global $sListFile11 = ($opgeslagen & $laden & $list11)

Global $iIndex = 0, $sListData12 = ($opgeslagen & $laden & $list12)
Global $sListFile12 = ($opgeslagen & $laden & $list12)

Global $iIndex = 0, $sListData13 = ($opgeslagen & $laden & $list13)
Global $sListFile13 = ($opgeslagen & $laden & $list13)




If FileExists($sListFile1) Then
    $sListData1 = FileRead($sListFile1)
EndIf


GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)




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

    EndSwitch
wend

If i do this (the old way) it works pefrect but it only opens the same  file every time:

#Region ### START Koda GUI section ### Form=
$Form1_1_1_1 = GUICreate("form", 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, "")

#EndRegion ### END Koda GUI section ###


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"

Global $iIndex = 0, $sListData2 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list2.txt"
Global $sListFile2 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list2.txt"

Global $iIndex = 0, $sListData3 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list3.txt"
Global $sListFile3 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list3.txt"

Global $iIndex = 0, $sListData4 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list4.txt"
Global $sListFile4 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list4.txt"

Global $iIndex = 0, $sListData5 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list5.txt"
Global $sListFile5 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list5.txt"

Global $iIndex = 0, $sListData6 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list6.txt"
Global $sListFile6 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list6.txt"

Global $iIndex = 0, $sListData7 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list7.txt"
Global $sListFile7 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list7.txt"

Global $iIndex = 0, $sListData8 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list8.txt"
Global $sListFile8 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list8.txt"

Global $iIndex = 0, $sListData9 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list9.txt"
Global $sListFile9 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list9.txt"

Global $iIndex = 0, $sListData10 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list10.txt"
Global $sListFile10 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list10.txt"

Global $iIndex = 0, $sListData11 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list11.txt"
Global $sListFile11 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list11.txt"

Global $iIndex = 0, $sListData12 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list12.txt"
Global $sListFile12 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list12.txt"

Global $iIndex = 0, $sListData13 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list13.txt"
Global $sListFile13 = "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\list13.txt"







; 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

What im tryind to do is to load the filles 'C:Usersjoesoef pcDesktopautoitprogrammalijstenlijsten2variablemaplist1.txt'

so when it starts up it doens't automaticly only opens :"C:Usersjoesoef pcDesktopautoitprogrammalijstenlist8.txt" like in the old script (above second script)

so before it loads I go to $mFiles the $mFiles DOES shown all the file in the  lijsten2 map then I click on map for example: map august, it says : Clicked = August

just like you coded for me then it shows a message with the directory, but then it doesnt load the content I clicked.

I realy dont know what I am doing wrong??

 

Link to comment
Share on other sites

This is my script:

$_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)
_GUIExtender_Init($Form1_1_1_1)
Dim $listnr[11]
Dim $list[15]
Dim $sListFile[15]
Dim $sListData[15]
$Listnr[1] = GUICtrlCreateList("", 0, 64, 145, 358)
GUICtrlSetData(-1, "")
$Listnr[2] = GUICtrlCreateList("", 144, 64, 65, 358)
GUICtrlSetData(-1, "")
$Listnr[3] = GUICtrlCreateList("", 208, 64, 65, 358)
GUICtrlSetData(-1, "")
$Listnr[4] = GUICtrlCreateList("", 344, 64, 153, 358)
GUICtrlSetData(-1, "")
$Listnr[5] = GUICtrlCreateList("", 496, 64, 65, 358)
GUICtrlSetData(-1, "")
$Listnr[6] = GUICtrlCreateList("", 560, 64, 121, 230)
GUICtrlSetData(-1, "")
$Listnr[7] = GUICtrlCreateList("", 680, 64, 65, 230)
GUICtrlSetData(-1, "")
$Listnr[8] = GUICtrlCreateList("", 744, 64, 65, 230)
GUICtrlSetData(-1, "")
$Listnr[9] = GUICtrlCreateList("", 272, 64, 65, 358)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
Local $defaultstatus = "Ready", $filemenu, $fileitem
    Local $helpmenu, $infoitem, $exititem, $recentfilesmenu
    Local $viewmenu, $viewstatusitem, $cancelbutton
    Local $statuslabel, $msg, $file
$filemenu = GUICtrlCreateMenu("&File")
    $fileitem = GUICtrlCreateMenuItem("Open", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $createitem = GUICtrlCreateMenuItem("create", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu("info")
    $registers = GUICtrlCreateMenu("Register")
    $savefile = GUICtrlCreateMenuItem("Save", $filemenu)
    $saveas = GUICtrlCreateMenuItem("Save as", $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
;~ $extand = GUICtrlCreateButton("extand", 504, 32, 65, 33)
; I have found this to be the best way to set the section dimensions - see further comments below  <<<<<<<<<<<<<
;~ $iEdit_Section_Start = 30
;~ $iEdit_Section_Height = 250
$iEdit_Section_Start = 30
$iEdit_Section_Height = 210
$iEdit_Section = _GUIExtender_Section_Start($Form1_1_1_1, $iEdit_Section_Start, $iEdit_Section_Height)
_GUIExtender_Section_Action($Form1_1_1_1, $iEdit_Section)
; All control positions can then be related to the section start rather than the GUI  <<<<<<<<<<<<<
; Now you can check that the _Section_Height is correct and amend if necessary  <<<<<<<<<<<<<
_GUIExtender_Section_End($Form1_1_1_1)
_GUIExtender_Section_Extend($Form1_1_1_1, 0, False)
    $sPath = @desktopdir & '\autoit\twitter programma\lijsten\lijsten2\'
$hSearch = FileFindFirstFile($sPath & '*.*')
local $mFiles = guictrlcreatemenu('&File')
local $List_Start = guictrlcreatedummy() + 1
While True
        $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        GUICtrlCreateMenuItem($sFile, $mFiles)
WEnd
local $List_End = guictrlcreatedummy() - 1
GUISetState()
GUISetState()
Local $iMSG
While 1
    $iMSG = GUIGetMsg()
    Switch $iMSG
        Case $gui_event_close
            Exit
        Case $List_Start To $List_End
            ConsoleWrite('Clicked = ' & GUICtrlRead($iMSG, 1) & @CRLF)
            For $i = 1 To 13
                $list[$i] = ("\list" & $i & ".txt")
            Next
            $opgeslagen = 'C:\Users\joesoef pc\Desktop\autoit\programma\lijsten\lijsten2\'
            $laden =   (guictrlread($iMSG,1) & @CRLF)
            MsgBox(1, "file:", "" & $opgeslagen & $laden & $list[1])
            Global $iIndex = 0
            For $i = 1 To 13
                $sListData[$i] = ($opgeslagen & $laden & $list[$i])
                $sListFile[$i] = ($opgeslagen & $laden & $list[$i])
            Next
            For $i = 1 To 10
                If FileExists($sListFile[$i]) Then
                    $sListData[$i] = FileRead($sListFile[$i])
                    GUICtrlSetData($Listnr[$i], $sListData[$i])
                    _GUICtrlListBox_SetCurSel($Listnr[$i], $iIndex)
                EndIf
            Next
    EndSwitch
WEnd
#EndRegion ### END Koda GUI section ###

I got a few maps that I want to open in: C:Usersjoesoef pcDesktopautoitprogrammalijstenlijsten2<--(a few maps)

In al of these maps there are txt files that It needs to read from list1 to list9 in these files there are names like:  Jack|drake|eric|joseph| etc..

but when I select the map in the "file menu" it doest open the the txt files

please help me

Link to comment
Share on other sites

  • Developers

Een beetje ongeduldig? ;)

Maybe your question is somewhat unclear and it isn;t easy to test your script.

You really should do some debugging first to see what is happening. Using Ctrl+d you can add simply some lines to see what is happening. something like:

For $i = 1 To 10
                ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sListFile[$i] = ' & $sListFile[$i] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
                If FileExists($sListFile[$i]) Then
                    $sListData[$i] = FileRead($sListFile[$i])
                    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sListData[$i] = ' & $sListData[$i] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
                    GUICtrlSetData($Listnr[$i], $sListData[$i])
                    _GUICtrlListBox_SetCurSel($Listnr[$i], $iIndex)
                EndIf
            Next

You need to install the full SciTE4AutoIt3 for this to be available.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thank you finally someone who answers   :)

This is what I got:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijstopen.au3" /UserParams    
+>23:03:41 Starting AutoIt3Wrapper v.2.2.0.0 SciTE v.3.4.1.0   Keyboard:00020409  OS:WIN_8/  CPU:X64 OS:X64    Environment(Language:0413)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\joesoef pc\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\joesoef pc\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.10.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijstopen.au3
+>23:03:41 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijstopen.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
Clicked = domainnames
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list1.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list2.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list3.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list4.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list5.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list6.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list7.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list8.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list9.txt
>Error code: 0
@@ Debug(154) : $sListFile[$i] = C:\Users\joesoef pc\Desktop\autoit\twitter programma\lijsten\lijsten2\domainnames
\list10.txt
>Error code: 0
 

the name of the map I try to open in the Lijsten2 map is "domainnames"  (int this map there are 9 lists.txt) as you can see

Edited by Arclite86
Link to comment
Share on other sites

  • Developers

Simple question that you could ask yourself: does the filename in the array look correct to you?

Looks to me the filename is preceeded by a crlf?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...