Sign in to follow this  
Followers 0
SKhan

execute from file

3 posts in this topic

#1 ·  Posted (edited)

9Hello, I want my program to read a .TXT file and add Tree-View Items to the existing GUI and existing Tree-view control.

This is my AU3 script, which unfortunately doesnt work... probably because the function "EXECUTE" has many limitations...

the TXT file was way too large so i shrunk it down

DirList.TXT

$TI1 = GUICtrlCreateTreeViewItem('C:\Users\****\******\****\C***t E****e', $TI0)
$TI2 = GUICtrlCreateTreeViewItem('Addresses-4468.TMP', $TI1)
$TI3 = GUICtrlCreateTreeViewItem('Addresses-5808.TMP', $TI1)
$TI4 = GUICtrlCreateTreeViewItem('Addresses-5844.TMP', $TI1)
$TI5 = GUICtrlCreateTreeViewItem('Addresses.TMP', $TI1)
$TI6 = GUICtrlCreateTreeViewItem('ADDRESSESFIRST.TMP', $TI1)
$TI7 = GUICtrlCreateTreeViewItem('allochook.dll', $TI1)
$TI8 = GUICtrlCreateTreeViewItem('Black.bmp', $TI1)
$TI9 = GUICtrlCreateTreeViewItem('CEHook.dll', $TI1)
$TI10 = GUICtrlCreateTreeViewItem('ceregreset.exe', $TI1)
$TI11 = GUICtrlCreateTreeViewItem('C***t E****e.exe', $TI1)
$TI12 = GUICtrlCreateTreeViewItem('C***tE****e.chm', $TI1)
$TI13 = GUICtrlCreateTreeViewItem('commonmodulelist.txt', $TI1)
$TI14 = GUICtrlCreateTreeViewItem('dbghelp.dll', $TI1)
$TI15 = GUICtrlCreateTreeViewItem('dbk32.dll', $TI1)
$TI16 = GUICtrlCreateTreeViewItem('dbk32.sys', $TI1)
$TI17 = GUICtrlCreateTreeViewItem('dbk64.sys', $TI1)
$TI18 = GUICtrlCreateTreeViewItem('desktop.ini', $TI1)
$TI19 = GUICtrlCreateTreeViewItem('dxhook.dll', $TI1)
$TI20 = GUICtrlCreateTreeViewItem('EmptyDLL.dll', $TI1)
$TI21 = GUICtrlCreateTreeViewItem('EmptyProcess.exe', $TI1)
$TI22 = GUICtrlCreateTreeViewItem('example scripts', $TI1)
$TI23 = GUICtrlCreateTreeViewItem('changeregtest.CEC', $TI22)
$TI24 = GUICtrlCreateTreeViewItem('gettime.CEC', $TI22)
$TI25 = GUICtrlCreateTreeViewItem('sleepcall.CEC', $TI22)
$TI26 = GUICtrlCreateTreeViewItem('step10.CEC', $TI22)
$TI27 = GUICtrlCreateTreeViewItem('testscript.CEC', $TI22)
$TI28 = GUICtrlCreateTreeViewItem('timermess.CEC', $TI22)
$TI29 = GUICtrlCreateTreeViewItem('include', $TI1)
$TI30 = GUICtrlCreateTreeViewItem('algorithm', $TI29)
$TI31 = GUICtrlCreateTreeViewItem('assert.h', $TI29)
$TI32 = GUICtrlCreateTreeViewItem('cctype', $TI29)
$TI33 = GUICtrlCreateTreeViewItem('classlib.h', $TI29)
$TI34 = GUICtrlCreateTreeViewItem('cmath', $TI29)
$TI35 = GUICtrlCreateTreeViewItem('cstdarg.txt', $TI29)
$TI36 = GUICtrlCreateTreeViewItem('cstdio', $TI29)
$TI37 = GUICtrlCreateTreeViewItem('cstdlib', $TI29)
$TI38 = GUICtrlCreateTreeViewItem('cstring', $TI29)
$TI39 = GUICtrlCreateTreeViewItem('foreach2.h', $TI29)
$TI40 = GUICtrlCreateTreeViewItem('for_each.h', $TI29)
$TI41 = GUICtrlCreateTreeViewItem('fstream', $TI29)
$TI42 = GUICtrlCreateTreeViewItem('fstream.h', $TI29)
$TI43 = GUICtrlCreateTreeViewItem('glib.h', $TI29)
$TI44 = GUICtrlCreateTreeViewItem('header.cpp', $TI29)
$TI45 = GUICtrlCreateTreeViewItem('io.h', $TI29)
$TI46 = GUICtrlCreateTreeViewItem('iostream', $TI29)
$TI47 = GUICtrlCreateTreeViewItem('iostream.h', $TI29)
$TI48 = GUICtrlCreateTreeViewItem('list', $TI29)
$TI49 = GUICtrlCreateTreeViewItem('list.new', $TI29)
$TI50 = GUICtrlCreateTreeViewItem('listx', $TI29)
$TI51 = GUICtrlCreateTreeViewItem('malloc.h', $TI29)
$TI52 = GUICtrlCreateTreeViewItem('map', $TI29)
$TI53 = GUICtrlCreateTreeViewItem('math.h', $TI29)
$TI54 = GUICtrlCreateTreeViewItem('new-stdlib.h', $TI29)
$TI55 = GUICtrlCreateTreeViewItem('old-string', $TI29)
$TI56 = GUICtrlCreateTreeViewItem('regexp.h', $TI29)
$TI57 = GUICtrlCreateTreeViewItem('rx++.h', $TI29)
$TI58 = GUICtrlCreateTreeViewItem('self.imp', $TI29)
$TI59 = GUICtrlCreateTreeViewItem('sstream', $TI29)
$TI60 = GUICtrlCreateTreeViewItem('stdarg.h', $TI29)
$TI61 = GUICtrlCreateTreeViewItem('stddef.h', $TI29)
$TI62 = GUICtrlCreateTreeViewItem('stdio.h', $TI29)
$TI63 = GUICtrlCreateTreeViewItem('stdlib.h', $TI29)
$TI64 = GUICtrlCreateTreeViewItem('string', $TI29)
$TI65 = GUICtrlCreateTreeViewItem('string.h', $TI29)
$TI66 = GUICtrlCreateTreeViewItem('strstrea.h', $TI29)
$TI67 = GUICtrlCreateTreeViewItem('strstream.h', $TI29)
$TI68 = GUICtrlCreateTreeViewItem('test-stdarg.uc', $TI29)
$TI69 = GUICtrlCreateTreeViewItem('time.h', $TI29)
$TI70 = GUICtrlCreateTreeViewItem('turtle.h', $TI29)
$TI71 = GUICtrlCreateTreeViewItem('ucri.h', $TI29)
$TI72 = GUICtrlCreateTreeViewItem('uc_except.h', $TI29)
$TI73 = GUICtrlCreateTreeViewItem('uc_save.h', $TI29)
$TI74 = GUICtrlCreateTreeViewItem('uc_timer.h', $TI29)
$TI75 = GUICtrlCreateTreeViewItem('vector', $TI29)
$TI76 = GUICtrlCreateTreeViewItem('vector.h', $TI29)
$TI77 = GUICtrlCreateTreeViewItem('winbase.h', $TI29)
$TI78 = GUICtrlCreateTreeViewItem('windows.h', $TI29)
$TI79 = GUICtrlCreateTreeViewItem('wininet.h', $TI29)
$TI80 = GUICtrlCreateTreeViewItem('winuser.h', $TI29)
$TI81 = GUICtrlCreateTreeViewItem('yawl.h', $TI29)
$TI82 = GUICtrlCreateTreeViewItem('_end_shared.h', $TI29)
$TI83 = GUICtrlCreateTreeViewItem('_shared_lib.h', $TI29)
$TI84 = GUICtrlCreateTreeViewItem('Kernelmoduleunloader.exe', $TI1)
$TI85 = GUICtrlCreateTreeViewItem('LockedString.bmp', $TI1)
$TI86 = GUICtrlCreateTreeViewItem('Locktexture.bmp', $TI1)
$TI87 = GUICtrlCreateTreeViewItem('MEMORYFIRST.TMP', $TI1)
$TI88 = GUICtrlCreateTreeViewItem('movementtexture.bmp', $TI1)
$TI89 = GUICtrlCreateTreeViewItem('Plugins', $TI1)
$TI90 = GUICtrlCreateTreeViewItem('cepluginsdk.h', $TI89)
$TI91 = GUICtrlCreateTreeViewItem('cepluginsdk.pas', $TI89)
$TI92 = GUICtrlCreateTreeViewItem('DebugEventLog', $TI89)
$TI93 = GUICtrlCreateTreeViewItem('DebugEventLog.dll', $TI92)
$TI94 = GUICtrlCreateTreeViewItem('src', $TI92)
$TI95 = GUICtrlCreateTreeViewItem('DebugEventLog.cfg', $TI94)
$TI96 = GUICtrlCreateTreeViewItem('DebugEventLog.dpr', $TI94)
$TI97 = GUICtrlCreateTreeViewItem('DebugEventLog.res', $TI94)
$TI98 = GUICtrlCreateTreeViewItem('exportimplementation.pas', $TI94)
$TI99 = GUICtrlCreateTreeViewItem('frmEventLogUnit.dfm', $TI94)
$TI100 = GUICtrlCreateTreeViewItem('frmEventLogUnit.pas', $TI94)
$TI101 = GUICtrlCreateTreeViewItem('example packet editor', $TI89)
$TI102 = GUICtrlCreateTreeViewItem('inject', $TI101)
$TI103 = GUICtrlCreateTreeViewItem('src', $TI102)
$TI104 = GUICtrlCreateTreeViewItem('cepe.cfg', $TI103)
$TI105 = GUICtrlCreateTreeViewItem('cepe.dof', $TI103)
$TI106 = GUICtrlCreateTreeViewItem('cepe.dpr', $TI103)
$TI107 = GUICtrlCreateTreeViewItem('cepe.res', $TI103)
$TI108 = GUICtrlCreateTreeViewItem('filterform.dfm', $TI103)
$TI109 = GUICtrlCreateTreeViewItem('filterform.pas', $TI103)
$TI110 = GUICtrlCreateTreeViewItem('hexedit.pas', $TI103)
$TI111 = GUICtrlCreateTreeViewItem('mainunit.dfm', $TI103)
$TI112 = GUICtrlCreateTreeViewItem('mainunit.pas', $TI103)
$TI113 = GUICtrlCreateTreeViewItem('packetfilter.pas', $TI103)
$TI114 = GUICtrlCreateTreeViewItem('src', $TI101)
$TI115 = GUICtrlCreateTreeViewItem('injector.pas', $TI114)
$TI116 = GUICtrlCreateTreeViewItem('packeteditor.cfg', $TI114)
$TI117 = GUICtrlCreateTreeViewItem('packeteditor.dof', $TI114)
$TI118 = GUICtrlCreateTreeViewItem('packeteditor.dpr', $TI114)
$TI119 = GUICtrlCreateTreeViewItem('packeteditor.res', $TI114)
$TI120 = GUICtrlCreateTreeViewItem('Unit1.pas', $TI114)
$TI121 = GUICtrlCreateTreeViewItem('example-c', $TI89)
$TI122 = GUICtrlCreateTreeViewItem('example-c.c', $TI121)
$TI123 = GUICtrlCreateTreeViewItem('example-c.def', $TI121)
$TI124 = GUICtrlCreateTreeViewItem('example-c.dll', $TI121)
$TI125 = GUICtrlCreateTreeViewItem('example-c.sln', $TI121)
$TI126 = GUICtrlCreateTreeViewItem('example-c.vcproj', $TI121)
$TI127 = GUICtrlCreateTreeViewItem('example-delphi', $TI89)
$TI128 = GUICtrlCreateTreeViewItem('exampleplugin.cfg', $TI127)
$TI129 = GUICtrlCreateTreeViewItem('exampleplugin.dll', $TI127)
$TI130 = GUICtrlCreateTreeViewItem('exampleplugin.dof', $TI127)
$TI131 = GUICtrlCreateTreeViewItem('exampleplugin.dpr', $TI127)
$TI132 = GUICtrlCreateTreeViewItem('exampleplugin.res', $TI127)
$TI133 = GUICtrlCreateTreeViewItem('Unit1.pas', $TI127)
$TI134 = GUICtrlCreateTreeViewItem('speedhack.dll', $TI1)
$TI135 = GUICtrlCreateTreeViewItem('Systemcallretriever.exe', $TI1)
$TI136 = GUICtrlCreateTreeViewItem('systemcallsignal.exe', $TI1)
$TI137 = GUICtrlCreateTreeViewItem('targettexture.bmp', $TI1)
$TI138 = GUICtrlCreateTreeViewItem('TextureString.bmp', $TI1)
$TI139 = GUICtrlCreateTreeViewItem('Tutorial.exe', $TI1)
$TI140 = GUICtrlCreateTreeViewItem('ucc12.dll', $TI1)
$TI141 = GUICtrlCreateTreeViewItem('undercdll.dll', $TI1)
$TI142 = GUICtrlCreateTreeViewItem('UnLockedString.bmp', $TI1)
$TI143 = GUICtrlCreateTreeViewItem('vmdisk.img', $TI1)

