Automator: Create folder from filename

I am trying to use Automator to query a file in a foldr, then create a folder based off of the filename, then move the file into the newly created folder. I am not as savvy as I thought that I was when it comes to Automator. Even thinking that Automator might not be the correct tool for the job. Each file has a different name or this would be a lot easier. Any help would be greatly appreciated.

You can use a Run AppleScript action to do the work, and feed items to it by using a service workflow, an Ask for Finder Items action, etc - for example:
1) Service receives selected files or folders in Finder
2) Get Folder Contents
3) Run AppleScript
on run {input, parameters} -- create folders from file names and move
  set output to {} -- this will be a list of the moved files
  repeat with anItem in the input -- step through each item in the input
    set {theContainer, theName, theExtension} to (getTheNames from anItem)
    try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
        move anItem to destination
        set the end of the output to the result as alias -- success
      end tell
    on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
    end try
  end repeat
  return the output -- pass on the results to following actions
end run
to getTheNames from someItem -- get a container, name, and extension from a file item
  tell application "System Events" to tell disk item (someItem as text)
    set theContainer to the path of the container
    set {theName, theExtension} to {name, name extension}
  end tell
  if theExtension is not "" then
    set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
    set theExtension to "." & theExtension
  end if
  return {theContainer, theName, theExtension}
end getTheNames
to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
  set theParent to theParent as text
  if theParent begins with "/" then set theParent to theParent as POSIX file as text
  try
    return (theParent & theChild) as alias
  on error errorMessage -- no folder
    log errorMessage
    tell application "Finder" to make new folder at theParent with properties {name:theChild}
    return the result as alias
  end try
end makeNewFolder
4) other actions as desired

