Apple script apply prefix the number in a particular order?
Hi all
I would like to write a script that adds a prefix number to a bunch of files in a very particular order.
Please see screenshot below.
I want to precede the files shown on the left, starting at '001' but in the order of the list on the right.
That is to say
001 clubworx BA CYF
002 name me BASS
etc.
Any help with this is greatly appreciated.
Thank you for taking the time to read this.
Kind regards
John
Use the following syntax:
Set namelist to {'BA clubworx CYF.fxp', 'name me Bass_2.fxp"}
the_num Set to 0
Repeat with this_item in namelist
Set the_num to the_num + 1
the_string value «»
If the_num < 10 then set the_string to '0' & the_string
If the_num < 100 then set the_string to '0' & the_string
the value the_string the_string & the_num & "" & this_item
Tell application "Finder".
Set the name of the file window this_item the_string 1
tell the end
end repeat
(142019)
Tags: Mac OS & System Software
Similar Questions
-
Essbase calc script to determine the number of occurrence
Hello
is it possible within a calc script to determine the number of occurrence of a value in the account dimension?
I have an account called ranks which can contain any value between 1 and 10. I would like to know how many times each value is repeated for a specific cost center. It's in a database of planning BSO.
Thanks in advance for your contributions...
CL
This isn't the typical calculation you would do in an OLAP architecture, but yes it is certainly possible.
you will need to create 10 accounts such as occurrence_of_1, occurrence_of_2 etc.
Then you increment them according to the value of the 5th year.
Don't forget to put in your calculation!
-
Basic conditional script based on the number of lines in a text layer?
Just received help here to write a conditional script by using the font size of a text layer. Thank you all for this.
The next hurdle is a conditional script using the number of lines in a text layer in the differential. Far as I can tell it not the layer details which specify the number of lines. Just '\r' for a return in the idTxt descriptor. Nothing seems to stand for a soft return as far as I can tell. I'll probably have to be able to count the lines with soft and hard returns.
Any thoughts?
I was playing around with this a bit and here is a small script to determine the number of rows. This is based on the self in the head, that I calculated to environ.108 times the size of the font.
#target photoshop app.preferences.rulerUnits = Units.POINTS; var doc = activeDocument var tL = doc.activeLayer var h = tL.bounds[3]-tL.bounds[1] var per = ((h/5)-(tL.textItem.size))/tL.textItem.size var num = h/(tL.textItem.size *1.108) alert(Math.round( num))
-
Script to determine the number of lines of text in a paragraph?
I'm revisiting a problem I posted here last summer, thanks to all those who have offered help, but I could not sort it out.
http://forums.Adobe.com/thread/455526?TSTART=0
What I'm after is a 'search' function to insert in a FindChangeByList.
Jongware suggested the following - but when inserted in my list, I can't seem to do anything - it does not take a Javascript error.
app.findTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedParagraphStyle = "Callout_3";
foundItems = app.activeDocument.findText();
for (var i=foundItems.length-1; i>=0; i--)
{
if (foundItems[i].paragraphs[0].lines == 2)
foundItems[i].paragraphs[0].appliedParagraphStyle = "Callout_2";
if (foundItems[i].paragraphs[0].lines == 1)
foundItems[i].paragraphs[0].appliedParagraphStyle = "Callout_1";
}I regularly get a 'word' document on which I run a "FindChangeByList" that cleans and formats the text with a number of GREP/text searches.
One of the lines of research converts a particluar to the text string to a paragraph style "Callout_3" (the most common legends).
This style applies to paragraph NET, above and below the line, to create a block/strip of color that says text is reveresed.
The problem I have, is that the style (due to the rules of paragraph), works well if the paragraph has x 3 lines of text.
I have updated styles in place for any eventuality - Callout_1 (for the single line of text), Callout_2 (for x 2 lines of text) etc.
I'm looking for is a script that can count the number of lines in the paragraph (once the "Callout_3" style has been applied) and then change the style accordingly the number of lines in each paragraph/legend.
Any other thoughts?
Steve
-your script can be incorporated into a FindChangeByList .txt file?
No, he needs to access real paragraph finds it to count the number of line of this paragraph. FindChangeByList Find/change regular strings together, and you can not search for a certain number of lines.
-what it takes to go to the 'findStyle ('Callout_1');"reference within a"group of paragraph style"called"legends "?
... Nothing. Because the style can be within a group, I wrote this little function. The findStyle performs a loop on * all * paragraph styles in the document, the root and in each group and returns the first style with the name that you provide in the function call (tested!).
So if there is a 'Callout_1' style anywhere, it should find it... Are you sure you put the name at the top of the script? I've seen in a post later that it is actually called "Callout_1line".
-
Apple script to check the part of iTunes library XML with another application.
Y at - there no apple for script
Set 'share the XML library with other applications iTunes'. under the name selected
- iTunes
- Preferences
- Advanced tab...
I want to read itunes Media Library .xml, but in the last version of iTunes without xml is created by default,
so I want this XML created by my application through the apple script.
iTunes12.4
I don't think you can change that setting via AppleScript, however once you have enabled then the XML file will be generated and updated every time that the library is updated.
TT2
-
Apple script to check the part of iTunes XML library with other applications.
Y at - there no apple for script
Check "Sharing iTunes library XML with other applications." Of
- iTunes
- Preferences
- Advanced tab...
I want to read itunes Media Library .xml but lates itunes no xml is created by default,
so I want this XML created by my application through the apple script.
iTunes12.4
https://discussions.apple.com/message/28513383#28513383 - new with the parameter preferably 12.2 iTunes to turn create .xml
If you really want an AppleScript, I think you should ask on the iTunes for Mac forum, or maybe the OSX Technologies.
-
Script to get the number of CPUS in evaluation mode.
Hi team,
I would like to know the total number of CPU which is in trial mode. The script that I created is as below.
$ServiceInstance = get-view ServiceInstance
$Eval = (get-View ($ServiceInstance |)) Select - 1 first). Content.LicenseManager | Select - ExpandProperty licenses? | {$_. Name - match "Evaluation Mode"} | check the used box | Measure - Object - property used - sum). Sum
Write-host "$Eval".
By using this format, I got the number of licensed processors, but cannot get to the evaluation mode, do not know what is missing.
Can someone help me please.
Power required:
If there are 4 cottages with 2 CPU each running in evaluation mode, I need output like '8 '.
It was my mistake...
The entry is as below.
$ServiceInstance = get-view ServiceInstance
$Eval = (get-View ($ServiceInstance |)) Select - 1 first). Content.LicenseManager | Select - ExpandProperty licenses? | {$_. Name - match "product evaluation"} | "" check the used box | Measure - Object - property used - sum). Sum
Write-host "$Eval".
-
REQ: script to calculate the number of months
Looking for a script that will calculate the number of months between 2 dates (to 2 decimal points)
or if there is a way to make a calculation of the number of months
for example: if I go to google and say 75 days - months, it returns a value of 2.46
That's what I'm looking for
If anyone can help?
with a calculation of date or number calculation?
I tried # days / 365 x 12 but there is no decimal places. right guard rounded up/down
As mentioned in a month, the days are not constant throughout the year and change formula 28-31 days. How are you calculating the decimal value of the month?
A year has 365 days, if she did then there would be no need for leap years and centuries jump.
Calculation of a variable with the result of a calculation method is set to decimal.
cDateFormat = "d-mmm-yyyy";
var cStartDate = "January 1, 2000;
var oStartDate = util.scand (cDateFormat, cStartDate);
oStartDate.setHours (0, 0, 0, 000);
var cEndDate = "January 15, 2000;
var oEndDate = util.scand (cDateFormat, cEndDate);
oEndDate.setHours (0, 0, 0, 000);
nDiff var = oEndDate.getTime () - oStartDate.getTime ();
Console.println ("end date:" + cEndDate);
Console.println ("start date:"+ cStartDate ");
Console.println ("difference in milliseconds:" + nDiff);
Console.println ("difference in seconds:" + nDiff/1000);
Console.println ("difference in minutes:" + nDiff / (1000 * 60));
Console.println ("difference in hours:" + nDiff / (1000 * 60 * 60));
Console.println ("difference in days:" + nDiff / (1000 * 60 * 60 * 24));
Console.println ("difference in weeks:" + nDiff / (1000 * 60 * 60 * 24 * 7));
Console.println ("difference over the years:" + nDiff / (1000 * 60 * 60 * 24 * 365.2524));
Console.println ("difference in months:" + nDiff / ((1000 * 60 * 60 * 24 * 365.2524) / 12)); 12 months in a year;End date: January 15, 2000
Start date: January 1, 2000
Difference in milliseconds: 1209600000
Difference in seconds: 1209600
Difference in minutes: 20160
Difference in hours: 336
Difference in days: 14
Difference of weeks: 2
Difference in years: 0.0383296591617194
Difference in months: 0.45995590994063273Several turncate the decimal values scirpts because keeping them may not meet the need of specific calculation. You know that there are methods to roud until the next iniger, round.5 to the top and turnacate to the lower intiger.
According to the date of departure, the values may be different:
For a start date of February 1, 2000, 75 days would be 1,810 months but for a start date of 1 February 2001 75 days becomes 1,838 since the number of days of changes of February 29 to 28 and the number of days for the month of fractions varies from 26 to 27.
-
How to extract the number and other particulars
I am trying to write a simple Select query that returns a list of
Used EMPLOYEE_TABLE and in the second column names a count of the
number of entries for each employee in the EMPLOYEE_ATTENDANCE table.
Can anyone suggest how I might do this?
For example:
I have two tables EMPLOYEE_TABLE and EMPLOYEE_ATTENDENCE.
EMPLOYEE_TABLE:
emp_number emp_name
1A
2B
3 C
4 D
EMPLOYEE_ATTENDENCE:
emp_number emp_time
1 8.00
1 8.00
1 8.00
4 8.00
4 9.00
4
4
4
3
3
3
2
Now my requirement is I want to retrieve the list of employees with emp_name and the number of days
the employee came (ie the number of entries in the EMPLOYEE_ATTENDENCE table).
Some, such as:
A 3
B 1
A q
D 5Select
a.emp_name, b.emp_attendence
Of
Employee_Name has,
(select emp_number, count (emp_number) "emp_attendence" of the employee_attendence by employee_number group) b
where a.emp_number = b.emp_number;Kind regards
Navneet -
PowerCLI script to display the number of vCPU by VMhost use
Hi all
I'm looking to get help here with powerCLI script to list each total number of ESXi vCPU host that is used to determine if there are any ESXi host CPU is more engaged.
According to suggestion of performance in some blog vExpert, is around 1: 3 of Jepp core ratio: vCPU allocated, then how to display the report with the powerCLI for something like this:
PRODESXi01
Total of nuclei available: 32
Used by the virtual machine: 28PRODESXi02
Total of nuclei available: 32
Used by the virtual machine: 38So according to the result above, the PRODESXi02 is more committed by 6vCPU allocated to the virtual machine.
Note: The available total carrots is taken from the value of logical processors from the contents tab, when you click on the vSphere console.
How to get this report using PowerCLI?
Thank you
You mean something like this?
{Foreach ($esx in Get-VMHost)
$vCPU = get-VM-location $esx | Measure-object-property NumCpu-sum | Select - ExpandProperty sum
$esx | Select Name,@{N='pCPU'; E={$_. NumCpu}},
@{N = 'vCPU'; E = {$vCPU}},
@{N = "Ratio"; E = {[math]: Round ($vCPU / $_.)} (NumCpu, 1)}}
}
-
Script to list the number of PO in a specific range of accounting code
Helloo
I need a script to list all PO numbers within a specific range of accounting code. The script is used for the assessment of the stock.
Grateful if someone can help.
Hello
Please, if this answer is late; just ignore it
The following SQL select statement assumes that you know the costs/inv. natural accounts of valuation and natural account segment is 2:
Select po_num, authorization_status, closed_code
of PO_DISTRIBUTIONS_INQ_V one
where destination_type_code = no ('STOCK', 'FEES')
and a.code_combination_id in
(select b.code_combination_id in the GL_CODE_COMBINATIONS_V b where segment2 = all ('170702110', '720201000'))
"170702110", "720201000" are natural sample accounts
Thank you
-
How to use the script to display the number of columns contain no data
I have a requirement. There is a source that is the excel, the excel file file, we need to load data into the staging table. There are 5 columns mandatory ones must not be null. We used "No. Data Check" for this. The logic is so mentioned previously mentioned 5 columns don't contain any record that the record will be moved to without data. So far, it is fine. Now the requirement is to show what column or columns contain no data. We used a script to do this like:
RES =' '
RES = input1 [0] + ": failed because values null in required columns;"
INPUT1 [1] = res;
Output 1 = res;
But it shows message "down because of nulls in the required columns", which is a generic message. We must show what column or columns does not contain the value "failed because of null values in a column required columnA, columnB or columnC. Can someone help me in this regard. Any kind of help is appreciated.
You can use the variable inputname1, which keeps an array of names of the entry for the script processor attribute. For example:
var result = "";
var first = true;
for (i = 1; i< input1.length;="" i++)="">
If (input1 [i] == null | input1 [i] == ' ') {}
If {(first)
Firstly = false;
} else {}
result += "";
}
lead inputname1 += [i];
}
}
If (result.length > 0) {}
result = "failed due to null values in the following mandatory columns:"+ result; "
}
Output 1 = result;
Kind regards
Nick
-
PowerShell script to count the number of VM / file
Hello
As I'm not totally comfortable in powershell, I am just posting my question here as some of you can probably answer that in a blink of an eye.
How can I get a count of the VM / file?
Thanks in advance,
Erik
Hi Erik,
You can get a number of VMs per folder with:
Get-file | Select-Object @{N = 'File'; E={$_. Name}},@{N="number VM; E={($_| Get - VM | Measure - Object). County}}
Best regards, Robert
-
Need help to modify the Script to find the number of vCPU and reservation of memory in VC
Hello
Need help to modify the script so that his can person report to the vc all focus level instead of each level of the Cluster.
Thank you
KR
Try this instead:
$vmsInfo = Get-VM #Creating array to place new object $reportdata = @() Foreach ($vm in $vmsInfo) { #Creating new object $vmInfo = "" | Select Name, CPUReservationMHz, MemoryReservationGB $vmInfo.Name = $vm.Name $vmInfo.CPUReservationMHz = $vm.ExtensionData.ResourceConfig.CpuAllocation.Reservation $vmInfo.MemoryReservationGB = $vm.ExtensionData.ResourceConfig.MemoryAllocation.Reservation / 1024; #Inserting data into new object. $reportdata += $vminfo } $reportdata
-
Hello
I placed a chart of fusion in a rtf and I use that to generate a pdf file. I used a stacked bar chart.
When I download the pdf file, I am able to see the numbers in x axis.
Is there a way by which I can add a prefix to the numbers in the x axis (as a symbol of the euro).
Is it possible by changing the text 'Alt' of this image?
Thank you.For the title of the axis X just insert the following lines:
The values are just example
concerning
Jorge
p.s. If that answers your question, then please mark my answer as * "Correct" * or * "useful."
Maybe you are looking for
-
50G and problem with integrals, new user.
Hello! I am a student in electrical engineering and I bought a 50G as my first graphing calculator, since that's what most teachers recommend here. I have colleagues who use the same who also make things a little easier, but I have almost no experien
-
Photosmart 7520 printing in black and white?
I have a photosmart 7520. I want to print a black and white text form, but since there is no ink in the photo to the left cartridge, I can't print anything. Is it not possible to print only black and white stuff, whith this printer? Thank you Thomas
-
trying to get test drive unlimited to run on windows 7
I've successfully loaded the pc version of test drive unlmt. on our pc that is running windows 7. but when you click to start the game displays the cd turns as it tries to load, after about 10-15 seconds the game window appears for a second then dis
-
I have an old edition of Me of the Millennium, I know its as old as its sounds. I need to know if I can upgrade my computer using Windows 7
-
Hello I installed vista Ultimate edition with service pack one and installed all necessary updates. now when I want to log on to hotmail it tips download me IE 8, but when I try to install it it gives me a message that IE 8 is not supported on this v