DIRCHECK.au3

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <File.au3>

Global $JPG[3]

$Log = @ScriptDir & "\DirList.txt"
$JPG[0] = "C:\*****\****\******\****\*******\***** *****\BG.jpg"
$JPG[1] = 515 ;JPG WIDTH
$JPG[2] = 275 ;JPG HEIGHT

$F = 3

$GUI = GUICreate("Directory Path", $JPG[1], $JPG[2], @DesktopWidth / 2 - $JPG[1] / 2, @DesktopHeight / 2 - $JPG[2] / 2, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_ACCEPTFILES)

$TI0 = GUICtrlCreateTreeView($JPG[1] / 2 - 85, $JPG[2] / 2 - 102, 320, 212, $WS_BORDER)

$Background = GUICtrlCreatePic($JPG[0], 0, 0, $JPG[1], $JPG[2], BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW, $GUI)


If FileExists($Log) = 1 Then
    $nLines = _FileCountLines($Log)
    $FileHandle = FileOpen(@ScriptDir & "\DirList.txt", 0)
    If Not @error Then
        For $L = 1 To $nLines
            $CL = FileReadLine($FileHandle, $L)
            Execute($CL)
        Next
    EndIf
EndIf

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
Edited by SNawazK786

Share this post


Link to post
Share on other sites



I don not know what you want to achieve, but if you have an array which you want to see as a treeview then ...

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Global $hTreeView
Global $YourFileList = StringSplit('bla.h,hugo.c,test.cpp,etc.log', ',')

_Main()

Func _Main()

    Local $GUI, $hItem
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    $GUI = GUICreate("(UDF Created) TreeView Create", 400, 300)

    $hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

;~  GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 1 To UBound($YourFileList) -1
        $hItem = _GUICtrlTreeView_Add($hTreeView, 0, $YourFileList[$x])
        For $y = 1 To Random(2, 10, 1)
            _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
        Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

The array could be the return value of _FileListToArray

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

So I guess I figured it out... I used an alternative way...

My "BackUp" program zips up selected files & folders and then, by using FileWrite, it records the path and file names and saves it to (previously a TXT), but now it saves it to an AU3 file. I modified it so that it writes the whole GUI script to Paths.AU3, so that when the "LIST" button is clicked.... then using Run('"AutoIt3.exe" "' & @ScriptDir & '\Paths.au3"')

its a little bit less efficient and may be buggy... but i can work around it.

thanks for the help... but i will take the easier alternative for this one :) haha

Share this post


Link to post
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
Sign in to follow this  
Followers 0