Jump to content

creating files/folders with a variable and normal text


Recommended Posts

Hello again,

I'm trying to create a script which will create a folder/file structure.

Example:

 

projectname

projectnameindex.php

projectnamehtml

projectnamehtmlindex.html

projectnamecss

projectnamecssindex.css

 

here's what i have so far:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


#region program form
$FORM = GUICreate("website folder builder v1 by g3mini", 216, 99, 192, 124)
$PHP = GUICtrlCreateCheckbox("", 56, 30, 17, 25)
$HTML = GUICtrlCreateCheckbox("", 56, 49, 17, 25)
$CSS = GUICtrlCreateCheckbox("", 56, 68, 17, 25)
$PHPLABEL = GUICtrlCreateLabel("PHP", 24, 35, 26, 17)
$HTMLLABEL = GUICtrlCreateLabel("HTML", 18, 56, 34, 17)
$CSSLABEL = GUICtrlCreateLabel("CSS", 25, 77, 25, 17)
$NAME = GUICtrlCreateInput("project name", 80, 5, 121, 21)
$NAMELABEL = GUICtrlCreateLabel("project name", 8, 8, 65, 17)
$GO = GUICtrlCreateButton("create website", 80, 32, 123, 49)
GUICtrlSetFont(-1, 35, 400, 0, "Parchment")
GUISetState(@SW_SHOW)
#endregion program form


$PHPP = 0
$HTMLL = 0
$CSSS = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $FORM
        Case $FORM
        Case $FORM
        Case $FORM
        Case $PHP
            $PHPP = 1
        Case $HTML
            $HTMLL = 1
        Case $CSS
            $CSSS = 1
        Case $PHPLABEL
        Case $HTMLLABEL
        Case $CSSLABEL
        Case $NAME
        Case $NAMELABEL
        Case $GO
            $naam = GUICtrlRead($NAME)
            DirCreate($naam)
            If ($PHPP == 1) Then
                FileWrite($naam"\index.php", "<?php")
            EndIf
            If ($HTMLL == 1) Then
                DirCreate($naam"\html")
                FileWrite($naam"\html\index.html", "")
            EndIf
            If ($CSSS == 1) Then
                DirCreate($naam"\html\css")
                FileWrite($naam"\html\css\index.css", "")
            EndIf


    EndSwitch
WEnd

I get errors on the $naam"html" etc,

Could anyone please tell me how to add *normal text* to a variable

so that i get the following example:

$naam = "websitetest"

and then it creates "websitetestindex.php"

thanks =)

dh.

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

×
×
  • Create New...