Script to create multiple apps

Discussion in 'Mac Programming' started by rkyve, Jul 16, 2009.

  1. macrumors newbie

    Joined:
    Dec 4, 2007
    #1
    Hi

    I need to create over 300 apps using applescript editor.

    Each App will have the following:

    tell application "Finder" to open file "File_Name-1.pdf" of folder "fscommand" of disk "DISKNAME"

    The File_Name-1.pdf (including the extension) will change from an app to another.

    Then this script needs to be saved as an application with ONLY RUN option and named filename1pdf.app - so I am changing all to lower case and stripping the "-", "_" and "."

    Is their a way to automate this process without creating every single script and saving + renaming individually?

    Any help will be much appreciated.
     
  2. macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
  3. thread starter macrumors newbie

    Joined:
    Dec 4, 2007
    #3
    Thank you Sammich... I am aware Automator can save my day but I have no clue what to do.

    This is why I am asking for assistance.
     
  4. macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #4
    Sorry, I was assuming that since you were dabbling in Applescript, you were familiar with Automator.

    Okay. Fire up automator and you'll be asked to 'choose a starting point'. Select 'Files & Folders'. It'll ask you to select your files, you can do so now, or you can select/drag it into the list later (under 'Get Specified Finder Items'). Now, in the leftmost column you'll see a list of programs. Click on Files & Folders. In the second column find and drag 'Rename Finder Items' into the larger area on the right, under the existing list. It'll ask if you want to put something extra to copy the files. That's up to you. You'll need to drag 2 more below since you're doing three changes to the file name. These times select 'Don't Add'.

    You'll see options for renaming: you're looking for 'Change Case' and 'Replace Text'. Change case is trivial, just choose Full name and lower case as options. Replace Text you need to put "-" in 'Find' and leave 'Replace' blank. The third rename is for your replace "_" with a blank.

    Hope this makes sense.

    I can also make this 'workflow' and send it to you as well. Download this, it will open in Automator. Have a look at it then run it.
     

    Attached Files:

  5. thread starter macrumors newbie

    Joined:
    Dec 4, 2007
    #5
    Thanks a lot buddy but it seems I completely confused you :)

    I already have the file names and the names of the .app i need to create:

    10secrethidingplacepptx - 10SecretHidingPlace.pptx
    10timeforschoolpptx - 10TimeForSchool.pptx
    1tableswhatsmyquestionpptx - 1TablesWhatsMyQuestion.pptx
    1whatamiwearingpptx- 1WhatAmIWearing.pptx
    1whatsmywordpptx - 1WhatsMyWord.pptx
    2coolcollectivenounspptx - 2CoolCollectiveNouns.pptx
    2coordinatesmppptx - 2CoordinatesMP.pptx

    etc.....


    I actually need to automate the creation of the .APPs in the Script Editor.

    Sorry for the confusion again - apologies!
     
  6. macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #6
    Well, it appears I'm a victim of my own skim reading :D

    Okay, give me a minute now lol

    Almost seems like you could've done this already without my help...
     
  7. thread starter macrumors newbie

    Joined:
    Dec 4, 2007
    #7
    Thank you for your help - highly appreciated!

    I am manually creating the Apps in the Script Editor at the mo because I got to deliver today - can't risk it! - however this will take me hours :( ....hope you will come up with a solution that will save me individually creating the remaining 253 Apps!
     
  8. macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.

Share This Page