Use Applescript to create folder structure from Numbers document

Hello All,
I know this is possible and I am feeling close - I just couldn't find a post that addressed the issue I am having exactly. Essentially I have a client list with 211 business names in it. I am trying to create a script that will scan the first column of my Numbers document and create a folder structure from that list. I found a post on another website that gave me a rough template and this is where I am at:
set destinationFolder to "MacHD:/Users//Documents/Work/Customers/:to:folder:"
tell application "Numbers.app"
          set theCells to value of range "A1:A211" of active sheet
end tell
repeat with oneCell in theCells
          tell application "Finder" to make new folder at folder destinationFolder with properties {name:item 1 of oneCell}
end repeat
When I run this I get "Expected end of line but found class name." and in the result window it display "
error "Can’t get value of range." number -1728 from «class NMCv» of «class NmCR»"
I am completely new to this and don't really know how to debug. Any help would be appreciated! Thank you so much!
Adam

Here is an enhanced version which no longer use a loop to extract the selected values.
--{code}
set destinationFolder to "MacHD:/Users//Documents/Work/Customers/:to:folder:"
tell application "Numbers.app"
          set theCells to value of range "A1:A211" of active sheet
end tell
repeat with oneCell in theCells
          tell application "Finder" to make new folder at folder destinationFolder with properties {name:item 1 of oneCell}
end repeat
set destinationFolder to "" & (path to desktop) & "  dossier"
Select the range of source cells then run the script *)
Grab parameters describing the selected cells *)
set {dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
Extract the names from the selected cells *)
          tell column colNum1
                    set theNames to value of cells rowNum1 thru rowNum2
          end tell -- column
end tell -- Numbers
I always do my best to use System Events which is faster than the Finder *)
tell application "System Events"
          repeat with aName in theNames
                    try
  make new folder at end of folder destinationFolder with properties {name:aName as text}
                    end try
          end repeat
end tell
--=====
set { dName, sName, tName,  rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
on get_SelParams()
          local d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2
          tell application "Numbers" to tell document 1
                    set d_Name to its name
                    set s_Name to ""
                    repeat with i from 1 to the count of sheets
                              tell sheet i to set maybe to the count of (tables whose selection range is not missing value)
                              if maybe is not 0 then
                                        set s_Name to name of sheet i
                                        exit repeat
                              end if -- maybe is not 0
                    end repeat
                    if s_Name is "" then
                              if my parleAnglais() then
                                        error "No sheet has a selected table embedding at least one selected cell !"
                              else
                                        error "Aucune feuille ne contient une table ayant au moins une cellule sélectionnée !"
                              end if
                    end if
                    tell sheet s_Name to tell (first table where selection range is not missing value)
                              tell selection range
                                        set {top_left, bottom_right} to {name of first cell, name of last cell}
                              end tell
                              set t_Name to its name
                              tell cell top_left to set {row_Num1, col_Num1} to {address of its row, address of its column}
                              if top_left is bottom_right then
                                        set {row_Num2, col_Num2} to {row_Num1, col_Num1}
                              else
                                        tell cell bottom_right to set {row_Num2, col_Num2} to {address of its row, address of its column}
                              end if
                    end tell -- sheet…
                    return {d_Name, s_Name, t_Name, row_Num1, col_Num1, row_Num2, col_Num2}
          end tell -- Numbers
end get_SelParams
--=====
on parle_anglais()
          return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
end parle_anglais
--=====
--{code}
Here is an alternate version of the piece of code extracting the values :
--{code}
Grab parameters describing the selected cells *)
set {dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
Extract the names from the selected cells *)
          set cell1 to name of cell rowNum1 of column colNum1
          set cell2 to name of cell rowNum2 of column colNum1
          set theNames to value of cells of range (cell1 & ":" & cell2)
end tell -- Numbers
--{code}
Yvan KOENIG (VALLAURIS, France) mercredi 25 janvier 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

