Sign in to follow this  
Followers 0
Pottery

Write directory to a text file.

5 posts in this topic

#1 ·  Posted (edited)

Hey, I made this for a family member because he has a list of movies and wanted to make a text file contraining all of the movie names so I thought I'd share this; it could be useful I suppose :D

Bath version:

$path = IniRead("settings.ini", "path", "folder path", "default")

If $Path = "default" Then
    MsgBox(64, "Error", "Error - setup your folder path in settings.ini!")
    ShellExecute("settings.ini", "", "", "edit")
    Exit
EndIf

Run("cmd.exe")
Sleep(200)
Send("cd " & $path & "{enter}")
Sleep(100)
Send("dir > list.txt" & "{enter}")
Sleep(100)
ProcessClose("cmd.exe")
Sleep(200)
ShellExecute("list.txt", "", $path, "edit")

AutoIt3 functions version:

#include <File.au3>

$myList = _FileListToArray(@MyDocumentsDir)
_FileCreate(@DesktopDir & "\List.txt")
_FileWriteFromArray(@DesktopDir & "\List.txt", $myList)

It's not much, but I find it useful. Thanks, Exhalt.

*EDIT*

Added AutoIt3 function version.

DirectoryToText.rar

Edited by Exhalt

Share this post


Link to post
Share on other sites



By the way, I know there are AutoIt functions to do this but I just did this quick for someone; I'll post one using AutoIt functions tomorrow :D

Share this post


Link to post
Share on other sites

By the way, I know there are AutoIt functions to do this but I just did this quick for someone; I'll post one using AutoIt functions tomorrow :D

Would it not have been just as quick in the first place to use _FileListToArray and _FileWriteFromArray?

Share this post


Link to post
Share on other sites

As I said, I would post this today. I made it quick without thinking about it for someone; here's the script.

#include <File.au3>

$myList = _FileListToArray(@MyDocumentsDir)
_FileCreate(@DesktopDir & "\List.txt")
_FileWriteFromArray(@DesktopDir & "\List.txt", $myList)

Share this post


Link to post
Share on other sites

As I said, I would post this today. I made it quick without thinking about it for someone; here's the script.

#include <File.au3>

$myList = _FileListToArray(@MyDocumentsDir)
_FileCreate(@DesktopDir & "\List.txt")
_FileWriteFromArray(@DesktopDir & "\List.txt", $myList)

Uhh...what?

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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