applescript

Applescript to open an application in full-screen mode?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 14:53:59
I'm trying to program Alfred to open my Terminal, Sublime Text, and Chrome with a workflow. I would like for my terminal to open normally as a window, but I've been trying to get Chrome and Sublime to open full screen. I was able to get Chrome to open up in full screen mode with: on alfred_script(q) tell application "Google Chrome" tell window 1 to enter presentation mode end tell end alfred_script However, this did not translate to work with my Sublime Text. What am I missing here? iammcgaber As found here ( i need an applescript to open safari in full screen an to hide the toolbar on

Native caret position macos cocoa

瘦欲@ 提交于 2019-12-05 14:43:01
I want to be able to get the global caret position inside any application in Mac High Sierra using cocoa or appleScript. I already use NSEvent to get the keyboard and mouse hook but is there a way to get the caret position hook? The caret is different from the mouse position. It moves on key event or mouse click. In windows, you can get the caret position almost anywhere. I want to know if there is the equivalent for macos. I want to show a popup over the text caret, if i type on the keyboard or line return, it moves with the text.I tried getting the position of the key event,

How to run a python script inside Applescript?

こ雲淡風輕ζ 提交于 2019-12-05 13:33:57
I had to do an Applescript and by the end of it i just want to run a python script. I wrote do shell script "/Users/Tom/Desktop/ayscript.py" But it's said "permission denied" Any idea ? You are trying to run the script directly instead of using Python to run it. You need to do shell script python , passing the path to your script as an argument. do shell script "python /Users/Tom/Desktop/ayscript.py" 来源: https://stackoverflow.com/questions/23108335/how-to-run-a-python-script-inside-applescript

Xcode debugging AppleScript

本秂侑毒 提交于 2019-12-05 12:02:31
Xcode has apparently AppleScript debugging facilities : You can put breakpoints Executable options mentions AppleScript Debugger But I could not figure how to Run & Debug script... Tried setting up a custom executable calling osascript with script as argument, breakpoints are not hit. Any ideas? I'm in a similar position. I'm new to XCode and have successfully followed the "Hello World" tutorial which includes guidance for debugging. I then created a Project based on Cocoa-Applescript Application and selected the MyScriptAppDelegate.applescript file that results from this action. This script

Implementing keyboard volume control buttons in Applescript - setting volume inside loop doesn't work

一笑奈何 提交于 2019-12-05 11:10:39
Background I have a MacAlly IceKey keyboard. This keyboard has volume buttons that require a driver to function. This driver has not been updated since 2006, and I suspect it as the source of a recent spat of recurring kernel panics I've been experiencing under Mac OS X 10.6.1. So, out it goes; but I want my volume keys back! Using the wonderful ControllerMate , I can program these keys to do anything, including run an applescript script. So, I'm trying to implement that functionality. The set volume command (part of Standard Additions) allows you to set the volume to any value between 0 and

AppleScript or Automator to click on menus in an application?

孤者浪人 提交于 2019-12-05 11:07:20
I'm not sure if this is do-able via AppleScript and/or Automator…but I'd like to be able to: a) launch an application (I know this can be done pretty easily by AppleScript or Automator) b) once the application is launched, use AppleScript or Automator to select specific menu items. e.g. I'd like to launch Excel 2008 (I have the home/student edition which doesn't come preconfigured for Automator) and then click the "File" menu and click on "open". Any pointers on where to go/look for how to select menu items like this (or if it's even possible at all)? You can "sort of" do this using Automator

How to open an email message using applescript?

我与影子孤独终老i 提交于 2019-12-05 10:18:31
I am writing a small applescript which retrieves all "unread" messages in the viewer and loops them. I have two goals to complete: I need to get the subject of each message and perform a regular expression to see if it's suitable for step 2 (ex: get emails with subject {.*}) I need to open each message on a separate window and after 4 seconds, I need to close that window and proceed with the next message Do you know how to do these? Thanks in advance. The following applescript works for me, but I'm not sure how to do the regex matching. You can use the unix 'grep' function with applescript's '

Check for active internet connection with Applescript/Automator

萝らか妹 提交于 2019-12-05 09:38:14
I have an Automator workflow to ping a server, and download the latest copy of a schedule that I frequently use. This schedule then is copied to my dropbox so I can view it on my phone. Before the workflow downloads the newest schedule it deletes the old schedule from dropbox. This works well, except when I don't have an active internet connection. When I don't have an active internet connection, the workflow will still open up dropbox, delete the old schedule, and try to download the newest one. Because there is no connection, it doesn't download anything. Then if my connection becomes active

How do I set Mac OS X 10.6 Terminal tab title programmatically?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 08:53:57
I'm trying to learn Applescript as I'd like to, eventually, programmatically set the title of the tab in Terminal to whatever context I'm currently working in. Should be a simple task and I've gotten it almost right I think. This is my experimental code so far... tell application "Terminal" activate set frontIndex to index of the first window whose frontmost is true tell window frontIndex set title displays custom title of selected tab to true set custom title of selected tab to "Bazzy" end tell end tell The problem is that when I set the tab's title, the title of all other tabs also get set.

How can I create or replace a file using Applescript?

ぐ巨炮叔叔 提交于 2019-12-05 07:47:19
问题 I'm trying to write content to a file, /tmp/test.txt with AppleScript. If the file doesn't exist, I want to create it. If it does exist, I want to replace the contents. This is proving quite difficult because AppleScript has a different syntax for creating a new file versus writing to an existing file. I also thought about deleting a file if it already exists, and then creating it, but AppleScript will move things to the trash by default and so even that is rather complicated. The data I am