Jump to content
Sign in to follow this  
sinschild

GUI box to create directory structure and populate with files

Recommended Posts

sinschild

I have been trying to create an autoit script that will do the following:

Upon execution, it will pop a gui box asking for an item name, in my case a domain name.

It will take the input and create a directory structure and populate it with files needed to keep the domain organized.

I currently create the following structure and files with a old fashioned batch file, the files are copied from a directory and renamed to match the directory structure.

mkdir test_com

Cd test_com

mkdir Images

mkdir Themes

Cd Themes

mkdir Original

mkdir Finished

mkdir Optimized

cd..

mkdir Plugins

mkdir Database

cd Database

mkdir Original

mkdir Finished

mkdir Optimized

cd..

mkdir Backups

cd backups

mkdir Original

mkdir Finished

mkdir Optimized

cd..

mkdir Content

cd Content

mkdir "Original Articles"

mkdir "Spinner Articles"

mkdir "Spun Articles"

cd "Spun Articles"

mkdir Fresh

mkdir Used

cd..

cd..

mkdir "Project Documents"

cd "project documents"

mkdir "Account Information"

mkdir "Nuke Files for Project"

mkdir "Affiliate Links and Information for Project"

mkdir "Business Plan for Project"

Copy Domain_TLD.xls d:\test_com\"Project Documents"\test_com.xls

Copy Domain_TLD_Monetization.xls d:\test_com\"Project Documents"\test_com_monetization.xls

Copy Domain_TLD_Keyword.xls d:\test_com\"Project Documents"\test_com_Keyword.xls

There are many other files that go with this project, but my sticking point in translating this to autoit is taking the input from the text gui box and using it as a variable to name the directory and files.

Can anyone point me in the right direction? Or has something similar been documented? I searched and found and example, but it is just not making sense to me.

Thank you in advance.

Share this post


Link to post
Share on other sites
martin

I have been trying to create an autoit script that will do the following:

Upon execution, it will pop a gui box asking for an item name, in my case a domain name.

It will take the input and create a directory structure and populate it with files needed to keep the domain organized.

I currently create the following structure and files with a old fashioned batch file, the files are copied from a directory and renamed to match the directory structure.

mkdir test_com

Cd test_com

mkdir Images

mkdir Themes

Cd Themes

mkdir Original

mkdir Finished

mkdir Optimized

cd..

mkdir Plugins

mkdir Database

cd Database

mkdir Original

mkdir Finished

mkdir Optimized

cd..

mkdir Backups

cd backups

mkdir Original

mkdir Finished

mkdir Optimized

cd..

mkdir Content

cd Content

mkdir "Original Articles"

mkdir "Spinner Articles"

mkdir "Spun Articles"

cd "Spun Articles"

mkdir Fresh

mkdir Used

cd..

cd..

mkdir "Project Documents"

cd "project documents"

mkdir "Account Information"

mkdir "Nuke Files for Project"

mkdir "Affiliate Links and Information for Project"

mkdir "Business Plan for Project"

Copy Domain_TLD.xls d:\test_com\"Project Documents"\test_com.xls

Copy Domain_TLD_Monetization.xls d:\test_com\"Project Documents"\test_com_monetization.xls

Copy Domain_TLD_Keyword.xls d:\test_com\"Project Documents"\test_com_Keyword.xls

There are many other files that go with this project, but my sticking point in translating this to autoit is taking the input from the text gui box and using it as a variable to name the directory and files.

Can anyone point me in the right direction? Or has something similar been documented? I searched and found and example, but it is just not making sense to me.

Thank you in advance.

This would be very easy in AutoIt once you've learnt a bit.

Except that your batch file seems to end up in test_com\"Project Documents", so how does it copy Domain_TLD.xls which cannot be in that folder?

For the initial input look up InputBox.

To make the directories would be simpler because the DirCreate function can be used in one line to set a number of nested directories which in a DOS batch file have to be made one at a time.

The files can be copied with FileCopy.

For example this bit

mkdir test_com
Cd test_com
mkdir Images
mkdir Themes
Cd Themes
mkdir Original
mkdir Finished
mkdir Optimized

can be done like this, where the user gives a name instead of test_com

$Folder = inputbox("Back up Domain XYZ","Folder Name","test_com","",400,100)
if $Folder = '' then Exit
DirCreate($Folder & '\Images');creates 2 folders
DirCreate($Folder & '\Themes\Original\Finished');creates 2 more
DirCreate($Folder & '\Optimized')

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
sinschild

This would be very easy in AutoIt once you've learnt a bit.

Except that your batch file seems to end up in test_com\"Project Documents", so how does it copy Domain_TLD.xls which cannot be in that folder?

For the initial input look up InputBox.

To make the directories would be simpler because the DirCreate function can be used in one line to set a number of nested directories which in a DOS batch file have to be made one at a time.

The files can be copied with FileCopy.

For example this bit

mkdir test_com
Cd test_com
mkdir Images
mkdir Themes
Cd Themes
mkdir Original
mkdir Finished
mkdir Optimized

can be done like this, where the user gives a name instead of test_com

$Folder = inputbox("Back up Domain XYZ","Folder Name","test_com","",400,100)
if $Folder = '' then Exit
DirCreate($Folder & '\Images');creates 2 folders
DirCreate($Folder & '\Themes\Original\Finished');creates 2 more
DirCreate($Folder & '\Optimized')

The input function was what I was missing. I have the rest using the ability to create full paths with "FileCopy ( "source", "dest" [,8] )" It just never occurred to me that the input box would be that simple.

Thank you very much :-)

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  

×