I have created an Applescript that requires to run automatically & repeat every time a pdf file is present within the folder on a server.
Look at the folder
File present?
Hold until file present
Activate script and complete
Look at folder - Repeat
Does anyone know where to start?
Related
I'm trying to duplicate my desktop file on apple script using script editor but I can't figure out how to do it. Can someone please help me?
The following command will duplicate your Desktop folder in Finder as Desktop copy and will be in your Home folder:
tell application "Finder" to duplicate desktop
The following commands will duplicate the target object directly on the Desktop, i.e., objects within the Desktop folder in your Home folder in Finder .
The following command will duplicate every file on your Desktop:
tell application "Finder" to duplicate every file of desktop
The following command will duplicate every folder on your Desktop:
tell application "Finder" to duplicate every folder of (path to desktop)
The following command will duplicate every file and folder on your Desktop:
tell application "Finder" to duplicate every item of (path to desktop)
NOTES:
This is to address the comment made by has:
As to: "1. You don’t need path to desktop as Finder’s application object already has a desktop property containing a reference to the user’s Desktop."
This is not categorically a true statement and depends on how it's being used. It's true with the Desktop folder itself and files within the Desktop folder, however it is absolutely false with duplicate every folder of and duplicate every item of, and without using (path to desktop) in these instances it errors out with the following error statement:
"Finder got an error: The folder “” can’t be moved into itself." number -122
As to: "2. Never do duplicate every item of desktop – if the Finder’s preferences are set to display mounted volumes on the Desktop then those will be included too, and you definitely don’t want to duplicate those!"
That statement is categorically false!
He/she (has) obviously doesn't know what he/she is talking about because mounted volumes are not located within the Desktop folder in your Home folder. By default, they are mounted at /Volumes and while they can appear on the Desktop, they are not directly connected to the Desktop folder in your Home folder.
In this reference the Desktop and Desktop folder in your Home folder are not the same thing!
I am trying to use Automator to take a bunch of previously-created folders and create two new folders within each one, an "Originals" folder and a "Scans" folder. I would like to be able to drag or select the folders that need the subfolders and then have the action run automatically.
I've tried making both an action and a service to add the subfolders, but when I select multiple folders, it only runs once.
Here is a screenshot of what I've done so far...
Try saving the workflow as an Application:
Save the Application to your Desktop, then you can drop folders there whenever you want.
Here is an AppleScript that, when Exported as an Application, functions as a Droplet to make the desired folders in every folder dropped thereon:
on open droppings
repeat with everyDrop in droppings
if (info for everyDrop)'s folder is true then
--make two folders
tell application "Finder"
make new folder at (everyDrop as text) with properties {name:"Originals"}
make new folder at (everyDrop as text) with properties {name:"Scans"}
end tell
end if
end repeat
end open
on run
display dialog "Drop some folders here to add Originals and Scans folders" buttons {"Aye Aye"} default button "Aye Aye"
end run
This is probably something simple but its driving me crazy...
I was just able to build my first automator workflow, which is quite basic and uses the Subtitles application to download subtitles for movies in a specific folder.
The Actions are:
Get Folder Contents
Filter Finder Items (to only movie files)
Open finder item with the Subtitle app
It works fine when I execute the workflow from within Automator because it has a "Folder Action receives files and folders added to:" clause in the beginning which tells which folder to use.
However, I want to save that as an application so I can schedule that on iCal but, when I save as an app, the clause which tells the folder is no longer available and looks like I need to pass the folder name as a parameter/argument and I have no idea on how to do that.
So, what I need guidance is on how to have the app executed in iCal while telling it which folder to use.
Thanks in advance...
Just add a "run applescript" action above your "Get Folder Contents" action. Make the applescript code look like the following. Make sure to put your folder path between the quotes.
on run {input, parameters}
return "/Users/username/Desktop/"
end run
Note: a quick way to get a path is to run this in Script Editor and use the result.
return POSIX path of (choose folder)
I am working on a script that will move the entire contents of a folder, including all subfolders and the files within, to another folder when I mount my bak drive.
Just for testing I wrote a simple script to check how I can do this (I don't really know AppleScript, so it's learn as I go), I used the following cmd in my applescript:
move every file of entire contents of folder "Lion:Users:dbooster:desktop:outbox" to "Lion:Users:booster:desktop:file"
So my test, as you can see is moving everything within a folder on my desktop called "outbox" into a folder called "file" on my desktop.
At first I thought it worked perfectly, but then I tried to put another folder within "outbox". What I discovered is this script moves all the files within that subfolder in "outbox", but it doesn't move the subfolder itself.
That is to say, if I test with outbox/stuff/file1.txt and run the script, the result is file/file1.txt, NOT file/stuff/file1.txt which is what I would expect.
Uhm... This seems like it should be easier than I am finding it. But I've been searching google for the past hour and can't come up with anything (maybe I'm searching for the wrong thing?) Any help would be appreciated -- thanks in advance.
Try:
tell application "Finder" to move entire contents of folder "Lion:Users:dbooster:desktop:outbox" to folder "Lion:Users:booster:desktop:file"
I need to rename image files sequentially as they are added to a folder. ie. image-0001.jpg and image-0002.jpg are in a folder I add test.jpg and it is renamed image-0003.jpg. I have tried automators rename function but it will start over with image-0001.jpg each time a new file is added instead of continuing the sequence.
Any help is greatly appreciated.
You could make this easy on yourself by using a handy application built into the OS called "Folder Actions". Folder Actions contains one or more special handlers, formally known as folder action event handlers, that run when they are triggered by a change in the target folder. I know I'm confusing but I'll do my best.
What you are trying to accomplish requires an adding folder items to event handler. It requires one direct parameter, which can be anything you wish i.e. target_folder. The handler requires an additional parameter as well; after receiving, which should also be a variable name, i.e. these_items. I have composed a script for you that should do the trick. I have added comments that show you what I'm doing when I do it. Here it is:
on adding folder items to the target_folder after receiving these_items
tell application "Finder"
set all_images to every item of the target_folder as list
repeat with i from 1 to the count of these_items --iterates through all the items you dropped in the folder
set this_image to item i of these_items --the current image
set the name of this_image to "image" & (i + the count of all_images) as string --renames the image based on the number of images already in the folder
end repeat
end tell
end adding folder items to
YAY! The script is done! But are WE done? Not quite. We still need to attach the script to a folder (the script won't run if you try to execute it in script editor).
To do this, first save the script as a Script File in the Folder Action Scripts folder in the Scripts folder in either the local Library folder or the current user's Library folder. Create the folder yourself if it doesn't already exist. Next, launch the Folder Actions Setup application by double-clicking it in the AppleScript folder in the Applications folder. In the window that comes up, click the + button under the table on the left (click the "Enable Folder Actions" checkbox if it isn't already checked) to open a standard file browser sheet, navigate to your desired folder, and click "Open". The Choose a Script to Attach sheet automatically opens, listing all the scripts in all of the Folder Action Script folders. Choose the newly-created script, click "Attach", and BAM you are done!
To see the script in action, drag an image onto the folder. The image is instantly renamed, regardless of if the folder window is open. If you have any questions, or if the script doesn't work, just ask me. :)
well without digging through some code and handin you an answer I'll tell you want you want to do
is create a while loop that checks for the existence of image-000 & i where i is a variable of course and if it exists increment i then when the file doesn't exist rename your file.