Using AppleScript
Hey All --
I am trying to do some file management and I know AppleScript could do it for me, but I'm a little confused as to exactly how.
I have a folder that has a bunch of audio files --- a couple of thousand, actually. Some are MP3s and others are AIFF's. What I am trying to do, simply, is locate the AIFF files, move them to a temporary folder, then convert these AIFF's into MP3s.
Somehow all I've managed to do so far is create duplicate files in my audio folder. Something tells me there is an AppleScript lurking about that does just what I'm looking for, but so far my searches are fruitless.
Any help would be most sincerely appreciated.
Anthony
Try using an AppleScript such as this one, and alter the last two lines in the repeat loop for your purposes. To move a file inside the do shell script line, replace the rm with mv, and append the following to the end of the line:
& "'/path/to/temp/folder'"
(13734)
Similar Messages
-
Using Applescript for uploading pictures on the Internet
Hello!
I was wondering if there was a way to use Applescript with Firefox (or another browser)...?
We have many many villas on our website, each one with lots of pictures. We are constantly adding new villas to our site and amending old ones.
To add pictures we go to a page in our cms for each villa, located there is a drop down menu - image 1, image 2, 3 etc etc etc
For each one we have to manually browse for and attach the photo. As you can guess this is a time consuming process, we have asked the web designer before for this but he is so busy and we have other more important stuff for him to be working on.
As Applescript is so nifty I was wondering if anybody had an idea on how to use it for this process - i.e. have a folder full of pictures on the desktop and Applescript can add them?
I have no idea if this is possible, any ideas?
Many thanks and regards.
SimonYeah I completely understand, I just wanted to see if anybody knew if it could be done.
Obviously for security reasons I can't let anybody into our CMS, so looks like it's a bit of an impossible task.
Although it would be awesome to simply change the script slightly for each villa and let it do it all, this would be stupidly complicated as there are many menus to navigate to get to the uploading picture area.
It would be great if I could do all that manually then once on that page (or given the page url to Applescript) set Applescript running to upload all the images for me.
This is what that page looks like, if this helps?!:
http://img535.imageshack.us/img535/241/screenshot20100415at141.png
The drop down menu contains:
Villa Plan
Small Location Map
Image Gallery 1
Image Gallery 2
etc
etc
I could arrange a folder with the pictures in order (i.e. Villa Plan first, then Small location Map, then the picture for 1 etc) so no worries about the Villa Plan and location map.
I've got a feeling I'm just going to have to do it manually (I shall forever be uploading pictures), but I thought I would give it to some of you geniuses to mull over!
For whoever creates a script I'll give you a discounted stay in Paradise... there's an incentive!!
Many thanks and regards,
Simon -
New to applescript. need to create a plist file using applescript
Needed some help I need on creatinga plist file below using applescript and I can't make it happen needed some hand on this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Username</key>
<string>${localAdminUser}</string>
<key>Password</key>
<string>${localAdminPassword}</string>
<key>AdditionalUsers</key>
<array>
<dict>
<key>Username</key>
<string>${userName}</string>
<key>Password</key>
<string>${userPassword}</string>
</dict>
</array>
</dict>
</plist>
I have tis code but it doesn't seems to work.
tell application "System Events"
-- create an empty property list dictionary item
set the parent_dictionary to make new property list item with properties {kind:record}
-- create new property list file using the empty dictionary list item as contents
set the plistfile_path to "~/Desktop/example.plist"
set this_plistfile to ¬
make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
-- add new property list items of each of the supported types
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:list, name:"AdditionalUsers"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
end tell
The result of the above code will generate a plist file below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdditionalUsers</key>
<array/>
<key>Password</key>
<string>${localAdminPassword}</string>
<key>Username</key>
<string>${localAdminUser}</string>
</dict>
</plist>Hello
You need to create elements at correct container. Like this.
set plist_file to (path to desktop)'s POSIX path & "example.plist"
--set plist_file to "~/desktop/example.plist"
tell application "System Events"
tell (make new property list file with properties {name:plist_file})
make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
tell (make new property list item at end with properties {kind:list, name:"AdditionalUsers"})
tell (make new property list item at end with properties {kind:record})
make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
end tell
end tell
end tell
end tell
Or you may create a record in AppleScript and set the value of plist file at once. Like this.
set plist_file to (path to desktop)'s POSIX path & "example.plist"
--set plist_file to "~/desktop/example.plist"
set dict to ¬
{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} & ¬
{|AdditionalUsers|:{¬
{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} ¬
--set dict to {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}", |AdditionalUsers|:{{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"}}}
tell application "System Events"
tell (make new property list file with properties {name:plist_file})
set value to dict
end tell
end tell
Regards,
H
Message was edited by: Hiroto (PS. Fixed second script so that it uses the original case (uppercase) in key string) -
How can I change the font size of an outgoing instant message using Applescript?
Text copied into Messages.app from a web page is often too small to read. Is there a quick way to boost the font size using Applescript?
HI,
I have spent some time looking at the Mix Message Case.scpt in Hard Drive/Library/Scripts/Messages and also Crazy Message Text.scpt in the same Scripts Folder but then the Mail one.
Both are Apple versions.
The Mix Case one is set in Messages > Preferences > Alerts
Set the top drop down to Sent Message
Enable the Applescript items and chose the Mix Case item.
It will look something like this in the current Font and size you have set.
ThEn aGaIn
Obviously you don't want all the bit to make the font change between upper an lower case but it does have the option to use it with the Sent Message and it also uses the entry in the text field as a String.
The Mail Crazy Message one opens a dialogue box when run.
it has a default phase and some Upper and lower limits to the size that will be used.
the Dialogue allows you to change the phrase and also "Set Prefs" to altert the font sizes.
The result is a text palce in a new Mail items and the font and size changes to look like this:-
Picture
It will look different everytime and the Font for each character and the size of each is randomised.
Although I have tried sticking in a line to change the size to anything other then my set font in the Mixed Case one I can't get it to work.
In some cases I get an Script error in Messages (It seems to think I am setting a Font called "10")
At other times it just says it can't set it buit still does the Mixed Case bit.
My hope was to change the size and then reduce the requirement for the "intercaps" routine.
I have other emails about new posts so I will anwser them and then spend some more time on this.
9:01 PM Thursday; June 13, 2013
iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad
"Limit the Logs to the Bits above Binary Images." No, Seriously -
Adding all day events using applescript to ical
Hey all. I am new to using applescript. Thanks to some top users i have been able to get excel events file transfered into ical.
I need help with the applescript for changing these events from time duration to all day.
tried
set the start time to 00:00 and end time to 24:00 and
set all-day to true
any help would be greatly appreciated!!
thanks.I have the exact same problem. I have entered birthdays for people I know starting with the year of their birth and never ending, an all-day event. They now don't show in 2007, but there is a detached event on January 1, 2000. When I delete that event and all subsequent versions of it, the initial event now ends in 2006 or 2007, and I have to set the repeat to end Never again. I fixed all the ones from February that showed up. Now I notice that a huge amount of the other birthdays (all day events) that I have entered are doing it now, and we are talking well over 40 of them. I don't understand why it keeps creating these detached events. I also publish my calendars, if that makes any difference.
-
ICal and subscribed calendars with MobileMe using AppleScript
I am having the same problem as many of you; I have a MobileMe account which does not sync the calendars I have in iCal that are subscriptions. I found this great script online which I'll post below. I don't know anything about AppleScript so I'm just copy-pasting. I want it to work, but I'm getting the error "The variable theOldEvent is not defined." right around the line "if similar_found is true then set theOldSummary to the summary of theOldEvent" kinda near the middle. Like I said, I don't know anything about AppleScript. So my question is; how can I fix this error and/or is there some better way of using AppleScript/Automator to do this same thing? Thanks!
Script to duplicate Calendar orgCalendar into target dupCalendar
E.H. 12.9.2008
property myCopies : 0
property myUpdates : 0
property myObsoletes : 0
property orgCalendar : "Sekretariat"
property dupCalendar : "Sekretariat copy"
property dupEvents : {}
property myDeletes : {}
set myCopies to 0
set myUpdates to 0
set myObsoletes to 0
set dupEvents to {}
tell application "iCal"
-- set theCalendars to every calendar
set theCalendarNames to title of every calendar
set theOrgCalendar to a reference to calendar orgCalendar
if theCalendarNames contains dupCalendar then
set theCalendar to a reference to calendar dupCalendar
else
set theCalendar to make new calendar with properties {title:dupCalendar}
--set theCalendar to make new calendar with properties {title:dupCalendar, color:"{65535, 0, 0}"}
end if
set the eventList to uid of every event of theOrgCalendar as list
set the eventCount to the count of the eventList
repeat with theUId in eventList
tell theOrgCalendar
set theEvent to (the first event whose uid is theUId)
-- set theProperties to the properties of theEvent as record
set theDate to the start date of theEvent
set theSummary to the summary of theEvent
set theStampDate to the stamp date of theEvent
end tell
tell theCalendar
try
set theOldEvent to (the first event of theCalendar whose (start date) is theDate as date)
set similar_found to true
on error
set similar_found to false
set theEndDate to the end date of theEvent
set theAllDay to the allday event of theEvent
set theLocation to the location of theEvent
-- Funny construction to work araund the fact that location may be missing a value
try
if theLocation is equal to "" then
end if
on error
set theLocation to ""
end try
set theDescription to the description of theEvent
try
if theDescription is equal to "" then
end if
on error
set theDescription to ""
end try
if theAllDay is true then -- work around a funny bug with all day events
set theDate to (theDate as date) + 2 * hours
set theEndDate to (theEndDate as date) + 2 * hours
end if
set newEvent to make new event at end with properties {summary:theSummary, location:theLocation, start date:theDate, end date:theEndDate, allday event:theAllDay, description:theDescription}
-- make new event at end with properties theProperties
set the end of dupEvents to (the uid of newEvent)
set myCopies to (myCopies + 1)
end try
end tell
set second_necessary to false
if similar_found is true then
set theOldSummary to the summary of theOldEvent
if theSummary is not equal to theOldSummary then
--is there a different one?
try
set theOldEvent1 to (the second event of theCalendar whose (start date) is theDate as date)
set theOldSummary to the summary of theOldEvent1
if theSummary is equal to theOldSummary then
set theOldEvent to theOldEvent1
set the end of dupEvents to (the uid of theOldEvent)
else
-- cycle repeat ?
end if
on error
-- beep
try
set theEvent1 to (the second event of theOrgCalendar whose (start date) is theDate as date)
set second_necessary to true
on error
set the end of dupEvents to (the uid of theOldEvent)
end try
end try
else
set the end of dupEvents to (the uid of theOldEvent)
end if
if second_necessary is true then
set theEndDate to the end date of theEvent
tell theCalendar
set theOldEvent to make new event at end with properties {summary:theSummary, start date:theDate, end date:theEndDate}
end tell
set the end of dupEvents to (the uid of theOldEvent)
end if
set theOldStampDate to the stamp date of theOldEvent
if theStampDate is greater than theOldStampDate then
-- update the event
set summary of theOldEvent to theSummary -- capitalization may have changed
set theAllDay to the allday event of theEvent
set allday event of theOldEvent to theAllDay
set theEndDate to the end date of theEvent
if theAllDay is true then -- work around a funny bug with all day events
set theEndDate to (theEndDate as date) + 2 * hours
end if
set end date of theOldEvent to theEndDate
set theDescription to the description of theEvent
try
if theDescription is equal to "" then
end if
on error
set theDescription to ""
end try
set description of theOldEvent to theDescription
set myUpdates to myUpdates + 1
end if
end if
end repeat
end tell
-- Delete obsolete events
set myObsoletes to 0
set myDeletes to {}
tell application "iCal"
set myUIDs to uid of events of theCalendar
end tell
repeat with myUID in myUIDs
if dupEvents does not contain myUID then
set the end of myDeletes to myUID
set myObsoletes to (myObsoletes + 1)
end if
end repeat
tell application "iCal"
repeat with myDel in myDeletes
delete (every event of theCalendar whose uid is myDel)
end repeat
end tell
-- delete duplicates
set myDeletes to {}
tell application "iCal"
set myStarts to start date of events of theCalendar
set mySummaries to summary of events of theCalendar
set myUIDs to uid of events of theCalendar
set myLength to length of myUIDs
end tell
repeat with i from 1 to (myLength - 1)
set thisStart to (item i of myStarts)
set thisSumm to (item i of mySummaries)
repeat with j from (i + 1) to myLength
set thatStart to (item j of myStarts)
set thatSumm to (item j of mySummaries)
if thisSumm is equal to thatSumm and thisStart is equal to thatStart then
set the end of myDeletes to (item j of myUIDs)
exit repeat
end if
end repeat
end repeat
set n to count of myDeletes
tell application "iCal"
repeat with myDel in myDeletes
delete (every event of theCalendar whose uid is myDel)
end repeat
-- set the visible of calendar theCalendar to false
end tell
display dialog (myCopies & " records duplicated, " & myUpdates & " records updated and " & myObsoletes & " obsolete ones deleted") as textNo longer an issue.
-
How to use AppleScript to set "character fill color" in Pages 5.2?
For Pages 5.2 on OSX 10.9.3, what is the correct applescript for changing the "character fill" of text in pages.
If you highlight text, you do this via your mouse in the inspector by clicking "style," "advanced option (the gear wheel to the right of bold, italics, and underline), "character fill color (clicking on the multi-color circle, not the dropdown menu), and then choosing a color that comes up in the "colors" dialogue box.
I've looked all over and cannot find how to use applescript to set the character fill color in pages.
In some examples (not directly related) I see "character fill" used.
In others, I see "colorfill."
Basically, I want to use applescript, embedded in a keyboard maestro macro, to change the background color of the text (not the text color itself) to particular colors.
Given the changes and updates to Pages this year, and to applescript, what's the easy way to do this?
Thanks!
ChuckPages v5.2 still does not include selection-object, or character background color entries in its AppleScript dictionary, as does Pages ’09. Indirectly, using System Events, you can get the text selection in Pages v5.2, but then you can do nothing to change the selection. No assurances as to if or when Apple will mature the AppleScript dictionary support for Pages v5 series.
-
How to find and replace using AppleScript for TextWrangler?
I ran into a problem after exporting my book into EPUB from Indesign CS4. In this book the Latin diphthong æ is used. Unfortuately it didn't translate very well into the EPUB or corresponding XHTML files. Is there a way to do a batch change using AppleScript to change these symbols √¶ into æ which is the code for the diphthong? If so, how?
I also have an issue with the symbol †, in some of the documents it appears as this ‚Ć. Can I do a batch change for that as well? If so, how?
I'm new to using AppleScript so I appreciate all of the help. Thank you so much!!Hello
Here's some observations -
æ = U+00E6
= <c3 a6> (UTF-8)
= <c3 a6> (MacRoman) = æ
† = U+2020
= <e2 80 a0> (UTF-8)
= <e2 80 a0> (MacRoman) = †
which likely mean that your source data is text in UTF-8 but destination (or viewer or intermediate converter) is interpreting the data as text in MacRoman.
Make sure you properly declare the encoding of XHTML or EPUB document as UTF-8.
Good luck,
H -
Moving a layer in Photoshop CS5 using Applescript
I have a layer in a document called "logo" and i want to duplicate it to every open document and then move it to a specific spot in each document
I got the duplicating thing happening but cant seem to move the bounds of the layer (says it is read only and cannot be changed)
here is what I have written
tell application "Adobe Photoshop CS5"
activate
set theDocs to count of documents
repeat with i from 1 to theDocs
duplicate art layer "logo" of current document to document i
end repeat
repeat with i from 1 to theDocs
set current document to document i
tell document i
set bounds of art layer "logo" to {0.456666666667, 6.38, 2.88, 6.77}
--Adobe Photoshop CS5 got an error: Property is read/only and cannot be changed
end tell
end repeat
end tell
This doesn't error but also doesn't move the logo at all
tell application "Adobe Photoshop CS5"
activate
set theDocs to count of documents
repeat with i from 1 to theDocs
duplicate art layer "logo" of current document to document i
end repeat
repeat with i from 1 to theDocs
set current document to document i
tell document i
set properties of art layer "logo" to {bounds:{0.456666666667, 6.38, 2.88, 6.77}}
end tell
end repeat
end tell
anyone know what the language is to move the layer around?In any language the way to move a layer x,y is to use translate… You will need to do the math from current x,y to required x,y given a distance… A read only property is just that regardless of language… Here is a quick example of how I did this kind of thing using Applescript… I still do the same method now but use the ESTK instead…
tell application "Adobe Photoshop CS2"
activate
-- Store the app settings
set User_Rulers to ruler units of settings
set User_Dialogs to display dialogs
set ruler units of settings to pixel units
set display dialogs to never
set Doc_Ref to the current document
tell Doc_Ref
-- Store the image res so we can put it back
set Original_Res to resolution
-- Change to work at 72 dpi
resize image resolution 72 resample method none
-- Move horizontal 1 inch
translate layer 1 delta x 72 as pixels
-- Move vertical 1 inch
translate layer 1 delta y 72 as pixels
-- Read the bounds propety
set Layer_Bounds to bounds of layer 1
log Layer_Bounds
-- Move the layer using bounds to top/left
translate layer 1 delta x -(item 1 of Layer_Bounds) as pixels
translate layer 1 delta y -(item 2 of Layer_Bounds) as pixels
-- Put back the image res
resize image resolution Original_Res resample method none
end tell
-- Put back the app settings
set ruler units of settings to User_Rulers
set display dialogs to User_Dialogs
end tell
You should get the general idea of how this works from this. It should move the first layer across 1 inch, down i inch then put it top/left. It assumes you have a layer that is not a background layer nor is it locked in any way… -
How I generate index markers using Applescript and tagged text!
One of the challenges I've faced in automating the book making process using Applescript with inDesign is that there don't seem to be any AS commands for making new index markers (anyone please correct me I if I'm wrong about this).
I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
Recently, I read a tweet from someone with a link to a technique which uses tagged text and find and replace with GREP to edit the tags, inserting the tagged text index tags in the text file and then re-placing the text file in the ID page. In itself, this works great. But I'm dealing with literally thousands of separate text frames, none of them connected in a story.
The books typically consist of around 1200 pages with almost that many people, each of whose names I need to index with "Lastname, Firstname" references. And those particular strings don't (can't) appear anywhere on the pages. There will also be about 50 ID files all combined into one book. So it is imperative that I have ID generate the native index markers. To help keep things straight and efficient, I'm creating separate small text frames to hold the lastname, firstname strings. I created an object style for these frames which sets the attributes to "nonprinting", and I place the frames in the margin.
Then I realized that I don't actually have to have ID export the tagged text files for each. I exported one prototype and copied its tags to properties in my script, and then I concatenate them with the respective list item values I import from the database.
At the proper point in the page building script, I tell "textwrangleer" to make a new document, set its contents to the index string for the current record, save it to disk, overwriting the previous one, and then tell ID to "place" it in the index text frame, which generates the ID index mark.
I actually got an AS error when I first tried this: "file doesn't exist" or some such. Then I realized that the "place" command was happening too soon, so I inserted a .5 sec delay in the script, and it worked.
This is actually my first major script for actual work, and I'm so excited about it! I promises to cut production time down to about a thenth of what it was.
I still have to add some logic to branch between handlers with slightly different parameters for five different page formats, but the same page building handler will work on all of them.A note on this:
Daniel Swanson wrote:
I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
These scripts typically search for words and immediately write out the page numbers they are found on -- one shot indexing.
The solution is to add both the topic and its page reference to the current document's index:
if (app.activeDocument.indexes.length == 0)
app.activeDocument.indexes.add();
app.activeDocument.indexes[0].topics.add(app.selection[0].contents).pageReferences.add(app.selection[0]);
The first lines only make sure there is an index to add to (per default, a new document has none).
The last line adds a selected word to the index (it must be a plain text string, hence the use of its 'contents'), and then adds a reference to the selection in the text itself.
Adding the same word a second time will for a change (quite untypically for ID's Scripting) not result in an error but simply add another page reference to the existing one.
When doing this in a loop: remember to work backwards, because the index marker itself gets inserted into the running text, and that will throw off your text indices. -
Importing XML using AppleScript in CS5.
Hi, totally new to inDesign but do programming and database work. I am looking to import an XML file created from our database. I can do a basic import manually after creating document and importing xml to load tags then creating text box element and tagging it and placeholder text. Now trying to automate using AppleScript. Found some samples from inDesign but not sure how to tie all the pieces together. Does anyone have a simple example that takes a small XML file and loads a few records automatcally into indesign. Maybe, create new document, create textbox element and create text placeholders and tags then import xml file?
Thanks,
JoeI don't work in applescript, but:
Does anyone have a simple example that takes a small XML file and loads a few records automatcally into indesign. Maybe, create new document, create textbox element and create text placeholders and tags then import xml file?
Err, when you say "records," you have me slightly concerned.
Because it is quite difficult to get Data Merge -like functoinality with XML.
Have you tested (and validated!) this workflow withoutscripting? -
Using AppleScript to launch an application on a different machine
Hi there,
I'm trying to use AppleScript to enable a couple of my Macs to talk to each other.
On one machine, I want to use this script:
tell application "Finder" of machine "eppc://user:[email protected]"
launch application "Rivet" of machine "eppc://user:[email protected]"
end tell
to have the other machine launch Rivet, a video server that I can access from the PS3/iPhone/iPad
everything seems to work without issue (i.e. no errors), except it doesn't do anything.
I see a line written to the console on "helium":
9/23/10 18:48:30 com.apple.AEServer[3535] launchproxy[3535]: /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Versi ons/A/Support/AEServer: Connection from: xxx:xxx:xxx:xxx:xxx:xxx%en0 on port: 60571
every time I run the script on the other machine, but, like I said, nothing else happens.After much searching and trial and error I finally discoverd Hiroto's suggestion from way back in 2001. It is the only solution I have found that actually works to launch/activate any application on a remote Mac using an applescript on a local Mac.
I have one Mac Mini running household control applications Indigo and iRed. I wanted to use embedded AppleScripts in those applications to launch and control PandoraBoy on another MacMini that I use as a media center. I discovered that you cannot activate an application on a remote Mac unless it's already running. (Only God and Apple know why!) And, of course, if you want to launch and application--it's usually NOT running!
But the following works:
set remoteMachine to "eppc://RemoteMachineName:[email protected]"
tell application "Finder" of machine remoteMachine
open ("/Applications/PandoraBoy.app" as POSIX file as alias)
end tell
THANK YOU HIROTO!!!
Once the remote app is actually launched/activated you can then send AppleScript commands to it as follows:
set remoteMachine to "eppc://RemoteMachineName:[email protected]"
using terms from application "PandoraBoy"
tell application "pandoraboy" of machine remoteMachine
playpause
end tell
end using terms from
I have also learned that the application to be controlled on the remote machine must also be present on the local machine and "using terms from" must also be used in the control script for this to work. -
How can I use Applescript to copy a file's icon to the clipboard?
Hello,
How can I use Applescript to copy a file's icon to the clipboard?
Thanks.
Lennoxthere is no way to do that that I know of. but you can extract an icon of a file to another file using command line tool [osxutils|http://sourceforge.net/projects/osxutils]. you can then call the relevant command from apple script using "do shell script".
-
Having trouble using applescript to save pdf as excel spreadsheet
I have been trying to use applescript to create an automator action to convert some downloaded PDF's to .xlsx format. After reviewing a good bit of the SDK documentation, I came up with the following scripting:
tell application "Adobe Acrobat Pro"
open theFile
save front document to file theNewFile using conversion "com.adobe.acrobat.xlsx"
close front document
end tell
This script works fine when I use the "com.adobe.acrobat.plain-text" conversion or the png or jpeg conversion. However, I cannot get it to work with "com.adobe.acrobat.xlsx" or "com.adobe.acrobat.spreadsheet". Note that although I didn't copy the code here that sets theNewFile variable, I have been changing it to the appropriate file extension when changing conversion strings.
When I execute the script using one of the problem conversion strings, Acrobat opens the file successfully, but it just sits there, as if it does not understand the save command at all.
I guess I should mention that the whole goal here is to actually convert the PDF's to CSV eventually. The next step was going to be to open the file in Excel and save as CSV. If anyone knows a *free* way to go straight from PDF to CSV using Applescript/Automator without having to go through all these other programs, I would be very appreciative for the suggestion. This conversion is just a small part of a very lengthy workflow but it is causing me the most trouble.Hello Jonathan,
Ok i have only one final question.
Do you know how to work in photoshop, don't you? Ok i think yes.
Well i have 2 ways to do that, i did one action from photoshop that will get the image inside folder and will convert this image in pdf. Abouve the line of script
that you have to attach to folder action and the action for Photoshop.
About the action for Photoshop give me your email address and I send you, or do it your self. You have to do this: open one image in JPG, go to action, go new set, put your name of set, put the name of action if you like you can change the name, go print with preview, print and set save as PDF close your file and stop the action.
Now that you have to do is put all your files inside your folder and leave the Photoshop do it for you, ok?
Good Luck
Hack
property speak_alert : false -- if true, the script will speak the alert. If false, the script will display an alert dialog
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
property copychecksindicator : false
property itemcheck_delaytime : 2
property foldercheck_delaytime : 3
property speciallabelindex : 7
on adding folder items to this_folder after receiving added_items
if copychecksindicator is true then
set the added_items to my checkaddeditems(the added_items)
if the added_items is {} then return "no vaild items"
end if
tell application "Finder"
activate
set this_folder to choose folder with prompt "pdf"
set these_files to every file of folder this_folder
end tell
tell application "Finder"
repeat with i from 1 to number of items in these_files
set this_path to (item i of these_files) as string
tell application "Adobe Photoshop CS2"
launch
open file (this_path as string)
set this_files to current document
do action "Jpg" from "Jpg para Pdf"
end tell
end repeat
end tell
end adding folder items to -
How do I use AppleScript to Change the Creation Date to the Current Date?
I sorted my downloads folder by creation date and found that the items were sorted seemingly randomly. On closer inspection, I saw that the creation dates were not the same as the dates that I downloaded the items, so I figures that Snow Leopard was using the date given to it by the server.
In order to get the items sorted by download date, I figured I'd use Hazel, but it doesn't have a “change creation date” item. It does, however, have an “run AppleScript” item.
So my question is this: how do I use AppleScript to change the creation date of an item to the current date?TC (Techno Cat) wrote:
Okay, I tried changing the creation date with SetFile, but it kept giving me an error:
What am I doing wrong?
Looks like the date and time was not quoted
Try this Applescript. It will change the creation date of every file in the Downloads folder to the current date and time:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #E6E6EE;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
set current_date_and_time to do shell script "date \"+%m/%d/%Y %H:%M\""
tell application "Finder"
set filelist to every file of the alias (the path to downloads folder as text)
repeat with currentFile in filelist
do shell script "/usr/bin/SetFile -d " & quoted form of current_date_and_time & space & quoted form of POSIX path of (currentFile as string)
end repeat
end tell</pre> -
Using applescript how do I set the angle of a gradient
Using Applescript I need to set the angle of the gradient to 90 degrees. I've tried everything I can see in the scripting guide.
This is a sample of the script I'm using to set the gradient all I need to know is where and how to set the gradient to horizontal. Please forgive me as I'm a real newbie at this!!!
tell application "Adobe Illustrator"
activate
make new document
set ellipseRect to {100, 100, 500, 500}
set ellipseColor to {cyan:0.0, magenta:100.0, yellow:100.0, black:0.0}
set myellipse to make new ellipse at beginning of current document with properties {bounds:ellipseRect, inscribed:true, reversed:false, stroke color:ellipseColor, fill color:ellipseColor}
set Doc_Ref to the current document
tell Doc_Ref
if not (exists gradient "My Gradient") then
set This_Gradient to make new gradient at end with properties ¬
{name:"My Gradient", gradient type:linear}
set properties of gradient stop 1 of This_Gradient to ¬
{midpoint:50, ramp point:0.0, color:{cyan:0, magenta:50, yellow:100, black:0}}
set properties of gradient stop 2 of This_Gradient to ¬
{midpoint:50, ramp point:100.0, color:{cyan:10, magenta:100, yellow:100, black:0}}
end if
if exists path item 1 then
set fill color of every path item to {gradient:gradient "My Gradient"}
end if
end tell
end tellI think I the gradient angle property is broken, try rotating the object setting all the "change" properties to false, except changeFillGradients.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout])
Maybe you are looking for
-
IPhone and Blackberry: Pic text issue?
I'm trying to get pic text to me FROM a blackberry with no luck...but the Blackberry can get my pic texts? What gives?? Thanks all!! Vince
-
Dear all, I am creating an iView within VC which runs two BI queries from one variant input form. From the outputs i can create two output tables which supply all the information i require. My question is, can I combine the results of the two outputs
-
Table Journaling need the user to be LDAP
Has anyone cahnged the code in TAPI to provide the LDAP user instead of the tnsnames user? If so can you let me know how you did that ? thanks
-
Weblogic generates incorrect WSDL when policy is applied
Hello all! Please help. It looks like a bug. I have and WebLogic 10.3.3 instance and some JAX-WS services. It works fine till I turn on WS-Security. Weblogic generates a non-standard WSDL when I apply any Policy for any webservice. So, look an exampl
-
I erased my phone with the icloud now i can't activate it please help me
it says something about activation server unavailable