Applescript in Leopard
Good Afternoon All!
I'm trying to use the fscommand in a flash projector file.
Before Leopard came along I used the code below to launch pdf
files. Now that I have Leopard installed I get an error box stating
that the classic code is no longer supported. Can anyone help me
with some new code to launch pdfs in the mac environment please?
.......................................................................................... ........................
You can try here:
http://www.apple.com/applescript/
and here:
http://developer.apple.com/documentation/AppleScript/Conceptual/AppleScriptLangG uide/
Message was edited by: lethal
Similar Messages
-
Folder Action Problems with Leopard 10.5.8
My company recently upgraded from 10.4.11 to 10.5.8 and our folder actions have been stopping mid-process or not working at all. Sometimes a few files will process and then everything stops completely.
Our workflow involves the use of several different hot folders that use folder actions (converting InDesign CS4 documents to various quality of PDFs). All of the actions are single stream, meaning each folder does the action it's assigned and the original file is trashed and the new file remains in the folder. There are no subsequent folder actions that pull from the newly processed files. We also only run one folder action (with several files dropped in it) at a time.
I have also tried running a pre-made generic folder action script from Apple and it, too will stop mid-process, process a few files then stop, or not work at all.
Does anyone know what might be causing this problem with either the new Applescript or Folder Actions with Leopard 10.5.8?I have several scripts that all work different ways. One script I have opens the InDesign document, exports a PDF to a different folder located elsewhere on the hard drive (where a different script searches for PDFs). After this the original document is sent to the trash. Nothing new is created in the original Folder Action Scripted folder.
What's more, even Apple's stock Folder Actions don't work properly and stop mid-process. I've seen vague reports of 10.5.8 having issues with Applescript or Leopard in general. The fact this script works perfectly in 10.4.11 makes me think that something has changed with the way Leopard handles the FA's. -
Applescript, Terminal 2.0 and opacity
Is there a way to change terminal opacity in an applescript on leopard ?
it seems to be possible on previous version, but since "background color" now take a RGB color, it's not possible to put the alpha as 4rth argument.
navigate in the "Preferences" menu with GUI scripting isn't an optionCan you provide more detail?
I'm trying to set the front window settings to one of the named profiles that I defined in Terminal preferences. I'm not sure how Applescript interprets "settings set".
tell application "Terminal"
do script "uptime"
tell front window
activate
set current settings of front window to <one of my window settings>
end tell
end tell
Actually, what I really want to do is launch one of my defined Window Groups with Applescript. Seems like it should be easy... but I have never found Applescript to make much sense. -
Re Trim file name scripts in SL
Below is a frozen, unanswered conversation regarding the missing finder scripts in SL. Luckily, I make a complete backup before converting, so I still have all the old Leopard scripts. Norwichfan, I feel your pain, and I thought that archiving your thread without an adequate answer was wrong.
Here's your answer. you can just get a copy of the old finder scripts, put them in /Library/Scripts and they'll show up in your script menu as before. I have zipped up a copy of them and posted them here:
http://tedward.org/finder_scripts.zip
norwichfan88
Posts: 12
From: Australia
Registered: Mar 25, 2010
Trim file name scripts in SL
Posted: Mar 26, 2010 6:26 PM
I have recently upgraded to SL and have found that the trim/add to file name applescripts from leopard are missing from my scripts menu.
Is there a place I can find these for SL?
MBP mid-2009 Mac OS X (10.6.2)
Pierre L.
Posts: 824
From: Québec
Registered: Jan 26, 2009
Re: Trim file name scripts in SL
Posted: Mar 26, 2010 6:49 PM in response to: norwichfan88
Solved
Maybe something similar in this web page?
15-inch MacBook Pro 2.53 GHz Mac OS X (10.6.2) AirPort Extreme
norwichfan88
Posts: 12
From: Australia
Registered: Mar 25, 2010
Re: Trim file name scripts in SL
Posted: Apr 10, 2010 12:03 AM in response to: Pierre L.
Thanks for the web page, had a look but not having done any work with applescript or other programming language was a bit over my head.
I decided to make a temporary solution with and automator action.
MBP mid-2009 Mac OS X (10.6.2)Thanks for the web page, had a look but not having done any work with applescript or other programming language was a bit over my head.
I decided to make a temporary solution with and automator action. -
ICal AppleScript translation to Snow Leopard
(I didn't see an AppleScript section, so if this is posted in the wrong section, I apologize.)
I use Event2ToDo (an AppleScript function) to create ToDos in iCal on a daily basis. It is a very helpful tool, and I really want to keep using it. That being said, under Snow Leopard it doesn't work anymore. Specifically, the line that gets the error is...
+tell application "iCal" to set convertMePosList to uid of (every event in thisCal *whose open file alarms is not {}* and start date is less than or equal to (current date))+
And it says...
+error "iCal got an error: Can’t make {} into type open file alarm." number -1700 from {} to open file alarm+
I think, from what I could discern, it's trying to say "whose open file alarms is not blank." Does anyone know how to fix this to work under Snow Leopard?Hi Alexander,
I believe the author of Event2ToDo is contactable via his website. <http://www.sharmanshelving.com.au/webmaster/me/>
I don't have Snow Leopard yet, but I'd try changing the line to the following:
tell application "iCal" to set convertMePosList to uid of (every event in thisCal whose open file alarms is not equal to missing value and start date is less than or equal to (current date))
Best wishes
John M -
File path applescript broken after snow leopard
I was using this script in illustrator cs4 on a mac running 10.5 and all was good
tell application "Adobe Illustrator"
activate
set theName to name of current document
set theNamecount to count of theName
set thePath to the file path of current document as string
set pathCount to count of thePath
set pathCount to (pathCount - theNamecount)
set newPath to (text 1 thru pathCount of thePath)
set newName to "Die for " & theName
set finalPath to newPath & newName
save current document in file finalPath as eps ¬
with options ¬
{class:EPS save options, compatibility:Illustrator 8, preview:color Macintosh, embed linked files:true, include document thumbnails:true, CMYK PostScript:true, PostScript:level 2, embed all fonts:true}
beep 2
activate
end tell
Then I upgraded to Snow Leopard now when i run the script I get this message
error "Can’t make «data fss 9CFF84A2B8001F4F75747369646520436F7665722046696E616C2031234238413241332E61690000000064E76 706D8298F1EE9D902207CE1FFBF28E1FFBF88578F1EE9D90220» into type string." number -1700 from «data fss 9CFF84A2B8001F4F75747369646520436F7665722046696E616C2031234238413241332E61690000000064E76 706D8298F1EE9D902207CE1FFBF28E1FFBF88578F1EE9D90220» to string
Thanks in advance.
RodG'day Rod
Your script returns...
error "Can’t make POSIX path of «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073CDCC00000001616946532 3ECF0381D9748CC1D5E0A34BFFFCE70636F72650000000A033B» into type string." number -1700 from POSIX path of «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073CDCC00000001616946532 3ECF0381D9748CC1D5E0A34BFFFCE70636F72650000000A033B» to string
I'm running an intel iMac, so perhaps it's something to do with that.
I'm now using this very cumbersome approach...
on FetchFileContainer()
tell application "Adobe Illustrator"
set fp to do javascript "activeDocument.path"
end tell
set fp to my convertString(fp, "%20", " ") as text
set newerPath to (POSIX file fp) as text
set newerPath to newerPath as text
if "Desktop" is in newerPath then
set newerPath to newerPath & ":"
repeat 3 times
set o to offset of ":" in newerPath
try
set newerPath to items (o + 1) thru end of newerPath as text
on error
if newerPath = "Desktop:" then set newerPath to ""
end try
end repeat
set ptd to path to desktop as text
set newerPath to ptd & newerPath
end if
set C to newerPath
if "desktop" is not in newerPath then
set o to offset of ":" in newerPath
set newerPath to items (o + 1) thru end of newerPath as text as alias
tell application "Finder"
try
set C to container of (newerPath)
end try
end tell
end if
return C as text
end FetchFileContainer
on convertString(tString, ToFind, Tochange)
set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ToFind}
set tString to text items of tString
set AppleScript's text item delimiters to Tochange
set tString to tString as string
set AppleScript's text item delimiters to oAStid
return tString
end convertString -
Problems with AppleScript Editor.app in Snow Leopard
I have been using the Satimage.osax scripting addition with Script Editor.app in Leopard without problem. After I upgraded to Snow Leopard, the Script Editor.app was replaced by AppleScript Editor.app in which the following one-line script
change "," into "." in "3,1416"
compiles without error but it gives an error when I try to run it: as if AppleScript Editor.app was not able to load the ScriptingAdditions (despite the fact that it correctly shows the dictionary for the Satimage.osax scripting addition).
When I decided to get back the old "Script Editor.app" and use it in Snow Leopard to run the above script, I found... no error! It ran correctly.
Anybody observed similar problems with the AppleScript Editor.app and ScriptingAdditions?
Can anybody offer a solution other than trash the new AppleScript Editor.app and stick to the old Script Editor.app?Post to the AppleScript forum under OS X Technologies and send a message to Satimage.
-
AppleScript for address book stopped working in snow leopard
I had an AppleScript stop working after upgrade to snow leopard. I select an address and it moves it to a group "envelopes" then prints the address in my current document. Later, I make a mail merge document of "envelopes and print out the envelopes for the day. Now it hangs up at the line:
Add the selection to the group "envelopes"
What is the new syntax to accomplish this? Not ready to abandon snail mailtell application "MacSpeech Dictate Medical"
set bundleID to (bundle identifier of current context)
end tell
set _currentAppName to short name of (info for (path to application id bundleID as alias))
--adds the selection to the group "envelope" to drag and drop later into a Pages mail merge to print out the day's envelopes
tell application "Address Book"
add the selection to the group "envelope"
save addressbook
--compile theaddress and print in current document of macspeech dictate medical
set theContacts to the selection
repeat with thisPerson in theContacts
set theName to name of thisPerson
set theStreetstring to street of first address of thisPerson
set theStreet to paragraph 1 of theStreetstring
try
set theStreet2 to paragraph 2 of theStreetstring
set theStreet to theStreet & return & theStreet2
end try
try
set theStreet3 to paragraph 3 of the theStreetstring
set theStreet to theStreet & return & theStreet3
end try
set theCity to city of first address of thisPerson
set theState to state of first address of thisPerson
set theZip to zip of first address of thisPerson
end repeat
end tell
set theaddress to theName & return & theStreet & return & theCity & ", " & theState & " " & theZip
tell application "System Events"
keystroke theaddress
end tell -
Need help converting old Applescript for Snow Leopard
Ok, so I've downloaded the app "PowerHour" for mac. It needs to use the date function which is different in Snow Leopard, so I've heard. I don't program in Apple Script so I can't figure out what syntax to use. Can anyone help me fix this code below?
I'm trying to code this because I don't think the original developer has any hand in this program anymore.
The app on macupdate: http://www.macupdate.com/app/mac/24107/power-hour
Here's the part that is giving the errors:
set gameLengthAsDate to (date (zeroTime)) + (enteredMinutes * minutes)
set songLengthAsDate to date (songLength)
set gameStart to current date
set songStart to gameStart
set gameEnd to gameStart + (time of gameLengthAsDate)
set songEnd to songStart + (time of songLengthAsDate)AppleScript in Snow Leopard is a bit pickier about specifying dates. From the AppleScript Release Notes, "the [date] string must exactly match one of the system date formats".
It looks like the script is using a shortcut to set the time of the current date. I didn't test a modified application (just that the script statements set a valid date), but you might give the following a try:
1) change the following properties (declared at the beginning of the script)property zeroTime : 0
property songLength : 60
2) change the statements that set the time toset gameLengthAsDate to (current date)
set time of gameLengthAsDate to zeroTime + (enteredMinutes * minutes)
set songLengthAsDate to (current date)
set time of songLengthAsDate to songLength -
Applescript works great in leopard, error -10814 in tiger
im running macs in a active directory domain. we have homefolders for users and they will not auto mount for a specific user group. i have an applescript that will take care of this, but when i run the script in tiger i get error type -10814. i can find that error anywhere. below is the script, like i said, works great in leopard but errors in tiger. both systems are bound to the domain with the same settings. i can manually mount the home folder on either version but want to automate this for users who have no clue what to do.
tell application "Finder"
activate
end tell
property targetURL : "smb://student-dfs-01/homefolders"
open location targetURLI don't know specifically, but I'd look at using the mount volume command rather than 'open location' for a SMB URL:
mount volume "smb://student-dfs-01/homefolders" -
AppleScript Studio projects under Snow Leopard
I know Apple has depreciated AppleScript Studio, but the documents say old projects can still be used, so I assume there's a way to edit my old AS projects. I have the iPhone SDK with Xcode 3.2 and Interface Builder, but it doesn't recognize my AS project files (e.g., MyProject.pbproj). How do I get Xcode to open my old AppleScript Studio project files?
The old .pbproj projects will probably need to be converted or opened in an older version of Xcode, which can be downloaded from Apple's Developer Member Site. The newer .xcodeproj AppleScript Studio projects can still be used in Snow Leopard (it is just not recommended), so if you have an existing project you can enable the AppleScript tab in Interface Builder - see the AppleScriptObjC Release Notes.
-
Why is Applescript so SLOW on Leopard?
This thing ran pretty quick on Tiger. Still does. It's a DOG on Leopard. I can hear each individual file getting moved to the correct folder. About 2 per second. Crazy. Any assistance would be appreciated!
Here's my script:
set projectname to ""
set numberofshots to 4
set numberofbrackets to 1
tell application "Finder"
activate
set k to choose folder with prompt "Pick the 4-shot 180° storage folder"
set arry to name of files of k
end tell
set i to 1
set foldername to 1
set j to (count of arry) / numberofshots
set foldernames to j / numberofbrackets
set l to "split"
tell application "Finder"
activate
make new folder at folder k with properties {name:"" & l}
repeat while i < foldernames + 1
set foldername to 1
repeat while foldername < numberofbrackets + 1
if numberofbrackets = 1 then set newname to i
if numberofbrackets > 1 then set newname to "" & i & "_" & foldername
if projectname ≠ "" then set newname to projectname & "_" & newname as string
make new folder at folder l of folder k with properties {name:newname}
set foldername to foldername + 1
end repeat
set i to i + 1
end repeat
end tell
set i to 1
set j to 1
set countj to 1
tell application "Finder"
activate
repeat while i < (count of arry) + 1
if countj > numberofshots then set j to j + 1
if countj > numberofshots then set countj to 1
set makemeloop to 0
-- begin bracket loop
repeat while numberofbrackets > makemeloop
if numberofbrackets = 1 then set newname to j
if numberofbrackets > 1 then set newname to (j & "_" & (makemeloop + 1) as string)
if projectname ≠ "" then set newname to projectname & "_" & newname as string
move file (item (i + makemeloop) of arry) of folder k to folder newname of folder l of folder k
set makemeloop to makemeloop + 1
end repeat
set countj to countj + 1
set i to i + numberofbrackets
end repeat
end tell
set projectname to ""
set numberofshots to 6
set numberofbrackets to 1
tell application "Finder"
activate
set k to choose folder with prompt "Pick the 6-shot 360° storage folder"
set arry to name of files of k
end tell
set i to 1
set foldername to 1
set j to (count of arry) / numberofshots
set foldernames to j / numberofbrackets
set l to "split" -- sub-folder to be created
tell application "Finder"
activate
make new folder at folder k with properties {name:"" & l}
repeat while i < foldernames + 1
set foldername to 1
repeat while foldername < numberofbrackets + 1
if numberofbrackets = 1 then set newname to i
if numberofbrackets > 1 then set newname to "" & i & "_" & foldername
if projectname ≠ "" then set newname to projectname & "_" & newname as string
make new folder at folder l of folder k with properties {name:newname}
set foldername to foldername + 1
end repeat
set i to i + 1
end repeat
end tell
set i to 1
set j to 1
set countj to 1
tell application "Finder"
activate
repeat while i < (count of arry) + 1
if countj > numberofshots then set j to j + 1
if countj > numberofshots then set countj to 1
set makemeloop to 0
repeat while numberofbrackets > makemeloop
if numberofbrackets = 1 then set newname to j
if numberofbrackets > 1 then set newname to (j & "_" & (makemeloop + 1) as string)
if projectname ≠ "" then set newname to projectname & "_" & newname as string
move file (item (i + makemeloop) of arry) of folder k to folder newname of folder l of folder k
set makemeloop to makemeloop + 1
end repeat
set countj to countj + 1
set i to i + numberofbrackets
end repeat
end tellTry the AppleScript forum under OS X Technologies.
-
Applescript Crashing in Snow Leopard
Just updated to Snow Leopard on my black MacBook - everything going surprisingly well considering the age of the machine. However, I'm having a problem with all of my Applescript apps and scripts crashing. Sometimes if I just select the "Reopen" option in the dialog box for the crash the app or script will run fine, sometimes I can run through that loop 10 times with a crash every time. I've tried recompiling all the apps - no luck. I'm an Applescript "dummy" so not sure what might be causing this or what to do to fix it.
Even the simplest scripts are crashing. For example, I have one installed in my login items in Accounts that sets the sound volume of the computer when I boot up (my wife works odd hours and I don't want to take a chance on unexpectedly chiming her awake, so there's also a shutdown script that sets the volume to 0 and shows a dialog box with buttons for "Restart," "Shutdown," and "Cancel." The first example is a simple one-liner: set volume 5. I don't have the computer with me right now, but the error message runs something along the line of the generic "Your application has quit unexpectedly" and offers buttons for "Ignore," "Reopen," and "Report."
Again, when one of these is invoked it almost always crashes on the first attempt since my OS upgrade. If I choose "Reopen" it may or may not run successfully, sometimes as often as 10 times (after which I usually say 'screw it - I've got better things to do!!'). -
When I try to run a simple javascript on the Mac using AppleScript I receive the following error:
Adobe Acrobat Professional got an error: "app.openDoc(\"/temp/Form_A.pdf\");" doesnt understand the do script message.
My AppleScript:
tell application "Adobe Acrobat Professional"
set javascript to "app.openDoc(\"/temp/Form_A.pdf\");"
try
do script javascript
on error e
beep
return e
end try
end tell
If I run the same JavaScript in a button in Acrobat it works fine:
app.openDoc("/temp/Form_A.pdf");
Has Adobe added some new security features in Acrobat 8.1.2?
Cheers, AdrianYes - certain parts were changed with Acrobat 8 .. try the scripting
forum ...
Jon -
AppleScript Scripts in Leopard ask to run
My Applescript dot apps from Tiger ask if I want to run them. Scripts selected from the AppleScript menu work without asking. How do I fix this?
Open them in Script Editor and re-save without "Startup Screen" being checked.
Maybe you are looking for
-
Some songs that are synced onto my iPhone are missing album names. It's completely blank. I went back and double checked on my computer, and found that the album is all there in iTunes. Furthermore, the album artwork shows up on my iPhone. So somethi
-
F4 Help in BSP for a input field in the Selection Screen...Urgent
Hi , Can anyone possible tell me how to put F4 help in a BSP Regards...
-
Every time I send a photo it sends with "For Review Only" on the photo. How can I remove this so my recipient gets a good quality photo?
-
Does anyone know were I can get iso 4.3 for a second generation ?
Does anyone know were to get iso 4.3 for a second generation iPod ?
-
Trouble with Software Update on my iMac
Hello Mac Community - I am trying to run software update on my iMac. Everything seems to be fine, the software update runs, it finds 11 updates. Then, when I hit "install items" a little box pops up asking me to restart the computer. I do so, but whe