Sign in to follow this  
Followers 0
AlmarM

Getting a file name

21 posts in this topic

Hello,

Im a bit tired and not thinking realy clearly, so could anyone help me on this one?

FileOpenDialog returns the path of the file the user selects, now what I want is just the file name.

For example, the user opens 'C:\temp\example.txt' I want 'example'.

Hope you understand.

Any help is welcome :)

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello,

Im a bit tired and not thinking realy clearly, so could anyone help me on this one?

FileOpenDialog returns the path of the file the user selects, now what I want is just the file name.

For example, the user opens 'C:\temp\example.txt' I want 'example'.

Hope you understand.

Any help is welcome :)

AlmarM

$FILE = FileOpenDialog("SELECT",@ScriptDir,"Text (*.txt)",1)
$SPLIT = StringSplit($FILE,"\")
$SPLIT = StringSplit($SPLIT[$SPLIT[0]],".")
MsgBox(0,"FILE",$SPLIT[1])
Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello,

Im a bit tired and not thinking realy clearly, so could anyone help me on this one?

FileOpenDialog returns the path of the file the user selects, now what I want is just the file name.

For example, the user opens 'C:\temp\example.txt' I want 'example'.

Hope you understand.

Any help is welcome :)

AlmarM

Hi,

I see that's you're tired for not search on forum.. anyway I know this function long time ago

Here you go

$file=Fileopendialog("")
$name=StringSplit($file,'\')
Msgbox(64,"","Name of file : "&$name[$name[0]])

Edit : Then you can remove extension :

StringTrimRight($name[$name[0]],4)
Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thx, both of you :)

AlmarM

EDIT:

Could you also help me on this on?

$fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
        If @error Then
        Else
            $Read = IniReadSectionNames($fod)
            For $i = 1 To $Read[0]
                $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
            Next
        EndIf

This is my error

C:\Documents and Settings\Gortstraat_41\Bureaublad\Test File.au3 (22) : ==> Expected a "=" operator in assignment statement.:
$TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
$TV_Section^ ERROR
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

LOL Andreik had completly wrong and when he sees my post he changes one's.... :)

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Thx, both of you :)

AlmarM

EDIT:

Could you also help me on this on?

$fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
        If @error Then
        Else
            $Read = IniReadSectionNames($fod)
            For $i = 1 To $Read[0]
                $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
            Next
        EndIf

This is my error

C:\Documents and Settings\Gortstraat_41\Bureaublad\Test File.au3 (22) : ==> Expected a "=" operator in assignment statement.:
$TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
$TV_Section^ ERROR
$TV_Section is an array?

When the words fail... music speaks

Share this post


Link to post
Share on other sites

LOL Andreik had completly wrong and when he sees my post he changes one's.... :)

I missunderstand, I though he want an example for FileOpenDialog. :)

