Script to select files in a folder based on extension
Does anyone have a script that would select files in a folder based on extension, then move the files somewhere else?
Hi Kagey and welcome!
You have to be completely accurate about the path. If your hard disk is called "Macintosh HD", then it's
every file of folder "Macintosh HD:Applications:FileMaker Pro 6 Folder" whose name extension = "tab"
You can generalise this for other users if you can't be sure about the name of their hard disk:
set apps_folder to path to applications folder as string
set fmp_folder to apps_folder & "FileMaker Pro 6 Folder"
tell application "finder" to get every file of folder fmp_folder whose name extension = "tab"
HTH
H
PS - well done in the footy
Similar Messages
-
How to run script on selected files in Bridge
I have a script that takes an open Photoshop document and saves it to four different resolutions in different folders. I'd like to be able to select files in Bridge and run the script on the selected files instead of having to do it each image individually in PS. Anyone know how to do this? Thanks!
EricMarkWalsh wrote:
A fairly easy way, you can add your script to the 'Scripts' menu, then create an action that calls this script (use 'Insert Menu Item' to add to your action) and call this action through a batch in Bridge. One issue with this, though, is that it does require creating an action to specifically call the script, I don't know if you can call the script directly from Bridge.
I haven't scripted Bridge at all myself, but I believe you should also be able to rewrite your script to get the selection in Bridge, and process those files in Photoshop.
If your script is set up to process one file at a time, the Bridge/Batch technique is the simplest way to do it.
If your script needs to know what all of the files are before it can begin processing, you have to add a Menu element in Bridge and have it call your action/script in Photoshop. A bit more complicated, but there are a lot of examples of this at ps-scripts.com.
-X -
Possible to run a photoshop script by selecting files in Bridge?
Hi,
I have a good script I've written that I always used to run from Photoshop. The script has a dialog box which asks where to get the files from. Is it possible to select files in bridge and run the script from there? Without rewriting it for Bridge?
Thanks,
Stan> I have a good script I've written that I always used to run from Photoshop. The script has a dialog box which asks where to get the files from. Is it possible to select files in bridge and run the script from there? Without rewriting it for Bridge?
Yes, this is possible. However, a much easier solution is to select the files in
Bridge then switch to PS manually to run your script. It avoids having to having
to write any code to run in Bridge at the cost of not having seamless integration.
In xtools/xlib/XBridgeTalk.jsx I have a set of functions that simplify working
with Bridge from within PS. For instance:
var files = XBridgeTalk.getBridgeSelection();
will return an array of Files that are currently selected in Bridge. If Bridge
isn't running or if no files are selected it returns an empty array.
-X
for photoshop scripting solutions of all sorts
contact: [email protected] -
Using script on multiple files in a folder.
THis has GOT to be easy, but I can't figure it out.
Walgreens wants you to email photos to them, but I usually do like 50 photos at a time. So, I created a script that takes an object and emails it. The problem is, I don't know how to do it to one photo, then the next, etc. It will do all the photos, but that is one HUGE email!
So that's my question. How do I get the script to run individually on multiple files?
Thanks in advance.
DaveCopy, paste, edit (where appropriate), and save - the code below as an application (AppleScript applet):
-- Code starts here --
property toAddress : "[email protected]"
property tSubject : "Please process my photo(s)."
on run {}
my send_Photos(choose file with multiple selections allowed)
end run
on open (dItems)
my send_Photos(dItems)
end open
on send_Photos(tItems)
with timeout of 0 seconds
tell application "Mail"
repeat with i in tItems
try
set tMessage to make new outgoing message with properties {visible:true}
tell tMessage
make new to recipient at end of to recipients with properties {address:toAddress}
set subject to tSubject
tell application "Finder" to set fname to displayed name of i
set content to ("Attached is the photo: '" & fname & "'." & return & return)
tell content to make new attachment with properties {file name:i} at end of last word of last paragraph
send
end tell
end
end repeat
end tell
end timeout
end send_Photos
-- Code ends here --
Double click on the applet and select the desired file(s), or drag the desired file(s) onto the applet - for further processing. -
Can i run a script on multiple files in a folder
i have a folder where i have 60 files. Each file takes about 45 to 1 hr to go through the script and the script is same for all files. So I was thinking to create a script that can run over night and next morning i can come and distribute all my files. It’s a simple script that looks for some specific words and highlights them.
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/common/html/w whelp.htm?context=Acrobat9_HTMLHelp&file=BatchSeq_BatchSequences.96.1.html
http://acrobatusers.com/tutorials/2008/06/a9video_using_batch_processing_for_tasks/
http://acrobatusers.com/tutorials/2006/batch_process -
basically what i'm looking for is a command to:
identify the open file (in any application)
select that file in finder so that i can do with it what i want through automator /applescript
i want this to be available under the "service" tab in the application menu
so say i have a pages application open, i go to "pages" --> "services" and then click the service i've just created which selects this file at it's location in the finder and does my desired action
thanks for your help!I believe that you would need to develop a cocoa application to add items to the Services menu. Another approach would be to use the Scripts menu.
-
JFileChooser selected file changes when folder chages
Problem with JFileChooser,
The selected filename change when i change the directories, note that standard windows dialog doesnt behave like this .
To reproduce: choose "save to file" in process dialog, enter the file name and then change the directory. The file name disappers from the corresponding box. The dialog must keep the entered file name while changing the folder path
is this a bug ?,
renjithHi,
Yes it is!
http://developer.java.sun.com/developer/bugParade/bugs/4357012.html
Regards,
Manfred. -
PSE8/Vista: Can I do a mass smart-fix on all/selected files in a folder?
I'm running PSE8 under Vista Home Premium.
I would like to transmit many files to a print shop (Walgreens, Ritz, etc.) but they do not offer the ability to automatically enhance (smart-fix) each file, so I have to do it at home before transmission.
Is there a [simple] procedure that would smart-fix a bunch of photos in one fell swoop rather than individually?Barb,
In another thread, PS.com Mark says,
"You can apply Auto Smart Fix to multiple photos from the Organizer; control-click the photos to multi select, and choose the Edit > Auto Smart Fix (control Alt M) menu command; the program will rip through them, one at a time, until they are all done."
Comment? -
Using AppleScript to sort files Into Specified Folders based on Extension
Hi All!
Here is what I am trying to figure out. I would love some help with this script if anyone can lend a helping hand. I am currently using Hazel to do this but I think AppleScript will be alot more effective.
Situation:
- I have a folder with 4 different file types inside - the extensions are (.cop, .cof, .cos, .cr2)
- These files need to be organized in this folder structure Captureone > Cache > Proxies
> Settings50
- The .cop & .cof files both need to be put in the "Proxies" folder
- The .cos needs to be put in the "Settings50" folder
- The .cr2 can stay where it is.
I'm already using an AppleScript application where it automatically creates the folder structure in the current finder location, which works great. I use a program named Hazel to sort the files automatically into the folders where they need to go. Unfortunately all my computers at work don't have Hazel and I would like help to make a script. Any thoughts to add to my existing script?
# define a list of folders - items will need to be quoted if they contain spaces, etc.
property theFolders : {"Captureone/Cache/Proxies", "Captureone/Settings50"} -- can also nest, e.g. "Inside/One"
try
tell application "Finder" to set targetFolder to (target of the front window) as alias
on error -- no window
set targetFolder to (choose folder)
end try
# build a parameter string from the folder list
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, space}
set {theFolders, AppleScript's text item delimiters} to {theFolders as text, tempTID}
do shell script "cd " & quoted form of POSIX path of targetFolder & "; mkdir -p " & theFoldersHi,
applescript_problems wrote:
for example:
master folder name: 1
sub folder path: 1>2>3>4>5
insdie folder 5 theirs 3 folders: 5a, 5b, 5c
i want to name my files like so: "name_5a" "name_5b" "name_5c
i want the scrip to pick up all the files that ends with the name "_5a" and place them in folder 5a
I presume that the files are in the master folder not in the subFolders, that the files has an name extension.
This script take the first two characters after the last underscore.
It will move the file in the subfolder, according to the two characters found.
set targetFolder to (POSIX file "") as alias --<-- drop the master folder between the double quotes
tell application "Finder"
repeat with tFile in (get files of targetFolder)
set tName to name of tFile
set subname to my getChar_1_2AfterLastUnderscore(tName)
-- example : subname = "5c" --> folder "5c" of folder "5" of targetFolder
if subname is not "" then
tell folder subname of folder (text 1 of subname) of folder targetFolder
if exists then move tFile to it -- if exists this folder then move this file
end tell
end if
end repeat
end tell
on getChar_1_2AfterLastUnderscore(t)
if "_" is in t then try
set oTID to text item delimiters
set text item delimiters to "_"
set t to text 1 thru 2 of last text item of t
set text item delimiters to oTID
return t
on error
set text item delimiters to oTID
end try
return ""
end getChar_1_2AfterLastUnderscore
To get the exact path of the master folder :
Drag/drop the folder between the double quotes in the first line of the script. -
Move selected files into a new folder
here's what I'd like to do:
-- select a number of files in the Finder
-- run the script
-- get a prompt for a new folder name and location
-- move (not copy) the selected files into this folder
Sounds possible but so far eludes me. Any help please?Thanks, that helped a lot.
I played some more with this and made a more simplified script that uses the finder for naming of the new folder and then renaming it.
tell application “Finder”
set the_folder to container of item 1 of (get selection) as alias
end tell
tell application “Finder”
set new_folder to (make new folder in folder the_folder)
move selection to new_folder
end tell
tell application “Finder”
select new_folder
end tell
tell application “System Events”
keystroke return
end tell
15" 1.67ghz PB, 20" 2ghz G5 iMac Mac OS X (10.4.6) -
How to get Latest file from a Folder
Hi,
I would like to access latest file in a folder based upon time stamp in the file properties. Can anybody help me in this regard.
Regards,
VisumanHey,
I hope this solves your problem.
If you have any questions, just ask them
Greetz, Bart
P.S. the solution is in the attachment
Attachments:
file.jpg 91 KB -
Finder jumping to previously selected file - iMac 10.6.8
I am having the frustrating problem on my IMac running 10.6.8 that the finder is jumping to previously selected file whenever I expand a new folder. So, if I select file A in Folder A, then scroll down and expand Folder B, the Finder automatically jumps back up to file A at the top of the screen. Sometimes I don't even have to open a new folder, if I just scroll down the list of files/folders, it will sometimes jump back up to the selected file. Is this a bug? A setting? It wastes a lot of time as I have to keep going back to where I was in the finder window...
I have searched this on this forum and on Google and nobody seems to have any answers. I would hope that Apple would fix this bug in an update if it is indeed a bug, or, if it is a setting, where can I change it?
Thanks for any help!The white iMacs from 2006 can only be upgraded as high as 10.7 which is Lion, not Mountain Lion. RAW files work fine on my 2006 white iMac with Lion so upgraded to 10.7 and then try out RAW images before you purchase a new machine. On a side note, I found the white iMacs quite slow (what with their age) and so I installed an SSD drive. Well worth the money! Impressively quick for an older machine.
-
Script to delete files created on a specific date with sepecific name
Hi,
Is it possible to help me with a powershell script that delete files under a folder and subfolders that have the following attributes
1. have the name (default.*) and (index.*)
2. created on a specific date say 1-9-2014
3. created between specific time say between 10:00 - 16:00
Thanks in advance!break out the components of the script.
IE does this match
Get-ChildItem -Recurse c:\temp\*.*or Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
CreationTime -lt (get-date "01-09-2014 14:00PM")}Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
CreationTime -lt (get-date "01-09-2014 14:00PM")} | Where-Object {$_.name -match "default"}Might not be working as it might not be matching.Once you get it matching the remove-item will work.
Cheers,
Martin
Blog:
http://sustaslog.wordpress.com
LinkedIn:
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. -
Labeling folders based on extension
Is it possible to label a folder based on extension?
For example if I have a folder like this Pictures-WORK / Documents-WORK is it possible to get OS X to label all my folders based on the -WORK ?
Kind regards,
MaximeHi Niel,
Thanks for the reply,
Could you explain a bit more about that script rule?
Kind regards,
Maxime -
Script/Automator Get Filenames in Folder and Move Each File into Folder based on Filename?
I have searched for an answer to this and I have searched through multiple file renaming apps on the app store too but alas I cannot find anything that does what I want so I ended up looking into Automator as my saviour but I am a total NOOB.
What I want to do is point automator to a folder of my choosing
Automator then takes each file in that folder and creates a folder with the same name as the file and then move the file into that subfolder.
Sounds easy enough eh
I'm totally stumped, anyone have any guidance ???This is a PITA to do in automator - automator does not handle loops the way it should - but in applescript it looks like so (open this in the applescript editor, select the file you want to run it on in the Finder, then run the script):
tell application "Finder"
set mainFolders to the selection
-- selection returns as a list, so even if there's only one folder a loop is used
repeat with thisFolder in mainFolders
--get the folder's contents
set containedItems to every item of thisFolder
repeat with thisItem in containedItems
-- get name of file, add 'ƒ' to avoid name conflicts
set newFolderName to (displayed name of thisItem) & " ƒ"
--make folder, move item
set newFolder to make new folder at thisFolder with properties {name:newFolderName}
move thisItem to newFolder
end repeat
end repeat
end tell
Maybe you are looking for
-
When I try to download an audiobook from my iTunes Library I get the message that 'it was not copied because it cannot be played on this iPod. I had just downloaded another audio book from the same library to the same iPad so don't know what the pro
-
OSB Business service not getting created
Dear team, We created a db adaptor which invokes a DB procedure with input paramter as tabletype . Db procedure and tabletype are in same schema . We are trying a generate a Business service based on jca file. We are getting error "Error while retri
-
Apparently the only way to bookmark all tabs now is to use some clunky key combination. Why have you made it more difficult to use? I have given all the details that I know how to give. I can find no place that I can check a box or otherwise tell Fir
-
Basic customs and import cess flowing in MIGO
Hello , At present basic customs and import cess are flowing in the MIGO document,. The requirement is not to display the basic customs and import cess to flow. Please let us know the config related to it thanks
-
Latest itunes error message when trying to upgrade
I keep getting an error message when I try and upgrade my itunes. It says that the data was corrupted . I have tried several times. All the same message