Similar Messages

  • Can I use FormsCentral when creating a form from existing document?

    Hi,
    I am trying to make a template in Formscentral. I want to use a picture with our corporate design for forms. I can change that in a PDF, but if I want to use that in FormsCentral, The picture is not paper wide (as it should), but leaves white margins an header and footer. But if I try to make a form and chose 'from existing document' I seem to not be able to end up in FormsCentral. What am I doing wrong?
    Isabella

    Hello George,
    How do I upload a PDF to the FormsCentral service? Wil I see that form then in My Forms or in the the standard templates list? I want to be able to re-use a collored PDF with no fields in it. I use this one to make several forms which will all look the same in the background.

  • How to make file folder structure from virtual folders

    lv 2013 sp1
    This is the layout of an example project, (please don't mind the horrible naming)
    When i create a source distribution.. no matter what settings I try, the preview is always like this:
    But I want the folder structure from the build to become as the virtual folder structure. is there any way of doing this without moving them by hand in the file explorer tab?
    Solved!
    Go to Solution.

    Unless you use auto-populating folders (which I don't like), the virtual folders are not meant to reflect the location on disk, so it certainly won't be automatic.
    I don't have experience with source distribution, but other build types have the option of configuring destination folders in the Destinations category and then assigning these destinations to items in the projects (including virtual folders, which then takes all the elements inside it) either in the same category or in the one under it, I can't check. I expect that you can do the same in a source distribution.
    Try to take over the world!

  • Using ME57 to create an RFQ from multiple lines on multiple PRs

    When using ME57 to create RFQs how can I select multiple line items from multiple purchase requisitions to turn into a single RFQ. If I select multiple lines and then use 'RFQ with Vendor', it only selects one line item.  After further research it appears that you can only create only line at a time (very time consuming). 
    If you use ME41 and create with reference to PR then you can not sort or filter columns to allow for easy consolidation.
    Another forum recommended the following when using ME57 which works but it again adds extra steps to the process.
         The whole process is as follows -
         1) When you are in the 'Assign and Process Purchase Requisition' screen, select related PR and then click on 'Without Vendor' icon to flag all PRs for RFQ processing.
         2) Select these PRs again and click further on 'Assignment Overview' icon (Shift and F5). The next screen will appear - Assign and Process requisitions - Overview of Assignments screen.
         3) Select the 'PReq' column and then click further on 'Process Assignment' icon (F2). The next screen will appear where you have to maintain the 'quotation deadline' information.
         4) Then click on 'Continue' icon (enter).
    [http://www.sapfans.com/forums/viewtopic.php?f=6&t=198768]
    So is there any way to either 1) enable sorting of data in ME41 or 2) use ME57 to create one RFQ from multiple line items of multiple purchase requisitions when selecting 'RFQ with Vendor'.

    What is the JPEG specs? What are the specs of the project you're working in?

  • I am unable to create adobe file from attached document from email

    I am unable to create adobe file from attached document from email. No 'open in' link is available as given in directions. What to do?

    Because there is no abode on the IOS.  you'll need to do a search in the app store to resolve your issue.

  • Automatic creation of KM folder structure from xml pattern

    Hi all,
    is it possible to create a KM folder structure automaticly, following the tree structure of an xml document?
    For example:
    an xml-document with following content:
    <item id=1 level=0>abc</item>
    <item id=2 level=1>aaa</item>
    <item id=3 level=1>bbb</item>
    <item id=4 level=2>ccc</item>
    <item id=5 level=0>def</item>
    I'd like to create a KM folder structure like this:
    - abc
    ---aaa
    ---bbb
    ccc
    - def
    Does anyone have any idea to implement this scenario in KM?
    Much obliged!
    Steffi

    Not currently - well at least not easily - there is always the programatic approach.
    I would suggest you can create an FSDB repository - this means you can then create your structure in the file system using standard desktop tools.
    After that you could do a mass copy back into the db based KM repository if you so wished.
    For your downstream systems you could always ICE the data across meaning you dont have to create everything again.
    Haydn

  • Using AppleScript to create a text file, based on an OCR'd file's content

    Hey guys, I've got an interesting situation.
    I was wondering if there would be anyway to use something like AppleScript (or the like) to create a text document and fill it with information based on what is found in an already OCR'd file?
    For example: I have a paycheck stub. The stub contains the words "Gross Pay" and the value "$xxxx.xx" on one line. Using Hazel to identify paychecks (based upon filenames), could I then use something like AppleScript, to create a new text file, and then pull the text from the line that contains the word's "Gross Pay" and insert it into the text file's next line?
    Ex:
    March 26,2012      
    Gross Pay                   $xxxx.xx
    April 6,2012
    Gross Pay                   $xxxx.xx
    Kind of how TurboTax's iPhone app pulls text from an image, then uses the values to insert it into the app's appropriate fields?
    I know this may be a lot to ask, but any help is appreciated. Thanks!

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Installing .csf files and using them to create a pdf from Indesign.

    I have a .csf file that was sent to me that I need to:
    1.     Install (not sure how to do that in CS4),
    2.     And be able to use in Indesign when I create a pdf from an Indesign file.
    I'm not sure how to do this.

    Like it or not, InDesign is a color managed application, and your files are all being managed.
    You'll always have less grief if the working spaces match the output, but that isn't always possible. If you want to to convert to the profiles specified in the CSF file, choose one of the "Convert to Profile" settings and select the correct profile as the destination. You'll have two options, preserve numbers, or don't preserve numbers.
    Preserving numbers will cause colors to shift, but will preserve 100% K blacks. Not preseving numbers will change the numbers to give you the closes match possible in appearance, but will royally screw up your 100% K type if going to press.

  • Trouble using cfincludes with multi-folder structure

    We are rebuilding our site using <cfinclude> to pull in
    standard headers and footers for each page. The headers and footers
    each have many links in them. How can we deal with the fact that
    the pages calling the cfincludes are not all at the same level in
    the folder structure? How can we create one include file for the
    header and one include file for the footer that can each be used
    throughout the site regardless of the level in which the calling
    page is located? Thank you.
    Cheers!
    James

    How can we create one include file for the header and one
    include file for the footer that can each be used throughout the
    site regardless of the level in which the calling page is
    located?
    Create the one header.cfm and the one footer.cfm. Include
    them in Application.cfm/OnRequestEnd.cfm or in Application.cfc.

  • Copy Folder Structure from Explorer into Outlook 2013

    Hi,
    I have just spent approx 3 months designing an Enterprise Classification Scheme, and built a folder structure in Explorer that I want to replicate in Outlook.
    I thought it would have been as simple as copy and pasting from Explorer to an Outlook folder however when I attempt to do so I get the following error:
    "Only files or objects can be attachments. x:\xxxx\xxxxx\xxxxx is a folder structure and cannot be attached."
    Surely there must be a simple way of doing this so I don't have to manually recreate and name 442 folders in Outlook.
    Any advice greatly appreciated.

    I tried the Outlook tool with no luck.  It ran and looked as though it was doing something but no folders were created.
    I did a bit more of a search around and came across a spreadsheet that works perfectly for making folder structures on Network drives.  Anyone up to having a look at the VBA in the  spreadsheet and modifying it to make shared folders in outlook
    2013?
    Sub CreateFolderStructure()
    'Create folder for all vlues in current sheet
    'folders will be created in folder where the excel file was saved
    'folders will be created from first row, first column, until empty row is found
    'Example expected cell structure: (data starting in current sheet, column A, row 1)
    'folder1    subfolder1  subsubfolder1
    'folder2
    'folder3    subfolder3
    '           subfolder4
    'this will result in:
    '<currentpath>\folder1\subfolder1\subsubfolder1
    '<currentpath>\folder2
    '<currentpath>\folder3\subfolder3
    '<currentpath>\folder3\subfolder4
        baseFolder = BrowseForFolder
        If (baseFolder = False) Then
            Exit Sub
        End If
        Set fs = CreateObject("Scripting.FileSystemObject")
        For iRow = 2 To 6500
            pathToCreate = baseFolder
            leafFound = False
            For iColumn = 1 To 6500
                currValue = Trim(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Worksheets(ActiveCell.Worksheet.Name).Cells(iRow, iColumn).Value, ":", "-"), "*", "-"),
    "?", "-"), Chr(34), "-"), "<", "-"), ">", "-"), "|", "-"), "/", "-"), "\", "-"))
                Worksheets(ActiveCell.Worksheet.Name).Cells(iRow, iColumn).Value = currValue
                If (currValue = "" And leafFound) Then
                    Exit For
                ElseIf (currValue = "") Then
                    parentFolder = FindParentFolder(iRow, iColumn)
                    If (parentFolder = False) Then
                        Exit For
                    Else
                        pathToCreate = pathToCreate & "\" & parentFolder
                        If Not (fs.FolderExists(pathToCreate)) Then
                            CreateDirs (pathToCreate)
                        End If
                    End If
                Else
                    leafFound = True
                    pathToCreate = pathToCreate & "\" & currValue
                    If Not (fs.FolderExists(pathToCreate)) Then
                        CreateDirs (pathToCreate)
                    End If
                End If
            Next
            If (leafFound = False) Then
                Exit For
            End If
        Next
    End Sub
    Function FindParentFolder(row, column)
        For iRow = row To 0 Step -1
            currValue = Worksheets(ActiveCell.Worksheet.Name).Cells(iRow, column).Value
            If (currValue <> "") Then
                FindParentFolder = CStr(currValue)
                Exit Function
            ElseIf (column <> 1) Then
                leftValue = Worksheets(ActiveCell.Worksheet.Name).Cells(iRow, column - 1).Value
                If (leftValue <> "") Then
                    FindParentFolder = False
                    Exit Function
                End If
            End If
        Next
    End Function
    Function BrowseForFolder(Optional OpenAt As Variant) As Variant
         'Function purpose:  To Browser for a user selected folder.
         'If the "OpenAt" path is provided, open the browser at that directory
         'NOTE:  If invalid, it will open at the Desktop level
        Dim ShellApp As Object
         'Create a file browser window at the default folder
        Set ShellApp = CreateObject("Shell.Application"). _
        BrowseForFolder(0, "Please choose a folder", 0, OpenAt)
         'Set the folder to that selected.  (On error in case cancelled)
        On Error Resume Next
        BrowseForFolder = ShellApp.self.Path
        On Error GoTo 0
         'Destroy the Shell Application
        Set ShellApp = Nothing
         'Check for invalid or non-entries and send to the Invalid error
         'handler if found
         'Valid selections can begin L: (where L is a letter) or
         '\\ (as in \\servername\sharename.  All others are invalid
        Select Case Mid(BrowseForFolder, 2, 1)
        Case Is = ":"
            If Left(BrowseForFolder, 1) = ":" Then GoTo Invalid
        Case Is = "\"
            If Not Left(BrowseForFolder, 1) = "\" Then GoTo Invalid
        Case Else
            GoTo Invalid
        End Select
        Exit Function
    Invalid:
         'If it was determined that the selection was invalid, set to False
        BrowseForFolder = False
    End Function
    Sub CreateDirs(MyDirName)
    ' This subroutine creates multiple folders like CMD.EXE's internal MD command.
    ' By default VBScript can only create one level of folders at a time (blows
    ' up otherwise!).
    ' Argument:
    ' MyDirName   [string]   folder(s) to be created, single or
    '                        multi level, absolute or relative,
    '                        "d:\folder\subfolder" format or UNC
    ' Written by Todd Reeves
    ' Modified by Rob van der Woude
    ' http://www.robvanderwoude.com
        Dim arrDirs, i, idxFirst, objFSO, strDir, strDirBuild
        ' Create a file system object
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        ' Convert relative to absolute path
        strDir = objFSO.GetAbsolutePathName(MyDirName)
        ' Split a multi level path in its "components"
        arrDirs = Split(strDir, "\")
        ' Check if the absolute path is UNC or not
        If Left(strDir, 2) = "\\" Then
            strDirBuild = "\\" & arrDirs(2) & "\" & arrDirs(3) & "\"
            idxFirst = 4
        Else
            strDirBuild = arrDirs(0) & "\"
            idxFirst = 1
        End If
        ' Check each (sub)folder and create it if it doesn't exist
        For i = idxFirst To UBound(arrDirs)
            strDirBuild = objFSO.BuildPath(strDirBuild, arrDirs(i))
            If Not objFSO.FolderExists(strDirBuild) Then
                objFSO.CreateFolder strDirBuild
            End If
        Next
        ' Release the file system object
        Set objFSO = Nothing
    End Sub

  • Creating folder Structure for Query based taxonomy

    Hello friends,
            I am confused as to where do I create a folder hierarchy for taxonomy. Do I need to create a new repository for creating a folder structure. The help.sap.com mentions about using the Category Browser iview for creating the same. I am unable to find this iview in EP6 SP12. Can someone, please guide me as to where do I create a taxonomy folder structure hierarchy?
    Your help is appreciated.
    Thanks,
      G.G

    Hey G.G.,
    Yes, i'd love to.
    So, as stated above, directly below the "Taxonomies" folder you'll see the names of the existing taxonomies. There is no "new" option on this level, because a new taxonomy can only be created under "System Administration" -> "System Configuration" -> "Knowledge Management" -> "Index Administration". After you create a "TREX Search and Classification" or "TREX Classification" index, you can go to the index menu "Taxonomies" and say "New". This will automatically create a new folder under in the "Taxonomies" view.
    Now, if you go one level further, so second subfolder under "Taxonomies" you should have the "New" option. If not, then you'll have to check the permission settings. Please go to "Content Administration" -> "KM Content" -> "Taxonomies" and then on the Menu "Details" -> "Settings" -> "Permissions". You might need to adjust permissions as suggested by SAP in SAPNote (599425):
    Role:"ContentManager"=FULL CONTROL;
    Group:"Everyone"=READ.
    Please check that the already existing subfolders have inherited the permission changes.
    Hope this solves your problem,
    Robert

  • Upload or create folder structure

    Hello,
    I wonder if it is possible to create a folder structure on my
    My Files section. It is not possible to upload a folder and it
    seems not possible to create a folder structure either.
    This is an important function for me for organisation
    reasons.

    I agree. I would also like that feature. When we begin to use
    this program more frequently, we will have a ton of files all over
    the place.
    Thanks

  • Applescript to import cell data from Numbers table

    I have 2 questions:
    the first I am importing the value of cells from Numbers to a list within my script. The cell's orginal value is set to automatic, but it's a number:
    833094
    but what imports into my list is as follows:
    8.33094+5
    How might I handle this without changing the integrity of the Cell's value and data type?
    Second question: Again, I am importing the values of a range of cells into a list, The cell's data type is date (e.g. July 24, 2013 12:21:10 AM.) The import to my list comes off OK, but when I attempt to set the same date type (date) back to a new cell I get an execusion error. All other data types (except date) seem to move from a my list to a cell without problem. How might I work around this problem
    Thank you

    I assume you can set the cell (using Applescript) with some format.  You may need to set the format to "Automatic".  Hopefully Hirohito or BadUnit who have more Applescript experience can assist.  The actul value is there an correct.  You can try it manually in Numbers on your own:
    A1 is formatted automatic, B1 is formatted scientific:
    I hope this helps.
    Wayne

  • Using execute immediate creating a table from another

    hi friend i wanted to create a table from a select statement in a pl sql procedure. i am using execute immediate but getting problems with it pls can anyone help me.
    here is the query i am using
    EXECUTE IMMEDIATE 'CREATE TABLE table_name AS  (SELECT * FROM  a_view   WHERE column_name LIKE '%some_string%');
    i need to know if this can be done and if yes how. pls help me its bit urgent too. the schema name is same and the privileges are available to create tables too.

    Your syntax is wrong.
    If you would use a syntax higlighted editor, it would show.
    Yout try to execute a string where another string is embedded. Please use two times single quote or use the 'q' function:
    This one is correct:
    EXECUTE IMMEDIATE 'CREATE TABLE table_name AS (SELECT * FROM  a_view WHERE column_name LIKE ''%some_string%'')';
    or this one:
    EXECUTE IMMEDIATE q'|CREATE TABLE table_name AS (SELECT * FROM  a_view WHERE column_name LIKE '%some_string%')|';
    good luck

  • Creating Folder Structure in Knowldge managemet

    Dear All,
    We have installed EP7.0 SP10,
    In Content Admin-> KM Content i can see folders like   
    ~system        
    discussiongroups  
    documents    
    Entry Points            
    etc          
    grouphome        
    Reporting       
    rolehome       
    room_extensions         
    room_publicarea_structures          
    room_store_cm           
    room_structures        
    rooms           
    runtime           
    Taxonomies     
    ume            
    userhome         
    workflow  
    www 
    I would like to create my own Folder structure Like
    Head Office
    |
    |
    |-- Region1--
    |[Sub Folders]
    |
    |
    |-- Region2--
    |[Sub Folders]
    |
    |
    |-- Region3--
    |[Sub Folders]
    |
    |
    |-- Region4--
    |[Sub Folders]
    Where can i create these folders, i don't have any external file repsitory, my Database MS SQL.
    i would like to know where these folders will bestored in the data base.
    Thanks in Advance,
    Murali

    As you mentioned your directory structure ...there is a folder called "documents" in that you can define your folder structure
    Head Office
    |-- Region1--
    |Sub Folders
    |
    |-- Region2--
    |Sub Folders
    |
    |-- Region3--
    |Sub Folders
    |
    |-- Region4--
    |Sub Folders
    and make one KM navigation iview which points to your /document/Head Office
    and assign it to users

Maybe you are looking for

  • PO w. r . t  RFQ

    hi...! I got a problem while creating Purchase Order with respect to RFQ. When I tried to save it then the error msg occurs like this "account assignment mandatory for material" reply me if anybody knows this problem. thanks R.Reddy

  • 5510L Locked Up on Home Screen

    Any ideas why this is happening?  Our customers can't access the MiFi, so they can't removed the battery and insert again to eliminate this issue. I need another troubleshooting tactic, please. We've had 67 of these returned to us with this issue. Wh

  • Hierarchy Restrictions as Per Query

    Hi , We have one query that is using GL Account InfoObject. We are displaying GL account as Hierarchy in Bex Output. There are 5 hierarchies in BW for GL Account Info Object. I created one Variable to select hierarchy while running the query. When us

  • Itunes radio icon is missing from my music app on my ipod touch 5. how do i get it back?

    Itunes radio icon is missing from my music app on my ipod touch 5. how do i get it back?

  • How do i get connection pooling in tomcat

    hi 2 all, i m confused how to get connection with tomcat . thanx