After running some of my script, I happen to have a bunch of Safari window that has the "Untitled" windows.
I came up with the following code to close all the windows that have "Unitlted" as name, but it doesn't close everything with an error message -> "Safari got an error: Can’t get item 9 of every window. Invalid index." I had to run...
How do I make a new document in TextMate using rb-appscript or AppleScript?
Here is my rb-appscript:
te = app("TextMate")
te.launch
doc = te.make(:new => :document)
But it doesn't work.
Here is the error message I get:
OSERROR: -10000
MESSAGE: Apple event handler failed.
COMMAND: app("/Applications/TextMate.app").make({...
I have opened the AppleScript Editor and pressed Record button.
Then I run TextEdit, create a file and put some text there.
When I click the Stop button in AppleScript Editor, nothing was recorded, the window is blank.
What is the problem?
...
My goal is to make it so that links clicked on one osx machine are loaded into safari on a remote computer with apple events enabled. To do this, I am trying to create an applescript application which i then make the default browser on the system.
My applescript looks like this:
on run argv
set theurl to item 1 of argv
set dest...
I am confused by AppleScript references... I almost never develop in AppleScript, and am having a very difficult time finding good documentation on how AppleScript handles references. The following code fails because AppleScript Can’t make firstValue of hash into type reference.:
on run
foo()
end run
on foo()
set the hash to {f...
I need t parse xml for an applescript project and i got a start but for some reason my code is not operating the way I expected it to it does find the item I'm looking for but does not return a value
here is the code
set xmlFile to ((choose file without invisibles) as string)
tell application "System Events"
set xdata to XML elem...
I am writing a mac application that uses the scripting bridge to control iTunes. I have generated the header file iTunes.h, and the SBApplication object can tell me all kinds of wonderful things.
However, the commands seem very limited. There is a 'playpause' function, but I see no way to do this
// iTunes is my SBApplication Object
[i...
I was wondering if there is a way in AppleScript to create a small Applet of sorts, without having to use a bunch of dialogs, and I think it would be nicer in the end.
Here is the script I have currently, courtesy of AppleScript Wikia
set x1 to text returned of (display dialog "What is X1?" default answer "")
set y1 to text returned of...
Hi all, this is my first post, wish your help.
In Mac OS (10.5 or 10.6), I want to find the element at the specified coordinate in screen.
If you have ever used UIElementInspector, you will konw exactly what I mean. Move mouse cursor around with UIElementInspector running, you will get a detail description, which is what I want, about...
Really basic, but how to write a character with Applescript. My 'd' key is broken, i'd like to assign a script to a f1-12 key just to write that character in any application. Thank's!
...
I have a protocol handler associated with my Cocoa application.
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
...
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDesc...
Is it possible to use an Apple Script or a Unix executable to associate a file type with an app?
My problem is I'm using File Vault and it forgets previous associations (it's a well known bug so it seems). For instance, I like to use Flying Meat's Acorn for my graphics files rather than Preview. I can Cmd-I, change all, and while it sti...
I would like to pass the name of an application to an applescript and then perform some actions on it in the script. I've tried the following:
set app_name to item 1 of argv
tell application app_name to ...
This doesn't work. I've tried
set app_name to quoted form of item 1 of argv
which seems to append single quotes, (doesn't work...
I cant seem to get this to work at all. Would be great if anyone could help or shine some light on it?
Thanks
on adding folder items to thisFolder after receiving thisItem
try
-- This gives you the name of the route folder, and the name of the added folder
set folderName to name of (info for thisFolder)
set itemName to name of...
I need to make an script that picks a random sentence from a txt-file and says each word in a random voice, using an array of voices, speaking rate modulation and pitch.
For example:
A sentence is chosen randomly from the txt file: "make a bed:listen carefully:read a book"
and {"make", "a", "bed"} is spoken word-for-word by a random voi...
My script looks like this, really simple
tell application "Terminal"
do script "cd myapp"
do script "heroku console" in window 1
do script "User.count" in window 1
end tell
But I get an "Error in the AppleEvent Routine". What is wrong with this script? If I type the commands in the Terminal it works.
...
my code looks like this
tell application "Firefox"
open location "http://rubyquicktips.tumblr.com/"
end tell
but if I have Firefox open, the link will open in a new tab. But I want the link to open in a new Firefox window.
How can I accomplish that?
...
I am trying to get an Apple Script to click on an item within webpage. This script below works somewhat, I can get it to click different safari tabs or drop down menus, but I cannot get it to click an item within webpage.
In this example, I am trying to get the script to click the "Im feeling Lucky" button from google.. it all works ex...
Hi all, I have opened 2 "Finder" window A & B, A is in the front while B underneath, the following snippet brings B to the front the topmost:
tell application "Finder"
activate
activate window 2
end tell
But for applications that do not support scripting, the code just mentioned won't help.
Any ideas for activating a window o...
I am looking for a GUI scripting workaround since I know this seems impossible in Firefox at the moment. I know this can be achieved using the following method:
tell application "System Events"
Keystroke "l" using command down
Keystroke "c" using command down
end tell
tell me to activate
set theUrl to the clipboard as te...