Applescript to add numbers to end of folders names
Hello,
I wrote a script that can rename files and add sequential numbers to them (below):
set theResult to display dialog "Please enter a name and a number separated by a space." default answer "enter image name here + space + 1" buttons {"Cancel", "OK"} default button 2 with icon 1
set theText to text returned of theResult
set theNumber to last word of theText
set theOffset to offset of theNumber in theText
set theName to text 1 through (theOffset - 2) of theText
set k to theNumber as integer
global theMaximumLength
tell application "Finder"
set theFiles to files of front window
set theMaximumLength to length of (k - 1 + (count theFiles) as text)
repeat with thisFile in theFiles
set theExtension to name extension of thisFile
set theNumber to my addZeros(k as text)
set the name of thisFile to theName & "_" & theNumber & "." & theExtension
set k to k + 1
end repeat
end tell
But I want to write a script that will JUST add and _1 to the end of multiple folders. In other words, take a bunch of folders already created like
342392501
342392401
340766601
340766201
339898101
339828301
339171301
337245001
337086803
337086802
337086801
and add _1 to all of them. BUT what would be even better would be a script that would duplicate each folder and ad an _1 to the original and then an _2 to the duplicate, and do that for all the folders in the finder.
Anyone? Thanks so much!!!!
Use code such as the following:
set the_list to "80
81
82"
tell application "Finder"
set target_folder to (choose folder)
repeat with this_number in paragraphs of the_list
set this_folder to (make new folder in target_folder with properties {name:this_number})
set name of (duplicate this_folder) to name of this_folder & "_2"
set name of this_folder to name of this_folder & "_1"
end repeat
end tell
Or to save a step if the creation dates don't need to match exactly:
set the_list to "80
81
82"
tell application "Finder"
set target_folder to (choose folder)
repeat with this_number in paragraphs of the_list
set this_folder to (make new folder in target_folder with properties {name:this_number & "_1"})
set this_folder to (make new folder in target_folder with properties {name:this_number & "_2"})
end repeat
end tell
(110675)
Similar Messages
-
HT5437 Why does apple configurator add numbers to my apple tv names?
I'm rolling out around 40-50 of the little black boxes across a school, and we've hit an interesting thing. When we name the device in configurator, lets say
SCH-TV-4.001
where 4.001 is a building and room number, apple configurator is making the name add a seemingly random digit in brackets at the end of the name like
SCH-TV-4.001 (2)
This is only seen in our MDM and on an iOS/OSX device, when searching for an airplay device.
Most odd. Seems to start at 2, and if we rebuild, it makes 3 etc...
Any clues?I understand that point. They are mostly bought from iTunes. But, I can watch on my laptop, iPad, iPhone on an airplane or wherever without an Internet connection. So why the hang up on my apple tv, should it not just be an extension of my laptop?
-
Applescript to add multiple assets to INDL
Hi
I'm having problems writing an applescript that will take an item (or all items) on a page and add it/them to the Indesign library. I can get all graphic elements associated to an advert ID (eg: advert name 12345678, has 6 associated graphics named 12345678_*) and I can place them onto the page. I cannot then add these to the the library that has been created by the same script (12345678_library.indl).
I've tried (snippet):
set graphiclist to ""
set graphicpath to (standardgraphicpath & lastdigits & ":")
set graphicnumber to (count of files in folder graphicpath)
set graphiclist to (name of every file in folder graphicpath where name contains adCID) as list
repeat with i from 1 to number of items in graphiclist
set graphicname to item i of graphiclist
set fullgraphic to (graphicpath & graphicname)
tell application "Adobe InDesign CS3"
try
set mypage to page 1 of spread 1 of active document
tell mypage
set placedgraphic to place fullgraphic
tell document 1
set activegraphic to item 1 of mypage
set addgraphic to store graphiclib using activegraphic
end tell
end tell
on error
activate
display dialog ("Had a problem with graphic " & graphicname)
end try
end tell
--tell lib to get graphic and add to library
end repeat
I contstantly get a the error "Had a problem with graphic " & graphicname after the pictures are placed on the page
I don't mind if we can make use of "Add items of page 1 as separate objects" as I can place all images successfully.
Can someone please tell me where I'm going wrong - I think my head is about to explode!
Thanks in anticipationThanks for that Shane, but for some reason the script is reporting that it can't get item 1 of page 1 of spread 1.
I can't see why not, there's only one item on the page, plus the library panel that is open.
Have I moved the store line to the wrong place?
repeat with i from 1 to number of items in graphiclist
set graphicname to item i of graphiclist
set fullgraphic to (graphicpath & graphicname)
tell application "Adobe InDesign CS3"
try
set mypage to page 1 of spread 1 of active document
tell mypage
set placedgraphic to place fullgraphic
end tell
on error
activate
display dialog ("Had a problem with graphic " & graphicname)
end try
set activegraphic to item 1 of page 1 of spread 1
set addgraphic to store graphiclib using activegraphic
end tell
end repeat -
Applescript to Add Same Photo to a Group of Contacts
Can anyone please help with an Applescript to add an image to a group of contacts in one foul swoop.
My intention is to add a logo image to a group of colleagues.
Here is what I have so far, - but receive this error
tell application "Address Book"
set the_people to every person in group "Pilots"
repeat with this_person in the_people
set pict_file to choose file of type "TIFF" with prompt "Choose a tiff file"
open for access pict_file
close access pict_file
set image of person to pict_file
try
end try
end repeat
end tell
The error I receive is
error "Can’t set «class az50» of «class azf4» to alias \"Macintosh HD:Users:Steven:Desktop: Pilot2.tiff\"." number -10006 from «class az50» of «class azf4»
I would like to reference the image file to the script and not have to reselect it for every record.
Thanks in Advance.You might have a look at [this article|http://smithsrus.com/setting-an-address-book-picture-with-applescript> and try this:
*set pict_file to choose file of type {"public.tiff"} with prompt "Choose a TIFF file"*
*open for access pict_file*
*set pict_data to read pict_file as "TIFF"*
*close access pict_file*
*tell application "Address Book"*
*set the_people to every person in group "Pilots"*
*repeat with this_person in the_people*
*set image of this_person to pict_data*
*end repeat*
*end tell* -
Hi to all,
while migrating from NW to OES, one clustered volume with one (and
always the same) folder is duplicated with an trailing zero at the
folders name.
Source is
USER:\Abteilung\Edv\
Destination is
/media/nss/USER/Abteilung/EDV0/
while
/var/opt/novell/migration/user2/log/filesystem.success.log
shows the correct destination
Copying USER:Abteilung/EDV/... to /media/nss/USER/Abteilung/EDV/...
But in fact a new folder ../EDV0/ (in capitals) ist created, even if the
folder ../Edv/.. exists. This behaviour ist just with this folder, all
other volumes and folders worked fin.
One thing here is special:
I have *copied* the files to the destination volume because of the need
to have loaded tsafs.nlm, which nback will use for miggui, with the
option /nocluster for IBM TSM purposes. After that, I triggered a
regular consolidation as described above and later I plan to synch files
and trustees using miggui.
Any hints on that silly thing?
TIA
TomOriginally Posted by mrosen
Tom,
On 04.03.2013 09:17, bwisupport wrote:
> But I think, your questions led me to the solution:
> The destination folder, copied with TotalCommander, was named 'Edv' (as
> TC shows the sources name too). Miggui sees a source called EDV, and at
> the destination a folder called 'Edv' and decides that these are two
> different folders. Because it is not possible having to folders with the
> same name (despite capitals) at the same place, a new Folder with
> trailing zero is created.
>
> I've deleted the 'EDV0', renamed the destination to EDV (cross-checked
> with Explorer and CLI) and restart a synch.
Hmmmm.... Something's very strange here anyways. Miggui *should* not
care about the case when the destination is NSS set to long namespace.
Either there's a bug in your version of miggui, or something else is
weird about that folder. It's also strange that TC and Windows Explorer
disagree on the capitalization. That again would lead me to the
assumption that something's broken originally with the source, like the
DOS and LONG namespaces on the source disagreeing somehow.
CU,
Massimo Rosen
Novell Knowledge Partner
No emails please!
Untitled Document
It sorta does. Apparently there's a bug in the miggui code that does this (although we only have it happen on OES2 SP3 to OES11 and it doesn't add a "0" at the end, it just stops processing after the main directory).
I've been waiting for NTS to file a bug report for over a month now.
anyway, Ramesh (the guy who kinda owns miggui) acknowledged there's a bug.
You can either:
1) use the migfiles command apparently instead of miggui
or
2) Rename the directory so that it matches, but with NSS you'll have to rename it twice. Like:
EdvX and then again to: EDV
Problem is with nbackup apparently that miggui uses. -
Can I use my iPad to record excel inventory figures? I have excel on my Macbook Air and have Mavericks on it. But I use the iPad when I run around taking inventory. The computer is just too large and cumbersome to carry while walking around. I Want to add numbers to my excel docs whilst right on my ipad as I go through inventory.
Is there a way to get my excel doc into my iPad and open it to add numbers?
And, because Mavericks is now the system that allows iPad (ios) devices to talk to Mavericks on macs, isn't this supposed to now be doable?
And, woe is me if not yet at this time. If so, is there an Application some smart person created that will allow me to transfer from mac to ipad and back to mac and excel numbers I input?
Muchos gracias!You will need Numbers (On your Mac) and then you can do what you wish.
-
Hi there,
How do I remove the (-signed) which Adobe adds to the end of the document name after having signed it?
It is not convenient to remove it every time I sign a document. So, is there a way to turn this off?
Thank youI think you cannot, because for many people it is so important to keep the unsigned document, and most do not realise this until it is too late.
-
How to add menu item in Virtual Folders Actions Menu
Hi ,
I am writting a custom component which will add some action on documents and virtual folder.
I am able to add the menu item for DocInfo, but not able to add Menu Item in Virtual Folders Actions Menu.
Please help!!
thanksI am able to add the menu item for DocInfo, but not able to add Menu Item in Virtual Folders Actions Menu.What exactly you are trying to modify? If web GUI, it should be following the same principles as your "DocInfo" changes (only the basis service is COLLECTION_DISPLAY). If you are trying to modify Desktop Integration Suite, I'm afraid there is no help (at least, I have not heard that DIS could be modified by custom components).
-
Unable to add XML files to genericObjects Folders using Webdav - cFolders
Hi All
I am not able to add XML files to genericObjects Folders using Webdav in cFolders
What could be the reason.. When I try to copy, it says "cant read from source file"
Regards,
AbyYes.. I downloaded the ECN.XML file from se80, edited and then used "Uplload and replace"..
Also I did the same thing to add some more vocabulary in the cfx text XML, so that it would reflect correctly to map with Additional attributes in the PDX profile.
Regards,
Aby -
How to add two zeros end of field
how to add two zeros end of field?
Hi srinu,
If it's a number field, then just multiply by 100.
If it's a string, then just use CONCATENATE and add the '00' to your existing string.
Hope this helps.
SL -
Every time I try to add a new video to my photo folder...iTunes says it's experiencing a problem and then it crashes and shuts down. What can I do to add video to my photo folders?
Hi mterry1723, one solution that might be worth trying is this:
- Close iTunes, if it's open
- Open Safari and got to 'Preferences'
- Select 'Security' on the top
- Untick all the security options in the menu
- Click the 'Show Cookies' button and look for all the 'apple' entries in the left-hand column.
- Highlight them (select them collectively) and press 'Remove'
- Now open iTunes and buy the song as usual.
- You may be asked to do the same security process as before, so do as asked.
- Hopefully, the security check will now have accepted your answers and start downloading the song as normal.
Remember to re-tick all the required security options you had just un-ticked in Safari preferences. You don't need to bother about opening the cookies again.
I hope this has worked for you and my profoundest apologies if it has not. Worth a go, though!
I did see this thread: https://discussions.apple.com/message/18259935#18259935 which may be of more help, mainly the last entry by 'c2boyd'
Message was edited by: Bongomal -
Please can you help my Register of names... I want a formula that simply adds numbers in a horizontal row of cells that increase as I add them. It can not be a range of selected cells because as I add new cells they are not in the range. Thanks..
Hi Dave,
Any formula that references its own row will return the error message you see unless it is in a Header column.
Convert columns B, C and D to Header Columns, and Jerry's formula will work just fine:
One caution, though—multiple header columns are a known factor in slowing Numbers down as the table gets larger. You can avoid adding header columns by specifying a 'fixed' range of cells from wich to get the sum and count values in C2 and D2.
Make sure the range includes at least one 'extra' column. As more runs are added, add columns by inserting them before this 'extra column. If the new columns are inside the range specified in the formula, Numbers will adjust the formula to add the new columns. If they are outside the range, you will need to edit the formulas yourself.
Note revised formula:
To add four more runs, click on any cell in column L, then press option-left arrow four times to insert four new columns. Note the change in the formula:
The last column is always included in the formula, but never gets counted (or summed) because its content is interpreted as a Text value, not a number.
Note: Except for the change formulas and added columns, this is your original table, with one Header row and one Header column.
Regards,
Barry
Regards,
barry -
How can I add numbers to the foots.
I asked the help section, but I cannot find
Import (Importübersicht)
nor name files (Datei benennen).
I would like to add a name and a number.
Thanks.Do you want to add numbers when importing the photos or afterwards?
When importing, use the "Rename Files" brick in the Import panel. You may have to add this brick from the "Import Settings" drop-down panel.
Then use one of the presets that will add an index or counter:
If the images have already been imported, try the "Metadata" menu: Metadata > Batch Change > "Custom name with index" or similar.
All these methods will change the version name in Aperture, but not the original filenames. If you actually want to change the filenames of the originals, try "Apply to original files" when batch changing the version names. -
[Solved] How to: Automatically add Semicolons at end of line
Q. Is it possible to set JDeveloper to automatically add Semicolons to the end of a line of code?
A. "While there is nothing that does this in batch mode to all your lines, while you are writing a line you can press the CTRL+SHIFT+Enter (complete statement in the source menu) shortcut and it will complete your line for you including the semicolon." [Solved] How to: Automatically add Semicolons at end of line
Original Message:
I'm spoiled from using Basic and similar programming languages, adding semicolons manually is something that'll take me time to get used to
Thanks in advance,
Abdulla
Tags (for search engines):
Jdeveloper automatic semicolon
Message was edited by:
AbdullaWhile there is nothing that does this in batch mode to all your lines, while you are writing a line you can press the CTRL+SHIFT+Enter (complete statement in the source menu) shortcut and it will complete your line for you including the semicolon.
-
contact phone numbers show instead of contact names on my iPad , text messages etc. How do I change it so their names show
Did you change your sim card? I had this same problem because I moved countries and had to add a 1 before the number and area code.
Maybe you are looking for
-
I used to be able to connect my iPad to my house wifi network walking all over my house then one day it stopped. When i tried to connect to my network I would get an message saying "Unable to Join network". I found that if i was within 5 feet of my
-
I've noticed recently that I can make application windows slide under the Menu Bar. Some slide under then 'snap' back into view when I release the mouse button holding the window down. Others that don't display the grey bar at the top of the window
-
Not able to create a new DC through NWDS with NWDI Developer role
Hi everyone, My userid has NWDI Developer role assigned. I am trying to create a new Webdynpro DC under the software component defined in the configuration imported. It gives me an error after assigning the activity and pressing on Finish button. I w
-
How to restrict a user to login twice
hei evryone! Here's my prob... I need to restrict a user to login more than once meaning, if a certain user account is currently login , that account cannot be used concurrently using another window or machine... If another user attempts to login, us
-
How to Reduce cost of full table scan or remove full table scan while execu
Dear Experts need your help. I execute a query and create a explain plan in that plan i found cost of a table is very high (2777) and it was full table scan. Please guide me How to Reduce cost of full table scan or remove full table scan while execut