Automator - Set Selected Folder Path as Variable

Hello everyone! I'm trying to setup an Automator service that would download a list of URLs to the currently selected folder, or wherever the service was ran from. The only problem is I don't see how I would go about setting the currently selected folder as a path to download the files to. I'm thinking of something like this:
Note: Just realized I had service receives selected as "TEXT in ANY APPLICATION" in my screenshot. This will be "FOLDERS in FINDER" when I hopefully get this figured out!
Where currentFolder currently selected folder, or wherever the service was ran from. As far as I can tell, I would just need to somehow set the currently selected folder as a variable like currentFolder, then set the Download URLs location to that variable? Let me know if I need to explain anything further!
Message was edited by: kellylawrence

So I took a slightly different route, and just setup a shell script. Apparently **cd "$@";** will get the current directory.
Basically, I created a new service in Automator, then set Service Receives Selected to "files or folders" in "Finder", and added a "Run Shell Script" to the workflow. I set Shell to "/bin/bash", and Pass Input to "as arguments", then placed the following in the script editor.
    cd "$@";    curl -O http://www.example.com/file1.zip    curl -O http://www.example.com/file2.zip    curl -O http://www.example.com/file3.zip    unzip \*.zip    rm *.zip
Now I can right click on any folder, and download my list of files.

