new project

hi i am new to applescript studio and i am starting whit something simple.
im making an app to help me whit school. i would like it to copy a file or mack one.
theres screenshots might help
newprject1 http://may19c19.deviantart.com/#/d3736z4
newprject2 http://may19c19.deviantart.com/#/d37370q
newprject3 http://may19c19.deviantart.com/#/d373a9k
newprject4 http://may19c19.deviantart.com/#/d373ac5

Those folders you want to copy are all empty in your screenshot. So why not creating the structure.

For example a code like this


--I've written this function in the browser so it isn't tested for correct syntax
on createNewProject()
set pathToClasses to "~/Desktop/Work/school/uncompleted projects/"
set projectName to content of text field "name" of window "main" --I don't now your window name
set theParentFolder to title of popup button "class" of window "main"
if length of projectName is 0 then
return
end
set pathToProject to pathtoclasses & theParentFolder & "/" & projectname & "/" as string
if not ((do shell script "test -e " & quoted form of pathToProject & "; echo $?") as integer) as boolean then
--file already exists
return
end if

do shell script "mkdir " & quoted form of (pathToProject & "drafts")
do shell script "mkdir " & quoted form of (pathToProject & "notes")
do shell script "mkdir " & quoted form of (pathToProject & "resorces") --shouldn't it be resources?
do shell script "mkdir " & quoted form of (pathToProject & "resorces/notes")
do shell script "mkdir " & quoted form of (pathToProject & "resorces/pics")
end

my window name is “window 1” as i have no need to change it.
i think u need to make new folder at folder theParentFolder of pathToClasses with properties {name: projectName} because the folder projectname of [pathToProject to pathtoclasses & theParentFolder & “/” & projectname & “/” ] has not been mad i think if it has im sorry i can not find what line u make it.
and yes should it be resources i have bad spelling

mkdir provides a smart way to create directory hierarchies

do shell script "mkdir  -p " & quoted form of pathToProject & "/{drafts,notes,resources/{notes,pics}}"

the -p switch creates intermediate directories silently

ok thanks StefanK i did not know that.
why dues the script not work then? i do not know.

sorry for late response but the last 1 or two days macscripter was offline. What I did (and stefan’s solution even better) was creating directories/folders in a shell and not in the Finder. The syntax you’re asking for is for scripting the Finder. Also I prefer for an application that it’s not depended on the Finder and more depended on the shell. So your application can’t provide the finder a beachball nor can a hanging Finder freeze your application. It’s just a preference for myself to make applications less depended on other applications including the Finder.

Like I said reading your question you’re using a Finder syntax and not a shell. The finder provides some events to create a new folder but the Finder works with macintosh/hfs paths and not with posix paths. This means that path to classes needs to be

set pathToClasses to (path to desktop folder as string) & "Work:school:uncompleted projects:"

setting projectFolder must be

set pathToProject to pathtoclasses & theParentFolder & ":" & projectname & ":" as string

delete the shell commands (including the check for existance) and replace it with this to create the folder

tell application "Finder"
make new folder at folder pathToProject with properties {name:"drafts"}
make new folder at folder pathToProject with properties {name:"notes"}
set resourceFolder to make new folder at folder pathToProject with properties {name:"resources"}
make new folder at folder resourceFolder with properties {name:"notes"}
make new folder at folder resourceFolder with properties {name:"pics"}
end tell

thankks helps alot :smiley: