Creating a prompt for creating new folders with a customized name

Hello all!

This is my first post and I’m completely new to creating AppleScritpts. I have poked around the forum and web and amalgamated some scripts to help me create some named folders with a sequence number. This script pretty much does what I want it to do. (1) Prompt the user where to create a root folder with a custom name at a specific location. (2) Prompt the user of how many folders to create. BUT I would like a prompt to create a custom name to the folders being created. Currently the default name is “Folder”. It would be great to be able to change the name “Folder” with a prompt with a customized name.

I know it has to deal with the below line of code but my tinkering and lack of AppleScritp skills has led me to no avail.

tell application “Finder” to make new folder at newFolder with properties {name:"Folder " & I}

Any ideas, help or direction will be greatly appreciated!

-Aaron

  • BTW.been having a lot of fun creating some basic AppleScritpts and am excited to progress!


set folderMaker to text returned of (display dialog "Please enter root folder name:" default answer "Folder Maker")
set loc to choose folder "Choose Parent Folder Location"

tell application "Finder"
	set newFolder to make new folder at loc with properties {name:folderMaker}
end tell
repeat
	set subCount to text returned of (display dialog "How many folders?" default answer 10)
	try
		if subCount ≠ "" then
			subCount as integer
			exit repeat
		end if
	end try
end repeat

repeat with i from 1 to subCount
	
	tell application "Finder" to make new folder at newFolder with properties {name:"Folder " & i}
end repeat



Hi,

this is very easy, it’s almost the same code as in the first prompt


        ...
	end try
end repeat

set folderName to text returned of (display dialog "Please enter sub folder base name:" default answer "New Folder")

repeat with i from 1 to subCount
	tell application "Finder" to make new folder at newFolder with properties {name:folderName & space & i}
end repeat

Fantastic!

Thanks so much StefanK. The script works exactly how I imagined it to!

Thanks again!

-Aaron