Similar Messages

  • In an Excel template file, can I set the Folder Path in the SaveAs Dialog box?

    I have an Excel template file (xltm) and, with help from the forum, I now have a Workbook_BeforeSave subroutine to save the template as a macro enabled file (xlsm).  I’m so thankful for that help from Edward in the forum.
    I also want to set the default folder location to save the file. I really only need it when the template is saved as a new xlsm file, because if they open the xlsm file, it’s usually opened from the default folder path so any save would normally go back
    to where the file was opened.  However, with a template (even if the template is in the default folder) the Saved template reverts back to the user’s documents folder.
    Is there a good way to do this?
    I tried to modify the Workbook_BeforeSave code like this:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim FolderDir As String
    Dim FileNameVal As String
    FolderDir = "Z:\save\data\place\"
    If SaveAsUI Then
    If Dir(WorkBookFolder, vbDirectory) <> "" Then
    Application.DefaultFilePath = WorkBookFolder
    End If
    FileNameVal = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
    Cancel = True
    If FileNameVal = "False" Then 'User pressed cancel
    Exit Sub
    End If
    ThisWorkbook.SaveAs Filename:=FileNameVal & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
    Application.EnableEvents = True
    End If
    End Sub
    But there are a lot of checks that would need to be done.
    I'm not sure how to only default the folder saved only when they open the template, but not change it when they just open an already saved Excel file created by the template (with all the active content, macros, etc.).
    Alan Edwards

    Hi Alan,
    store the path\filename in the 1st argument:
    FileNameVal = Application.GetSaveAsFilename("C:\*.xlsm", "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
    Andreas.

  • Set file name as a variable. Then use it to name a folder

    I'm making a workflow that I want to get the selected file, then create a new folder using that file's name. I made a workflow as follows:
    Get selected Finder Item (In this case a JPG image)
    Set Value of Variable
    New Folder (dragging the variable from 'Set Value of Variable')
    But running this workflow it adds the path of the file to the new folders name, as well as the file's name (e.g. instead of the folder being called 'Photo1' it's called '/Users/Jono/Desktop/Photo1.jpg').
    Does anybody know how I could get it to just the file name (preferably without the extension) instead of prefixing it with the path?

    The New Folder action uses the specified text for the file name. The following Run AppleScript action will return just the names of the Finder Items passed to it:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    get a name from a file path
    input: a list of Finder Items (aliases)
    output: a list of names
    set output to {}
    repeat with AnItem in the input -- step through each item in the input
    set {name:TheName, name extension:TheExtension} to (info for AnItem)
    if TheExtension is missing value then set TheExtension to ""
    set end of output to (text 1 thru -((count TheExtension) + 2) of TheName) -- just the name part
    end repeat
    return the output -- pass the result(s) to the next action
    end run
    </pre>

  • Automator/Applescript to Create New Pages Doc in Selected Folder

    When working in Finder I'd like to be able to create a folder, and then (still within Finder) create a number of Pages documents inside that folder. This would help in organizing complex projects, and would be preferable to creating the documents (from the bottom up) in Pages and then laboriously assigning each document to a different folder.
    I've tried various solutions in Automator and Applescript but nothing has worked.
    For example:
    try
    tell application "finder" to set myFolder to (folder of the front window)
    on error -- no open folder windows
    set myFolder to path to desktop folder
    end try
    tell application "Pages"
    activate
    set myDocument to make new document with properties {path:myFolder}
    end tell
    But this gets an error "Can't make [the selected folder] of application "Finder" into the expected type. (-1700).
    In automator, I've tried to do the following:
    1. Get Selected Finder Items (which will be the folder I want)
    2. (Create new variable "path" and drag onto 1., which creates "Get Value of variable)
    3. (ignoring input) Get Specified Finder Item (specifying a blank Pages document)
    4. (accepting input) Copy Finder Item to variable "path"
    The problem with this is that step 2 returns both the desired folder AND the desktop. The result of the entire process, moreover, is that the blank Pages file is created (or rather copied to) the desktop ONLY, and not to the desired folder.
    Anyway, I hope someone can help me with this. It would really speed up my organizing process.
    Wes

    Taking care of true window's properties is often useful
    on run
    try
    tell application "Finder" to set myFolder to (target of the front window) as alias
    on error -- no open folder windows
    set myFolder to path to desktop folder
    end try
    set myNewDoc to my makeNewIworkDoc("Pages", "myNewDocument" & my dateTimeStamp() & ".pages", myFolder as text)
    end run
    --=====
    Creates a new iWork document from Blank.template,
    saves it and returns its pathname.
    example:
    set myNewDoc to my makeNewIworkDoc(theApp, docName, folderPath)
    on makeNewIworkDoc(a, n, d)
    local t, c
    if a is "Pages" then
    set t to ((path to applications folder as text) & "iWork '09:Pages.app:Contents:Resources:Templates:Blank.template:") as alias
    else if a is "Numbers" then
    set t to ((path to applications folder as text) & "iWork '09:Numbers.app:Contents:Resources:Templates:Blank.nmbtemplate:") as alias
    else
    if my parleAnglais(theApp) then
    error "The application “" & a & "“ is not accepted !"
    else
    error "l’application « " & a & " » n’est pas gérée !"
    end if
    end if
    set f to d & n
    tell application a
    set c to count of documents
    open t
    repeat
    if (count of documents) > c then
    exit repeat
    else
    delay 0.1
    end if
    end repeat
    save document 1 in file f
    end tell -- theApp
    return f as alias
    end makeNewIworkDoc
    --=====
    on parleAnglais()
    local z
    try
    tell application "Numbers" to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    on dateTimeStamp()
    return (do shell script "date +P%Y%m%d-%H%M%S")
    end dateTimeStamp
    --=====
    Yvan KOENIG (VALLAURIS, France) vendredi 4 septembre 2009 20:51:02

  • Use Automator to create new subfolders in a selected folder

    This seems like it should be easy to accomplish, but I have had no luck.
    I want to be able to select a folder, and then run an Automator Service to create a specific set of subfolders within the selected folder.
    I am able to set up automator to create the subfolders, but it does so in the folder containing the selected folder.
    Any suggestions on how to accomplish this simple task?

    Which type of variable should I choose? I tried "text" but there's no way to set it to "input"? There are many Variables in the Library.
    Here's how I have things set up now, I thought the "Service receives selected 'folders' in 'Finder'" (at the very top of the workflow area) would pull in the selected folder.
    Thanks!

  • How can I set PATH environment variables when there is no ~/.profile?

    Hi,
    I have a MacBook Air and just installed MySQL.
    I read the doc which I downloaded and should be able to run "mysql" from terminal as descibed below:
    Suppose that your MySQL programs are installed in /usr/local/mysql/bin and that you want to make it easy to invoke these programs. To do this, set the value of the PATH environment variable to include that directory. For example, if your shell is bash, add the following line to your .bashrc file:
               PATH=${PATH}:/usr/local/mysql/bin
    I checked on my terminal with ls -al, but no ~/.bashrc also no ~/.profile files.  Echo $SHELL shows me that I am using /bin/bash as shell.
    When I run export PATH=$PATH:/usr/local/mysql/bin  then it works and I just have to type "mysql" to get the mysql command line but as soon as I kill my terminal and open a new terminal this setting is lost.
    Any idea how I can accomplish this?
    Thanks,
    MacNewby

    Hi,
    Never mind, I found it :-)
    I just created a file  .bash_profile in my home folder and added "export PATH=$PATH:/usr/local/mysql/bin" and restarted my terninal. Now it works.
    MacNewby

  • Variable Folder Path AppleScript

    Ive been working on a script for nearly a month now! Im still learning basics.
    I have been trying to create a script that first reads all the folder names from a folder on the server.
    It then takes those names and puts them in a drop down menu as list.
    The folder name would be selected, then a dialog box would ask for a new folder name.
    The script would then make the new folder in the folder that was selected previously.
    Ive cracked the drop down menu part using CocoaDialog.
    The problem I have is taking the selected folder and placing that at the end of the folder path.
    Now im just getting into a mess with things and im going round and round in circles
    So far I have:
    set theFolder to alias "Server:folder"
    tell application "System Events"
              set l to {name of theFolder} & name of folders of theFolder
    end tell
    set args to ""
    repeat with i from 1 to (count l)
              set args to args & quoted form of item i of l
              if i < (count l) then
                        set args to args & " "
              end if
    end repeat
    (do shell script "/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog \\
         standard-dropdown --title Title --text Text --items " & args)
    set {button, answer} to paragraphs of result
    if button is "1" then
              return item (answer + 1) of l
              set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name")
              set newfoldername to JobName
              set thePath to theFolder & result as text
              set newfolder to make new folder at thePath with properties {name:newfoldername}
    make new folder at newfolder with properties {name:"Admin"}
    make new folder at newfolder with properties {name:"Images"}
    make new folder at newfolder with properties {name:"Previous"}
    make new folder at newfolder with properties {name:"Supplied"}
    make new folder at newfolder with properties {name:"PDFs"}
    end if
    end
    Any help would be amazing
    Many thanks

    You need to tell an application that can make folders to "make Folder".
    In the simplest terms, this fails:
    set the_folder to (choose folder)
    make folder at the_folder with properties {name:"New Folder"}
    But this works:
    set the_folder to (choose folder)
    tell application "Finder" to make folder at the_folder with properties {name:"New Folder"}
    However, this would still error if a folder with that name already exists in that location and your script would need to allow for that.
    Hope this helps.

  • I'm working in Photoshop CS6 on a Mac and am having trouble when I select a Path it automatically feathers the selection border. I can't seem to find any place to adjust a feather setting. Does anyone have a suggestion? I'm using paths to silhouette an im

    How do I change a default from feathered edge to sharp edge when I select a path?
    I'm working in Photoshop CS6 on a Mac and am having trouble when I select a Path it automatically feathers the selection border. I can't seem to find any place to adjust a feather setting. Does anyone have a suggestion? I'm using paths to silhouette an image on a photograph to use in another document and I need a hard edge on it, not a feathered one.

    In the Paths panel, click the flyout menu (in the top right of the panel) and choose Make Selection (this option will only be available if you have a path selected). Reduce the Feather Radius to 0 (zero) and click OK. This setting will be the default even when clicking the Load Path as Selection button.

  • How to set the DVD Folder Path?

    Hello, had a quick question regarding the folder path
    variable when accessing DVD video files. When authoring, Director
    seems to automatically add a hardcoded file Name to the cast member
    properties, as well as a folder path to the DVD member properties.
    So I am wondering how to handle this - obviously during
    authoring the director DIR/projector is on the hard drive while the
    video_ts is on the DVD disc. When deployed, everything will be on
    the DVD of course.
    During my first test, the projector was authored with the DIR
    on the hard drive while the DVD was in the D: drive. When I swapped
    the DVD to my other optical drive ( E: ) and restarted the
    projector, it complained it could not find the video_ts folder. And
    on a Mac it looked for a /Volumes/ path which I could not even
    manually point the projector to.
    So should I copy the video_TS to the hard drive so the
    relative path between the projector and video_TS folder always
    stays the same? Or does Director ignore the filepath at runtime and
    always search the DVD drives on the host machine for a video_ts
    folder,regardless of where it was during authoring? The
    documetnation is a bit unclear on that part..and of course my goal
    is that the projector find the video_ts folder on the DVD disc,
    regardless of what drive letter/volume name it is on.
    BTW, this approach -
    http://www.adobe.com/go/tn_19277
    , does not seem to work

    Check these 2 links may help you
    http://www.rittmanmead.com/2010/07/obiee-11gr1-scaleout-clustering-and-high-availability/
    http://www.rittmanmead.com/files/collab11_borkur_clustering.pdf

  • Set selected text as variable (CS3 with JS)

    How can I set a piece of selected text as a string variable?
    I'm running InDesign with InCopy CS3 on a Windows XP computer.

    If you mean "assign the selected text to a variable", then you could do this:
    var myText = app.selection[0].contents;
    Peter

  • ITunes Music Folder will not play from external hardrive after setting the correct path

    I've decided to try and create some more space for my music collection and decided to keep my entire iTunes library on a portable external hardrive. I researched how to do so online and was successful at first. I set the correct path from the advanced menu so that iTunes would recognize and save music to the folder on my HD. It worked fine last night, but today when I try and access it I get the, "could not be used because the original file could not be found. Would you like to locate it?" error message when I try and play a song anywhere in iTunes. I then tried to import the library from my external hardrive and then everything was duplicated. I some how reversed the duplication by using time machine and then redownloading iTunes, which is a riduculous story in itself, but thankfully, I am back at square one.
    I have over 24,000 songs with a majority of them rated as well as playlists I do not want to lose. I don't understand why it will not play the songs. Can anyone help me?

    If you are going to have the library on an ext HD the transfer the entire iTunes folder. This way you capture all the files - not just the music.
    Launch iTunes with the 'option' key down and follow the dialog - tell iTunes to open the iTunes library file on the ext HD and things should be ok.
    MJ

  • Simple question about environment variables and setting the class path???

    ok I have been trying for a few months now ontrying to set the class path..
    I work with windows vista..
    on the environment variables user variables,
    I have the name of the variable as class
    and the value as C:\Program Files\Java\jdk1.6.0_04\bin;.
    where javac is...
    on the system variables I have
    its name as class
    and the value as C:\Program Files\Java\jdk1.6.0_04\bin;.
    why is this not reading javac

    The PATH environment variable should have as an entry the directory containing your javac executable. The CLASSPATH should have have entries which define your library directories and entries which are your jar file libraries. In the early days, probably the only CLATHPATH entry you will need will be a '.' to indicate the current directory.
    The Java tutorial covers ALL of this.

  • How to set the PATH Environment variable with multiple homes?

    I have several Oracle homes, and now I cannot get reports to work anymore. These are the things I installed, in this order:
    - Oracle Database 10g
    - Oracle Developer Suite 10g
    - Oracle Discoverer 4
    - Oracle HTMLDB
    Now my PATH environment variable is flooded with paths, but none seem to work when I want to start Reports 10g. I deleted all of the paths from the other homes and still no luck.
    This was my original PATH:
    C:\oracle\product\10.1.0\db_1\jre\1.4.2\bin\client;
    C:\oracle\product\10.1.0\db_1\jre\1.4.2\bin;
    C:\oradev10g\jdk\jre\bin\classic;
    C:\oradev10g\jdk\jre\bin;
    C:\oracle\product\10.1.0\compdb_1\jre\1.4.2\bin;
    C:\oracle\product\10.1.0\compdb_1\bin;
    C:\oracle\product\10.1.0\compdb_1\jre\1.1.8\bin;
    C:\oracle\product\10.1.0\compdb_1\jre\1.4.2\bin\client;
    C:\Disco41Home\bin;C:\oracle\product\10.1.0\db_1\bin;
    C:\oradev10g\jdk\jre\bin\client;C:\oradev10g\jlib;
    C:\oradev10g\bin;
    C:\oradev10g\jre\1.4.1\bin;
    C:\oradev10g\jre\1.1.8\bin;
    C:\PROGRAM FILES\THINKPAD\UTILITIES;
    %SystemRoot%\system32;
    %SystemRoot%;
    %SystemRoot%\System32\Wbem;
    C:\WINDOWS\Downloaded Program Files;
    %SystemDrive%\IBMTOOLS\Python22;
    C:\Program Files\PC-Doctor for Windows\services
    and this is the PATH after I stripped it:
    C:\oradev10g\jdk\jre\bin\classic;
    C:\oradev10g\jdk\jre\bin;
    C:\oradev10g\jdk\jre\bin\client;
    C:\oradev10g\jre\1.1.8\bin;
    C:\oradev10g\jlib;
    C:\oradev10g\bin;
    C:\PROGRAM FILES\THINKPAD\UTILITIES;
    %SystemRoot%\system32;
    %SystemRoot%;%SystemRoot%\System32\Wbem;
    C:\WINDOWS\Downloaded Program Files;
    %SystemDrive%\IBMTOOLS\Python22;
    C:\Program Files\PC-Doctor for Windows\services
    What am I supposed to change to get Reports to work again (i.e. do more than just show the splash screen)?
    Forms and Designer work just fine....

    Never mind I found my solution here:
    Re: Oracle Developer hangs when starting...i'm desperate

  • How to select directory path in a selection screen

    Hi ,
    We can select a file path using the below statement :
    DATA : P_FILE  TYPE RLGRAP-FILENAME.
    But how can the similar be achieved for a directory, that is if one wants to select a folder.
    Folder path can be retrieved from the function : "TMP_GUI_BROWSE_FOR_FOLDER" but this doesnt give us the privilege of displaying the path selected in a parameter form as is with the file type.
    Any kind of help would be apprecialble.
    Thanks!!!!

    Hi,
        Try with below Method
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS : p_file LIKE rlgrap-filename MODIF ID ccc.
    SELECTION-SCREEN END OF BLOCK b2.
    *     AT SELECTION SCREEEN                                               *
    AT SELECTION-SCREEN ON VALUE-REQUEST  FOR p_file.
      PERFORM f4_filename.
    AT SELECTION-SCREEN ON p_file.
      IF p_file IS INITIAL.
        MESSAGE 'Please fill the path' TYPE 'E'.
      ENDIF.
    *     START OF SELECTION                                              *
    START-OF-SELECTION.
    *&      Form  F4_FILENAME
    *       Get the file from presenation server
    FORM f4_filename .
      DATA : lit_filetable TYPE filetable,
             lw_rc TYPE i.
    *  Get file from presentation system
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'Find File'                 "#EC NOTEXT
    *    DEFAULT_EXTENSION       =
    *    DEFAULT_FILENAME        =
          file_filter             = '*.*'
          initial_directory       = 'C:\'
    *    MULTISELECTION          =
    *    WITH_ENCODING           =
        CHANGING
          file_table              = lit_filetable
          rc                      = lw_rc
    *    USER_ACTION             =
    *    FILE_ENCODING           =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *  Read file name into variable
      READ TABLE lit_filetable INTO p_file INDEX 1.
    ENDFORM.                    " F4_FILENAME
    Regards
    Bala Krishna

  • Populate updatable drop down list based on files in the folder path

    Hi, 
    I am a beginner in labview. I am stuggling on where to start.
    Here's what I need to do. 
    I want to create an updatable drop down list. It can be automatic upon opening the program or manually update by clicking an update button. The drop down list will list all the filenames that are in .cvs format. These files are stored in a folder path.  Insider the folder, they are stored in different subfolders, the drop box should be able to find those files inside the subfolders. Once the user select a filename from the list, the program will read the data inside that file and import into an array so I can display the data. 
    I have an idea on how to display the data, but I don't how to populate the drop down list based on the files in the folder, make it updatable and then import that user selected file's data into the the array. 
    Can anyone help me with this? 
    Thanks, Ruth

    Yup, ListFolder with a pattern of *.csv.  Then use a property node on a combo box or ring to set the items in the drop down.  Here is some free training if you are interested in learning more general LabVIEW tools.
    NI Learning Center
    NI Getting Started
    -Hardware Basics
    -LabVEW Basics
    -DAQ Application Tutorials
    3 Hour LabVIEW Introduction
    6 Hour LabVIEW Introduction
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

Maybe you are looking for

  • Unable to upgrade from Windows 8.1 SL to Windows 8.1 Pro

    I just bought a brand new Lenovo G510 notebook and I am battling to upgrade from Windows 8.1 SL x64 to 8.1 Pro x64. I used the process: Right click This PC -> Properties -> Get more features with a new edition of Windows -> I already have a product k

  • Argument not specified for parameter error.(IIF) Report Builder 3.0

    Hi, Im trying to set the font colour of text dynamically dependant upon the date.  This is using report builder 3.0 expressions. -I'm new to using expressions.  I want my expression to do this: If less than or equal to today, RED,  If greater than to

  • PL/SQL items

    How can we use a PL/SQL item (an idex for exemple) in a PL/SQL function or procedure belonging to the same database schema ?

  • Assign faulted

    I have an assign that is faulting because an error in evaluating the <from> expression results in the <to> expression being null. This is happening when I assign one variable to another and also when I try to assign a string that I type into the expr

  • Info Spoke Transformations

    Hello All, I am extracting data from a BW Cube to a flat file via BW Info Spoke. But the extracted data contains some negative signs, which are extracted as it is form the cube ( Eg: 2047.52- ). These negative amounts cannot be used for calculations