Similar Messages

  • Automator: Create folder from suffix of filename and put file names with same suffix into folder

    I've been using a script to use automator to create a folder from the filename and put that file into it the folder just created.
    I have a bunch of files that have similar names to them, but I don't want every file to be put into its own folder, instead I want all files with the same suffix (001) to go into the same folder.  I would also like the folder name to just be named the same as the suffix (001) instead of the full file name.
    For example all of these files names that end with the same integer (001) should be dumped into the same folder named "001":
    Boston_ProRes422_1920x1080_24p_Audio_001
    Boston_ProRes422_3840x2160_24p_Audio_001
    Boston_ProRes422_3840x2160_24p_RAW_Audio_001
    Boston_ProRes422_1920x1080_24p_Audio_002
    Boston_ProRes422_1920x1080_24p_Audio_005
    Boston_ProRes422_1920x1080_24p_Audio_010
    Any help at all would be incredible!!
    Thanks!
    Here's the script I'm using right now:
    on run {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
      set {theContainer, theName, theExtension} to (getTheNames from anItem)
      try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
      move anItem to destination
      set the end of the output to the result as alias -- success
      end tell
      on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
      end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
      set theContainer to the path of the container
      set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
      set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
      set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
      return (theParent & theChild) as alias
      on error errorMessage -- no folder
      log errorMessage
      tell application "Finder" to make new folder at theParent with properties {name:theChild}
      return the result as alias
      end try
    end makeNewFolder

    Thanks Neil for the response! That script didn't work, but I did get it to work with my old script by changing "set TheName to" numbers different.  Here's my final script which creates folders named "001", "002", and so forth and dumps in the files that end in that same suffix in the matching folder.
    on run {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
      set {theContainer, theName, theExtension} to (getTheNames from anItem)
      try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
      move anItem to destination
      set the end of the output to the result as alias -- success
      end tell
      on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
      end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
      set theContainer to the path of the container
      set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
      set theName to text -5 thru -((count theExtension) + 4) of theName -- just the name part
      set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
      return (theParent & theChild) as alias
      on error errorMessage -- no folder
      log errorMessage
      tell application "Finder" to make new folder at theParent with properties {name:theChild}
      return the result as alias
      end try
    end makeNewFolder

  • Applescript create folder from filename and move file stopped working

    Hi,
    For a while I've used this script but after upgrade and a new machine it stopped working.
    I have  Mac OS 10.8.5.
    This is what I have.
    Images (folder)
    111111_00.jpg
    111111_01.png
    222222_01.jpg
    222222_02.png
    222222_03.gif
    I'd like to be able to create a new folder for each "group of files" (new folder 111111, new folder 222222) and move the appropriate files into each of them.
    The filenames are always built by 6 digits underscore and 2 digits. Can be whatever filetype. (123456_01.jpg)
    I have a script that used to work just fine but now it just creates one folder and then freezes.
    This is the script that doesn't work.
    set chosen_folder to (choose folder)
    tell (a reference to my text item delimiters) to set {old_delim, contents} to {contents, "_"}
    tell application "Finder"
        try
            set file_list to files of chosen_folder
        on error
            set file_list to {}
        end try
        repeat with this_file in file_list
            set folder_name to name of this_file
            if folder_name contains "." then set folder_name to ((text items 1 thru -2 of folder_name) as string)
            set new_folder to ((chosen_folder as string) & folder_name & ":")
            try
                get new_folder as alias
            on error
                make new folder at chosen_folder with properties {name:folder_name}
            end try
            move this_file to folder new_folder without replacing
        end repeat
    end tell
    set my text item delimiters to old_delim
    I know that there are many who can do this easy as pie, but if you can find it in your hearts to help me it would be much appreciated.
    K

    function createFolder(file) {
      var parentFolder = file.parent;
      var saveFolder = new Folder( parentFolder + '/' + file.name.substring( 0, 8 ) );
      if( !saveFolder.exists ) saveFolder.create();
      var saveFile = new File( saveFolder + '/' + file.name);
      if( file.copy( saveFile ) ) file.remove();
    function main() {
       var folder = new Folder("~/Desktop/images");
       var files = folder.getFiles();
       for (var i = 0; i < files.length; i++) {
         var f = files[i];
         if (f instanceof File) {
          createFolder(f);
    main();
    Something like that should work.

  • Create folder from filename

    Hi
    I need a script that move files to a folder with the same name as the first 8 characters of the file name, that has to be moved. If the folder doesn't exist, it has to be created. I'm new in Javascript! Can anybody help me??
    thanx

    function createFolder(file) {
      var parentFolder = file.parent;
      var saveFolder = new Folder( parentFolder + '/' + file.name.substring( 0, 8 ) );
      if( !saveFolder.exists ) saveFolder.create();
      var saveFile = new File( saveFolder + '/' + file.name);
      if( file.copy( saveFile ) ) file.remove();
    function main() {
       var folder = new Folder("~/Desktop/images");
       var files = folder.getFiles();
       for (var i = 0; i < files.length; i++) {
         var f = files[i];
         if (f instanceof File) {
          createFolder(f);
    main();
    Something like that should work.

  • When deleting a user created folder from On My Mac in Mac Mail the sent messages that are part of conversations that reside there are not deleted, only the received mail gets deleted.

    When deleting a user created folder from On My Mac in Mac Mail the sent messages that are part of conversations that reside there are not deleted, only the received mail gets deleted. Any way for both the received and sent mail that resides there to be deleted?
    I create a lot of project folders where i keep all my conversations regarding the project. Once the project is finished i would like to just delete the folder and get rid of all the emails associated with it but when i delete the folder i've noticed that only received messages are deleted. Now I am stuck trying to sort through my sent folder for messages that were returned there after the conversations was supposedly deleted.

    Mail/Preferences/Viewing - un-check include related messages, delete the folder, then go back and reset yo include.

  • How can I import photos of a created folder from my iPad to iPhoto?

    I have created a folder on my iPad in order to make a preselection of my photos. But now it doesn't seem to be possible to import just the pictures of the created folder. Is it possible or not?

    With the iPad's camera connection kit you may be able to copy photos from a flash drive, but a lot of flash drives require more power than the iPad supplies to the kit - the kit also has an SD card reader.
    You need to create a DCIM directory off the root of the flash drive or SD card, with the photos underneath it, and the photo filenames need to be exactly 8 characters long (no spaces) plus the file extension i.e. in a similar format as if a camera had created/written them.
    Or you could sync photos from your computer's iTunes : http://support.apple.com/kb/HT4236
    Or there are third-party photo management apps that allow you to transfer photos to/from your computer via your wifi network e.g. Photo Manager Pro.

  • Automator: Create folder with name and subfolders in it.

    Hello everyone, my question is related to Automator. I work in a company where we have a huge server. Every time a new job comes in it gets a six digits number and a folder with 5/6 subfolder needs to be created. The main folder will be xxxxxx_nameofbrand and will contain 5 subfolder each one of them starting with the six digit number assigned initially followed by 5 tags (always the same ones).
    Everytime it's a long thing to create it manually and copy and paste every number and name, so I thought I could use automator to do it easilly but I always get stucked at the part where I want the 5 subfolder to go in the main one. This is what I had done, but I'm pretty sure there is a faster/easier way to do it.. I'm really new to automator, I know it's potential but don't know how to use it very well..
    I thank you all for the help.

    For this kind of exception, you can just add a Run AppleScript action at the end of the workflow - for example, the following will rename all folders ending with the specified name that are at the specified depth in the structure:
    on run {input, parameters} # remove prefix from folder name
      set sourceFolder to quoted form of POSIX path of (input as text)
      set exceptionName to "Links" # will find a name ending with this (case sensitive match)
      set exceptionDepth to 2 # at a folder depth of this
      set theFolders to (do shell script "find " & sourceFolder & " -name " & quoted form of ("*" & exceptionName) & " -depth " & exceptionDepth)
      repeat with anItem in paragraphs of theFolders # rename without prefix
        tell application "System Events" to set name of folder anItem to exceptionName
      end repeat
      return input
    end run

  • Create folder from role maintenance

    Hi,
    How can I create a folder with the name of my choice from role maintenance? I see the Role Menu from the Menu tab, but I don't see the paper icon to create a folder.
    Thanks

    I think I don't have authorizations. I only see the + sign that says 'Authorization default'  and then the vanilla folder 'Role menu'.
    I just want to create a folder to put queries to the browser for the users to get to instead going through the RRMX.
    Is there another way to do this?
    Thanks.

  • Hide automatic created folder from role upload

    Hi,
    when I make a role upload to the portal, a top folder with the same name as the role is automatically created. Is it possible to disable this feature or hide the folder afterwards?
    I have created my own folder structure in the portal, which defines the first two levels of navigation, and then made a delta link from this structure to the uploaded role. The content of the uploaded role is automatically put in a folder on third level instead of directly under the second level folder. This way the user has to click first on the role and then on the folder to get to the content. This is not very user friendly.
    Hope someone can help.
    Regards Morten

    Have you tried changing the 'Entry Point'  property within the uploaded roles ?
    When you do a role upload, you have the chance to automatically create the roles as worksets (rather than portal roles).  Have you tried doing this?  I think you get fewer levels (from memory)
    Also,  is your composite (backend) role design already in place and finished?  It is worth trying to consider the portal when doing the backend composite role design in order to prevent issues like this.
    Award points if this helps

  • Why can't I create folder from save dialog?

    The paradigm we've been taught is that the save dialog lets you name a file and select a folder, but if you want access to the full browser you click the triangle to expand it. With the latest version of Numbers, that functionality is gone.
    I have a pricing spreadsheet I use, I did a save-as to create a copy for another client. I tried to rename it and was told another file existed in the folder by that name (true.) I tried to select a different folder, but the folder didn't exist yet. Normally, I'd just go to my projects folder and create it. But no. Apparently I have to pick "Other..." and only then do I get the real dialog. It seems perfectly reasonable that we'd want to be able to create a folder while saving. Why make it so difficult?

    I wonder if this helps…
    http://mjtsai.com/blog/2014/10/26/yosemite-uploads-unsaved-documents-and-recent- addresses-to-icloud/
    It's the 'defaults' setting to disable iCloud drive saving by default - you can still use it, but the save dialog should revert to the old style. Scroll down for the info.

  • After backup restores sql server error can't create folder, and can't search into list / library from ribbon

    after having created a portal on a development platform, I made a backup Sql server then restores the production platform with sql server. 
    Two problems : 
    Problem 1: 
    1 in libraries error "An unexpected error" when creating FOLDER from ribbon even with Action page -> Manage content and structure. I could only create a folder with "Open with Explorer" in the ribbon. In the folder I created, i can create
    a subfolder with ribbon, but not a folder in the root of the library. I create a sub sites and in this case it does not have any problem, I created a folder !!! 
    Problem 2: 
    2 The search from the search box in the lists and library does not work. I need it working. I create a search site and it works fine, but I want to do research on lists and libraries.
    aprés avoir créer un portail sur une plateforme de développement, j'ai effectué un backup Sql server puis un restaure sur la plateforme de production avec sql server.
    2 problèmes sont apparus :
    Problème 1 :
    1. dans les bibliothèques de documents  erreur " An unexpected error" lors de la création de DOSSIER du ruban, même avec Action du site -> Gérer le contenu et la structure. j'ai seulement pu créer un dossier avec "Ouvrir avec l'explorateur"
    dans le ruban. Dans le dossier créer j'ai pu créer un sous-dossier avec le ruban, mais pas un dossier dans la racine de la bibliothèque. J'ai créer un sous sites et dans ce cas il n'y as pas de problème, j'ai pu créer un dossier !!!
    Problème 2 :
    2. La recherche à partir de la zone de recherche dans les listes et bibliothèque ne fonctionne pas. J'ai besoin que ca fonctionne. j'ai creer un site de recherche et il fonctionne correctement, mais je veux faire des recherches sur les listes et bibliothèques.

    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    Name=Request (POST:http://tserveur:8080/sites/MEAE/Documents%20partages/Forms/Upload.aspx?RootFolder=%2Fsites%2FMEAE%2FDocuments%20partages&Type=1&IsDlg=1)
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.54 w3wp.exe (0x1054)                      
    0x0560
    SharePoint Foundation         Logging Correlation Data      
    xmnv Medium  
    Site=/sites/MEAE 9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.54 w3wp.exe (0x1054)                      
    0x0560
    SharePoint Foundation         Monitoring                    
    b4ly High    
    Leaving Monitored Scope (PostResolveRequestCacheHandler). Temps d’exécution=15,7441122074812
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.56 w3wp.exe (0x1054)                      
    0x0560
    Document Management Server    
    Document Management          
    52od Medium  
    MetadataNavigationContext Page_InitComplete: No XsltListViewWebPart was found on this page[/sites/MEAE/Documents%20partages/Forms/Upload.aspx?RootFolder=%2Fsites%2FMEAE%2FDocuments%20partages&Type=1&IsDlg=1].  Hiding key filters and downgrading
    tree functionality to legacy ListViewWebPart(v3) level for this list.
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.57 w3wp.exe (0x1054)                      
    0x0560
    Web Content Management        
    Publishing                    
    7fz4 High    
    WARNING: Cannot change FormContext.FormMode to [Invalid] because it is already set to [New]
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.57 w3wp.exe (0x1054)                      
    0x0560
    Web Content Management        
    Publishing                    
    7fz4 High    
    WARNING: Cannot change FormContext.FormMode to [Invalid] because it is already set to [New]
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.58 w3wp.exe (0x1054)                      
    0x0560
    SharePoint Foundation         Runtime                      
    tkau
    Unexpected System.ArgumentException: Argument de publication ou de rappel non valide. La validation d'événement est activée via <pages enableEventValidation="true"/> dans la
    configuration ou via <%@ Page EnableEventValidation="true" %> dans une page. Pour des raisons de sécurité, cette fonctionnalité vérifie si les arguments des événements de publication ou de rappel proviennent du contrôle serveur qui les a rendus
    à l'origine. Si les données sont valides et attendues, utilisez la méthode ClientScriptManager.RegisterForEventValidation afin d'inscrire les données de publication ou de rappel pour la validation.    à System.Web.UI.ClientScriptManager.ValidateEvent(String
    uniqueId, String argument)     à System.Web.UI.WebControls.Table.RaisePostBackEvent(String argument)     à System.Web.UI.Page.RaisePos...
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.58* w3wp.exe (0x1054)                      
    0x0560
    SharePoint Foundation         Runtime                      
    tkau Unexpected
    ...tBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     à System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:53.58 w3wp.exe (0x1054)                      
    0x0560
    SharePoint Foundation         Monitoring                    
    b4ly Medium  
    Leaving Monitored Scope (Request (POST:http://tserveur:8080/sites/MEAE/Documents%20partages/Forms/Upload.aspx?RootFolder=%2Fsites%2FMEAE%2FDocuments%20partages&Type=1&IsDlg=1)). Temps d’exécution=57,2831164943714
    9c8700ee-9d51-4e5a-9b9d-22bebe9f03a1
    10/13/2014 10:54:56.31 OWSTIMER.EXE (0x0B18)                  
    0x02F4
    SharePoint Foundation         Monitoring                    
    nasq Medium  

  • How to import a complex mp3  folder strucutr in itunes and automated create playlists namend after this folders?

    Hi to all,
    I have a Problem. I organised since years my mp3 music in folders with subfolders and so on. I didnt create any playlists. Now i want to use itunes and ipod/ipone. How can i import a the complex mp3  folder strucutr in itunes and automated create playlists namend after this folders?
    I understood how to import the music in the media library but i dont want to creat hundreds of playlists by hand.
    Maybe someone has a tip?
    Thank to all
    Andy

    iTunes doesn't take any notice of your folder structure or provide any automatic way to use any information that might be coded in the path. Can you describe the current layout in a bit more detail and explain what you hope to achieve. It may be possible to use tools in other program's such as MediaMonkey or custom scripts to get the data from the file paths into something that iTunes can work with. The most important thing at this stage is not to import media to iTunes without first making sure under Edit > Preferences > Advanced that Keep iTunes Media folder organized and Copy to iTunes Media folder when adding to library are turned off otherwise iTunes may destroy your existing structure.
    tt2

  • Illustrator script to create symbols from images in folder

    Time to give back to the community...
    Here is a script I recently devised to bulk create symbols from images in a folder. Tested with Illustrator CC 2014.
    // Import Folder's Files as Symbols - Illustrator CC script
    // Description: Creates symbols from images in the designated folder into current document
    // Author     : Oscar Rines (oscarrines (at) gmail.com)
    // Version    : 1.0.0 on 2014-09-21
    // Reused code from "Import Folder's Files as Layers - Illustrator CS3 script"
    // by Nathaniel V. KELSO ([email protected])
    #target illustrator
    function getFolder() {
      return Folder.selectDialog('Please select the folder to be imported:', Folder('~'));
    function symbolExists(seekInDoc, seekSymbol) {
        for (var j=0; j < seekInDoc.symbols.length; j++) {
            if (seekInDoc.symbols[j].name == seekSymbol) {
                return true;
        return false;
    function importFolderContents(selectedFolder) {
        var activeDoc = app.activeDocument;     //Active object reference
      // if a folder was selected continue with action, otherwise quit
      if (selectedFolder) {
            var newsymbol;              //Symbol object reference
            var placedart;              //PlacedItem object reference
            var fname;                  //File name
            var sname;                  //Symbol name
            var symbolcount = 0;        //Number of symbols added
            var templayer = activeDoc.layers.add(); //Create a new temporary layer
            templayer.name = "Temporary layer"
            var imageList = selectedFolder.getFiles(); //retrieve files in the folder
            // Create a palette-type window (a modeless or floating dialog),
            var win = new Window("palette", "SnpCreateProgressBar", {x:100, y:100, width:750, height:310});
            win.pnl = win.add("panel", [10, 10, 740, 255], "Progress"); //add a panel to contain the components
            win.pnl.currentTaskLabel = win.pnl.add("statictext", [10, 18, 620, 33], "Examining: -"); //label indicating current file being examined
            win.pnl.progBarLabel = win.pnl.add("statictext", [620, 18, 720, 33], "0/0"); //progress bar label
            win.pnl.progBarLabel.justify = 'right';
            win.pnl.progBar = win.pnl.add("progressbar", [10, 35, 720, 60], 0, imageList.length-1); //progress bar
            win.pnl.symbolCount = win.pnl.add("statictext", [10, 70, 710, 85], "Symbols added: 0"); //label indicating number of symbols created
            win.pnl.symbolLabel = win.pnl.add("statictext", [10, 85, 710, 100], "Last added symbol: -"); //label indicating name of the symbol created
            win.pnl.errorListLabel = win.pnl.add("statictext", [10, 110, 720, 125], "Error log:"); //progress bar label
            win.pnl.errorList = win.pnl.add ("edittext", [10, 125, 720, 225], "", {multiline: true, scrolling: true}); //errorlist
            //win.pnl.errorList.graphics.font = ScriptUI.newFont ("Arial", "REGULAR", 7);
            //win.pnl.errorList.graphics.foregroundColor = win.pnl.errorList.graphics.newPen(ScriptUIGraphics.PenType.SOLID_COLOR, [1, 0, 0, 1], 1);
            win.doneButton = win.add("button", [640, 265, 740, 295], "OK"); //button to dispose the panel
            win.doneButton.onClick = function () //define behavior for the "Done" button
                win.close();
            win.center();
            win.show();
            //Iterate images
            for (var i = 0; i < imageList.length; i++) {
                win.pnl.currentTaskLabel.text = 'Examining: ' + imageList[i].name; //update current file indicator
                win.pnl.progBarLabel.text = i+1 + '/' + imageList.length; //update file count
                win.pnl.progBar.value = i+1; //update progress bar
                if (imageList[i] instanceof File) {         
                    fname = imageList[i].name.toLowerCase(); //convert file name to lowercase to check for supported formats
                    if( (fname.indexOf('.eps') == -1) &&
                        (fname.indexOf('.png') == -1)) {
                        win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Not a supported type.\r'; //log error
                        continue; // skip unsupported formats
                    else {
                        sname = imageList[i].name.substring(0, imageList[i].name.lastIndexOf(".") ); //discard file extension
                        // Check for duplicate symbol name;
                        if (symbolExists(activeDoc, sname)) {
                            win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Duplicate symbol for name: ' + sname + '\r'; //log error
                        else {
                            placedart = activeDoc.placedItems.add(); //get a reference to a new placedItem object
                            placedart.file = imageList[i]; //link the object to the image on disk
                            placedart.name =  sname; //give the placed item a name
                            placedart.embed();   //make this a RasterItem
                            placedart = activeDoc.rasterItems.getByName(sname); //get a reference to the newly created raster item
                            newsymbol = activeDoc.symbols.add(placedart); //add the raster item to the symbols                 
                            newsymbol.name = sname; //name the symbol
                            symbolcount++; //update the count of symbols created
                            placedart.remove(); //remove the raster item from the canvas
                            win.pnl.symbolCount.text = 'Symbols added: ' + symbolcount; //update created number of symbols indicator
                            win.pnl.symbolLabel.text = 'Last added symbol: ' + sname; //update created symbol indicator
                else {
                    win.pnl.errorList.text += 'Skipping ' + imageList[i].name + '. Not a regular file.\r'; //log error
                win.update(); //required so pop-up window content updates are shown
            win.pnl.currentTaskLabel.text = ''; //clear current file indicator
            // Final verdict
            if (symbolcount >0) {
                win.pnl.symbolLabel.text = 'Symbol library changed. Do not forget to save your work';
            else {
                win.pnl.symbolLabel.text = 'No new symbols added to the library';
            win.update(); //update window contents
            templayer.remove(); //remove the temporary layer
        else {
            alert("Action cancelled by user");
    if ( app.documents.length > 0 ) {
        importFolderContents( getFolder() );
    else{
        Window.alert("You must open at least one document.");

    Thank you, nice job & I am looking forward to trying it out!

  • How to move pics from "picture library" to created folder

    Just started using 9310 (from 8330) with new SD card. Have a few pics on it and can't figure out how to transfer a photo in "picture library" into a newly created folder. Was so easy on 8330 with simple "move into folder" option... HELP! Thanks!

    Hello equipagekm, 
    Welcome to the forums.
    The option to move to folder will not be present but what you can do is choose the "cut" option and then once in the new folder hit the menu key and choose "paste".
    Hope this helps. Let us know if you need anything else.
    -SR
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Creating pdf file from excel worksheet and save file in a macro created folder.

    Hi I have 3 worksheets and I want to conditionally convert them into a pdf file and than save said file into a folder that the macro will create if not already existing and name it with content of cell A1. So my question is if it is possible to do that with
    the following program?
    Thanks.
    Sub PrintStuff()
    Dim vShts As Variant
    Dim strFileName As String
    vShts = Sheets(1).Range("A1")
    If Not IsNumeric(vShts) Then
    Exit Sub
    Else
    ' Change path and filename as desired
    strFileName = "C:\MyFolder\MySubfolder\MyFile.pdf"
    If strFileName <> "False" Then
    Select Case vShts
    Case 1
    Sheets("Sheet1").Select
    Case 2
    Sheets("Sheet2").Select
    Case 3
    Sheets(Array("Sheet1", "Sheet2")).Select
    End Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=strFileName, _
    OpenAfterPublish:=False
    End If
    End If
    End Sub

    Option Explicit
    Sub PrintStuff()
    Dim Path As String, FileName As String
    Dim ThisSheet As Variant
    Dim MySheets As Variant
    Path = "C:\MyFolder\MySubfolder\"
    FileName = "MyFile.pdf"
    If Not FolderCreate("C:\MyFolder\MySubfolder") Then
    MsgBox "Can not create folder"
    Exit Sub
    End If
    Select Case Range("A1")
    Case 1
    Set MySheets = Sheets("Sheet1")
    Case 2
    Set MySheets = Sheets("Sheet2")
    Case 3
    Set MySheets = Sheets(Array("Sheet1", "Sheet2"))
    Case Else
    MsgBox "Uuups."
    Exit Sub
    End Select
    Set ThisSheet = ActiveSheet
    MySheets.Select
    ActiveSheet.ExportAsFixedFormat xlTypePDF, Path & FileName, OpenAfterPublish:=False
    ThisSheet.Select
    End Sub
    Private Function FolderCreate(ByVal Path As String) As Boolean
    'Creates a complete sub directory structure
    Dim Temp, i As Integer
    On Error GoTo ExitPoint
    If Dir(Path, vbDirectory) = "" Then
    If Right$(Path, 1) = "\" Then Path = Left$(Path, Len(Path) - 1)
    If Left$(Path, 2) = "\\" Then
    i = InStr(3, Path, "\")
    Temp = Split(Mid$(Path, i + 1), "\")
    Temp(0) = Left$(Path, i) & Temp(0)
    Else
    Temp = Split(Path, "\")
    End If
    Path = ""
    For i = 0 To UBound(Temp)
    Path = Path & Temp(i) & "\"
    If Dir(Path, vbDirectory) = "" Then MkDir Path
    Next
    End If
    FolderCreate = True
    ExitPoint:
    End Function

Maybe you are looking for

  • An unrecoverable error has occurred. Please contact your system administrator.

    Hi All, I have the following error when I try to upload a picture in the conversation in the newsfeed. I am unable to understand why this error come and how to solve this issue.  Thanks for all your suggestions and solutions in advance... Prem Kumar

  • ORA-03113: end-of-file on communication channel during query execution

    Hi All, My production database is running on 9.2.0.1 on windows 2003 adv srv. I have some web-based application (ASP.NET) which is using this database. From yesterdasy onwards, i started receieving ORA-03113 error while running a perticular query.(Qu

  • Mac Mini redirect LineIn to LineOut

    Guitar is connected to the MacMini and I want just to hear the sound which I play, without running GarageBand. I've checked, the power of signal is enough for this (I did this by going to System Preferences-Speech-Speech Recognition, button Calibrate

  • Hi ..IllegalStateException :Current state = FLUSHED, new state = CODING_END

    Hi.. I am trying to decode some values using java.nio api but throwing the following exception ... Can any one explain why that exception comes and what are that states mentioned in exception... Exception : Caused by: java.lang.IllegalStateException:

  • Navigational attribute in Transformation.

    Dear all, We are using BI7.00. For one of our problem in DTP, we wanted to apply the OSS note number 1145673.  I have some doubts in this note. 1) In the solution part the following is mentioned. "Solution For technical reasons (see symptom), this no