I have an existing apple script. Added a windows user who needs a windows version

  applescript, script, windows

I have this folder structure apple script:

on open dropped_items
    -- Examine each of the one or more dropped items in turn.
    repeat with dropped_folder in dropped_items
        -- Is this dropped item actually a folder?
        tell application "Finder" to set is_Folder to (class of item (dropped_folder as text) is folder)
        
        -- Act only if it is.
        if (is_Folder) then
            tell application "Finder"
                -- Get the folder's items and, separately, their names.
                set original_items to every item of dropped_folder
                set item_names to name of every item of dropped_folder
            end tell
            
            -- Derive quoted and unquoted forms of the names, without extensions, to use for the folders.
            set shot_folder_names to {}
            set quoted_shot_folder_names to {}
            set astid to AppleScript's text item delimiters
            repeat with this_name in item_names
                -- If a name has an extension, lose the extension. Otherwise assume it's a folder name containing "_bg_plt_v" and lose everything from that point.
                if (this_name contains ".") then
                    set AppleScript's text item delimiters to "."
                else
                    set AppleScript's text item delimiters to "_bg_plt_v"
                end if
                set end of shot_folder_names to text 1 thru text item -2 of this_name
                set end of quoted_shot_folder_names to quoted form of result
            end repeat
            
            --- Put together a path formula representing all the required "shot folder" hierarchies.
            set item_count to (count quoted_shot_folder_names)
            if (item_count > 1) then
                -- More than one shot folder name. Get a text containing them all, comma-delimited and in braces.
                set AppleScript's text item delimiters to ","
                set shot_folder_name_group to "{" & quoted_shot_folder_names & "}"
            else if (item_count is 1) then
                -- Only one shot folder name.
                set shot_folder_name_group to item 1 of quoted_shot_folder_names
            else
                set AppleScript's text item delimiters to astid
                error "The selected folder is either empty or not a folder!"
            end if
            set AppleScript's text item delimiters to astid
            set hierarchy_formula to quoted form of POSIX path of dropped_folder & shot_folder_name_group & "/{2d/{ae,mocha,nuke,ps},3d/{cache,data,scenes,textures},plates/{etc,plate,proxy},renders/{comp,graphics,ibtw,lightning,mattes,playblasts,precomp,quicktimes,temp}}"
            -- Use it to create the shot folder hierarchies.
            do shell script "mkdir -p " & hierarchy_formula
            
            -- Move stuff into each shot folder hierarchy in turn.
            set dropped_folder_path to dropped_folder as text
            repeat with i from 1 to (count shot_folder_names)
                set this_shot_folder_name to item i of shot_folder_names
                set shot_folder_path to dropped_folder_path & this_shot_folder_name
                -- Create a text file in the "3d" folder.
                close access (open for access file (shot_folder_path & ":3d:workspace.mel"))
                -- And one each in the "2d:ae" and "2d:ps" folders.
                set text_file_name to this_shot_folder_name & "_v001.txt"
                close access (open for access file (shot_folder_path & ":2d:ae:" & text_file_name))
                close access (open for access file (shot_folder_path & ":2d:ps:" & text_file_name))
                -- Move the original item into the "plates:plate" folder.
                tell application "Finder" to move (item i of original_items) to folder (shot_folder_path & ":plates:plate") -- replacing yes
            end repeat
        end if
    end repeat
end open

But I have a windows user who needs the same functionality. I don’t use windows, and I can’t code. Is there some way to convert this into something Windows compatable? I don’t even know what program would do that on windows. I’m a Mac guy!

Anyone have any great suggestions?

Source: Windows Questions

LEAVE A COMMENT