Jump to content
Sign in to follow this  
dragonheard

creating files/folders with a variable and normal text

Recommended Posts

dragonheard

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.

Share this post


Link to post
Share on other sites
FireFox

The concatenation is made with the ampersand character.

e.g :

FileWrite($naam & "\index.php", "<?php")

Br, 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

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  

  • Similar Content

    • Gowrisankar
      By Gowrisankar
      Dear members, 
      I am working on a project where, emails from outlook are to be read and moved to various folders within the mailbox, based on the content of the emails.
      I used the below code for moving mails. It works fine when I run it against individual mail ids. But when I run it on Shared mailbox, the mails are not moved to respective folders.
      _OL_ItemMove($oOutlook, $sEntryId, Default, $sDestinationFolder) The value of $sEntryId is saved in an excel report initially. The current process reads the $sEntryId from the excel and passes it to "_OL_ItemMove" statement.
      Requesting the guidance of the forum members in this issue.
    • nacerbaaziz
      By nacerbaaziz
      Hello
      I have a query please
      It is about windows file explorer
      If i design a tool in autoit language to delete files for example
      and i  added it in the context menu in File Explorer
      If i right-click on any file And you choose the tool, it will be get the path of the selected file or folder
      The problem here is
      If i select a set of files or folders
      it only detect the first one
      The code that i  used is
      if $CMDLine[0] = 0 then
      msgBox(16, "error", "you don't selecte any files")
      exit
      else
      for $i = 1 to $CMDLine[0]
      msgBox(0, "files", $CMDLine[$i]
      next
      endIf
      exit
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an inquiry and I hope to find the answer here
      I want to create a graphical user interface
      but I want to hide the system menu
      I mean the window menu
      Is this possible?
      If is possible please give me how to do that
      Thanks in advance
    • Gowrisankar
      By Gowrisankar
      Dear members,
      I'm trying to move unread mails from Inbox to a different folder using OutlookEx UDF.
      But its not working for me. I'm not sure what mistake I do.
      I get the error code 6 when the following is executed. From the UDF it is observed that  "No or an invalid item has been specified".
      Note : The UDF version is 1.3.3.1. AutoIt version (v3.3.14.2).
      #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) Global $aOL_Item = _OL_ItemFind($oOutlook, "*\Inbox", $olMail, "[UnRead]=True", "", "", "Subject", "", 1) If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Could not find a task item in folder 'Outlook-UDF-Test\SourceFolder\Tasks'. @error = " & @error) _ArrayDisplay($aOL_Item, "OutlookEX UDF: _OL_ItemFind Example Script - Unread mails") _OL_ItemMove($oOutlook, $aOL_Item[1][0], Default, "*\Outlook-UDF-Test\TargetFolder\Mail") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Error moving specified task. @error = " & @error) Any help is deeply appreciated. Thanks in advance.
      Thanks and regards,
      Gowrisankar R.
    • TheSaint
      By TheSaint
      Files Checklist
      Just a simple little (complex enough) program I whipped up, for a purpose ... but only too happy to share.
      It can of course be modified to do more, but at the moment just compares file names with or without path ... Location versus Checklist.
      There are of course other compare programs out there, most doing a lot more than mine (i.e. WinMerge or FileComparer). But I wanted something quick and simple with drag & drop, that uses up a smallish amount of screen real estate.
      NOTE - The SAVE button is also a LOAD one, and displays 'Load' when the list is empty. So you can save and load specific lists. While in SAVE mode, the button can also be used with CTRL held down, to ADD another list to existing (displayed one) ... combining as they say ... though not saved until you SAVE. CLEAR button removes a selected entry, or if used with CTRL held down, queries about removing all listed entries.
              
      Files Checklist v1.2.zip
      Files Checklist v1.3.zip
      Files Checklist v1.4.zip  (Includes a BUGFIX.)
        (source included)
      WARNING - While this program does not act on files or folders ADDED or CHECKED, you might act on the results, so I advise caution, and I also recommend using the new 'Relative' option in v1.3 or newer ... but you still need to understand what you are doing and what the results actually mean. Some basic examples in the next post.
      Enjoy!
      RELATED
      Users might also be interested in another somewhat related program of mine.
      DeleteIf Same
      Cheers!
×