If you are so good speaker of english, very well, I`m not so good.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Well, I tried something with arrays, look at my full code.

Global $Name

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 200)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $File_Open
        $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
        If @error Then
        Else
            $Split = StringSplit($fod, "\")
            $Trim = StringTrimRight($Split[$Split[0]], 4)
            GUICtrlSetData($Name, $Trim)
            $Read = IniReadSectionNames($fod)
        EndIf
    EndSelect
WEnd

I need a Global $TV_Section[Number Of Sections Read Here]

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@AlmarM

I don't know if it's impossible but when I try to create ctrl with varaible like yours ($I) I've error...

I see that you want to create list view so here you go

;you have created some list view items
;you have selected list view item
;your list view is named $list here 

_Read()
Func _Read()
$read=GuiCtrlRead(GuiCtrlRead($list))
;here you show what's written on
MsgBox(64,"",$read)
;then you delete it for example
GuiCtrlDelete($read);not tested
EndFunc

You've edited you're last post ?

Now my reply is useless...

Edit : Ive missed some replys, this one is for the #4

Edit2 : omg you have used treeview item and I read listview... I have to go to sleep now... :)

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@Andreik

I didn't want to offence you... not at all.

I just found it funny that you've edited your post for write approximatly the same thing like me, you could simply delete it :)

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Try this:

Global $Name
Global $TV_Section

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 200)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case -3
            Exit
        Case $File_Open
            $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
            
            If Not @error Then
                $FileName = StringRegExpReplace($fod, "^.*\\|\..{1,10}$", "")
                GUICtrlSetData($Name, $FileName)
                
                $Read = IniReadSectionNames($fod)
                
                Dim $TV_Section[$Read[0]+1]
                
                For $i = 1 To $Read[0]
                    $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
                Next
            EndIf
    EndSwitch
WEnd

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Global $Name

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 200)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = -3
        Exit
    Case $nMsg = $File_Open
        $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
        If @error Then
        Else
            $Split = StringSplit($fod, "\")
            $Trim = StringTrimRight($Split[$Split[0]], 4)
            GUICtrlSetData($Name, $Trim)
            $Read = IniReadSectionNames($fod)
            For $i = 1 To $Read[0]
                $TV_Section = GUICtrlCreateTreeViewItem($Read[$i], $TV)
            Next
        EndIf
    EndSelect
WEndoÝ÷ Ù8b³¥
+»­"wvÚ­æ­zÊ&zaz´ëyåb{-zh§¶è­ìZ^MTrبDáyø«²Ôrب fj³?²ÚâäáÄË­æ­¡î¶ËbR0j{m¡Ú,¢g­)à)¶¬jëh×6Global $Name
Global $TV_Section

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 200)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case -3
            Exit
        Case $File_Open
            $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
            If Not @error Then
                $FileName = StringRegExpReplace($fod, "^.*\\|\..{1,10}$", "")
                GUICtrlSetData($Name, $FileName)
                $Read = IniReadSectionNames($fod)
                Dim $TV_Section[$Read[0]+1]
                For $i = 1 To $Read[0]
                    $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
                Next
                GUICtrlCreateTreeViewItem("Test", $TV_Section[0])
            EndIf
    EndSwitch
WEnd
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

@Andreik

I didn't want to offence you... not at all.

I just found it funny that you've edited your post for write approximatly the same thing like me, you could simply delete it :)

And still your code is not work for any file extension, so I do not know what you want to show, you want to tell you that you are very good scripter and me a very bad one, if it makes you feel better I say.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

@AlmarM

Note : If it's about StringRegExpReplace you can use StringReplace or StringRegExpMultiReplace (by MrCreator) because this function isn't very good and usefull


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@Andreik

Not at all...Im not good scripter and I think that you're better than me; now if you want, I close this subject between us...


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

@AlmarM

Note : If it's about StringRegExpReplace you can use StringReplace or StringRegExpMultiReplace (by MrCreator) because this function isn't very good and usefull

No its about this, Thx to MrCreatoR I now have $TV_Secion[$i], now I want to create new TreeViewItems into the $TV_Section[$i].

And by the way, you are both good scripters, so what are you talking about :)

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

I want to do something like this

So what is the problem, instead of [0] use [1] (the loop starting from 1, so the controls begins there), or if you want add it to the last id, then use [$Read[0]] :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

So what is the problem, instead of [0] use [1] (the loop starting from 1, so the controls begins there), or if you want add it to the last id, then use [$Read[0]] :)

This doens't work

Global $Name
Global $TV_Section

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 200)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case -3
            Exit
        Case $File_Open
            $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
            If Not @error Then
                $FileName = StringRegExpReplace($fod, "^.*\\|\..{1,10}$", "")
                GUICtrlSetData($Name, $FileName)
                $Read = IniReadSectionNames($fod)
                Dim $TV_Section[$Read[0]+1]
                For $i = 1 To $Read[0]
                    $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
                Next
                GUICtrlCreateTreeViewItem("Test", $TV_Section[1])
            EndIf
    EndSwitch
WEnd
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

This doens't work

Global $Name
Global $TV_Section

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 200)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case -3
            Exit
        Case $File_Open
            $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
            If Not @error Then
                $FileName = StringRegExpReplace($fod, "^.*\\|\..{1,10}$", "")
                GUICtrlSetData($Name, $FileName)
                $Read = IniReadSectionNames($fod)
                Dim $TV_Section[$Read[0]+1]
                For $i = 1 To $Read[0]
                    $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
                Next
                GUICtrlCreateTreeViewItem("Test", $TV_Section[1])
            EndIf
    EndSwitch
WEnd
It's working, it's just the items should be updated somehow (don't remember how right now), just try to click on the first item :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

don't remember how right now

I remember now, it's «ReadrawWindow» :)

Global $Name
Global $TV_Section

$GUI = GUICreate("Open .ini", 500, 500, -1, -1)
$File = GUICtrlCreateMenu("File")
$File_Open = GUICtrlCreateMenuItem("Open", $File)
$File_Save = GUICtrlCreateMenuItem("Save", $File)
GUICtrlCreateMenuItem("", $File)
$File_Exit = GUICtrlCreateMenuItem("Exit", $File)
$Name = GUICtrlCreateLabel("", 10, 10, 200, 25)
$TV = GUICtrlCreateTreeView(10, 30, 300, 300)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case -3
            Exit
        Case $File_Open
            $fod = FileOpenDialog("Select .ini", @DesktopDir, "Initialization File (*.ini)", 11, "", $GUI)
            If Not @error Then
                $FileName = StringRegExpReplace($fod, "^.*\\|\..{1,10}$", "")
                GUICtrlSetData($Name, $FileName)
                
                $Read = IniReadSectionNames($fod)
                Dim $TV_Section[$Read[0]+1]
                
                For $i = 1 To $Read[0]
                    $TV_Section[$i] = GUICtrlCreateTreeViewItem($Read[$i], $TV)
                Next
                
                GUICtrlCreateTreeViewItem("Test", $TV_Section[1])
                DllCall("User32.dll", "int", "RedrawWindow", "hwnd", GUICtrlGetHandle($TV), "ptr", 0, "int", 0, "int", 5)
            EndIf
    EndSwitch
WEnd

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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