replication script

I need some assistance on a replication script. I have a dialog box asking how many deliverables there is going to be. Then, based on the numeric value they enter, the script will run creating x amount of deliverables in an existing folder.

Thanks!

Maybe someone with more experience knows what you mean, but I don’t think you gave us enough information. What scripting language are you talking about? Or do you mean, you need Xojo code to make several copies of a files into a destination folder?

xojo code that would make several copies of files into a destination folder.

thanks and apologies for the poor description.

It’s up to you to write code that will uniquely name the files within the target folder. The easiest way to do that is to create a FolderItem for the proposed copy and see if it exists. If it does, change the name and try again.

Once you have a unique name, you would use the source FolderItem.CopyFileTo.

The code for identifying a unique name would be something like this:

// src is the FolderItem you want to copy
// dst as it the destination folder

dim filename as string = src.Name
dim proposedFile as FolderItem = dst.Child( filename )
if proposedFile.Exists then // Not unique
  dim i as integer = 0
  do
    i = i + 1
   proposedFile  = dst.Child( filename + " " + str( i ) )
  loop until not proposedFile.Exists
end if
src.CopyFileTo( proposedFile )

Note that I haven’t tested this, and you probably want to deal with the file extension somehow, but it should give you a general idea.

okay… i would want the name to change based on the amount of deliverables they enter… e.g. name _01 name_02 name_03 until they reach the variable they enter.

okay… I am wanting a dialog box to open where a user can enter how many times he will need the project folder to be created (deliverables for a project) The Parent folder, TET14_000, will need to be appended with… “_01” “_02” etc. TET14_000_01 TET14_000_02

thanks!

Dim dlg as New SaveAsDialog
dim f as FolderItem
dlg.InitialDirectory=SpecialFolder.Mount
dlg.SuggestedFileName=“TET14_000”
dlg.promptText=“Please enter the Project Number”
f=dlg.ShowModal()
f.CreateAsFolder
Dim sub1 as FolderItem = f.Child(“CAD”)
sub1.CreateAsFolder
Dim sub2 as FolderItem = f.Child(“decals”)
sub2.CreateAsFolder
Dim sub3 as FolderItem = f.Child(“layout_comps”)
sub3.CreateAsFolder
Dim sub4 as FolderItem = f.Child(“project_management”)
sub4.CreateAsFolder
Dim sub5 as FolderItem = f.Child(“render_scene”)
sub5.CreateAsFolder
dim sub6 as folderitem = f.Child(“renderings”)
sub6.CreateAsFolder
f=sub1
f.parent.Launch
Window3.Close

bump… okay… I am wanting a dialog box to open where a user can enter how many times he will need the project folder to be created (deliverables for a project) The Parent folder, TET14_000, will need to be appended with… “_01” “_02” etc. TET14_000_01 TET14_000_02

thanks!

awesome… talking to myself for 2 days…

i apologize that i don’t know what i am doing… was easy enough to do in applescript.

cheers… moving on…