applescript

How to translate this slider value change from AppleScript to JavaScript

给你一囗甜甜゛ 提交于 2020-01-17 06:20:09
问题 This bit of AppleScript works. If I have the System Preferences Sound panel open, and run it in the Script Editor app, it changes the volume to be at 50%. tell application "System Events" tell process "System Preferences" set v to value of slider 0 of window 0 log v set value of slider 0 of window 0 to 0.5 end tell end tell This, which tries to be the same thing, fails. Anyone know how to fix it? var se = Application("System Events"); var spp = se.processes["System Preferences"]; spp.windows

How to use Terminal command using ExtendScript toolkit

落花浮王杯 提交于 2020-01-17 04:55:07
问题 I need to use the terminal commands using Javascript on ExtendScript toolkit. For example, using pdffonts command on terminal window. pdffonts ~/Desktop/fontlist.pdf 回答1: If you use After Effects you can simply use: system.callSystem('Your command'); Or write your command into bat file, and then to use: new File('path/to/bat/file.bat').execute();//for windows new File('path/to/bat/file.sh').execute();//for mac 来源: https://stackoverflow.com/questions/33732071/how-to-use-terminal-command-using

How to show composite icons using Display Dialog

淺唱寂寞╮ 提交于 2020-01-16 16:49:13
问题 Is there any way to display Display Dialog icons like macOS does, I tried looking for the icon below in /System/Library/CoreServices/CoreTypes.bundle but I didn't find it. set myIcon to (path to resource "myIcon.icns") display dialog "this is my icon" buttons {"OK"} default button "OK" with icon myIcon 回答1: All of the standard Apple icons are stored here: `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources` You can access them directly, as in the following. set iconFIle to

How to check if I'm at the right URL in AppleScript (Chrome)

橙三吉。 提交于 2020-01-16 04:46:06
问题 I'm new to AppleScript and having trouble with this: I'm creating a script for Chrome where I want to login to a site and check something for me. For now, I just need to check if I'm actually routed to the correct URL (sometimes I'm already logged in) or if I need to login (if the system has logged me out automatically). If I'm logged out, I just want to click the "Login" button (my credentials autofill). If I'm logged in already, then I'll just proceed with the rest of the script. This is

Can Applescript be used to tell whether or not a directory (path) exists?

大城市里の小女人 提交于 2020-01-15 13:04:54
问题 I've got some Applescript code that switches to a specified directory by KEYSTROKEing the path into the "Go To" dialog. Regretfully, this dialog does NOT raise an error if the requested directory does not exist?! It just goes as far as it can along the path and then DUMPS THE NONEXISTENT PATH FRAGMENT into the default text field of whatever window is under it ! Example: given "~/Music/nonexistent" it would switch to the Music folder in the user's home folder then 'type' "nonexistent" into the

How to increase window height longer than the screen height in applescript?

你离开我真会死。 提交于 2020-01-15 10:11:39
问题 I have such an AppleScript: tell application "Firefox" activate set the bounds of the first window to {0, 0, 6000, 6000} end tell But this code doesn't let me to re-size the height of the window higher than the screen bounds. How can I make this happen? p.s. The window width is set to 6000px successfully, but no luck with window height. Thanks 回答1: As far as I know, the OS doesn't let you resize the height of ANY window higher than screen bounds, which is probably why you're hitting this

How to increase window height longer than the screen height in applescript?

一世执手 提交于 2020-01-15 10:10:42
问题 I have such an AppleScript: tell application "Firefox" activate set the bounds of the first window to {0, 0, 6000, 6000} end tell But this code doesn't let me to re-size the height of the window higher than the screen bounds. How can I make this happen? p.s. The window width is set to 6000px successfully, but no luck with window height. Thanks 回答1: As far as I know, the OS doesn't let you resize the height of ANY window higher than screen bounds, which is probably why you're hitting this

Find and replace in Excel 2011 using Applescript

南笙酒味 提交于 2020-01-15 09:02:31
问题 I was wondering if anyone could help me. I'm trying to find and replace blank spaces in an excel workbook. I want it to search the current sheet I'm on in a workbook, find all instances of "" and replace it with " ". Does anyone happen to know how to do this? 回答1: With Applescript: searchAndReplaceTextInCells("hello", "world") on searchAndReplaceTextInCells(search_str, replace_str) tell application "Microsoft Excel" set search_range to range "A:Z" set all_found_ranges to {} -- store for the

How to invoke a method daily at a specific time in iPhone application?

喜你入骨 提交于 2020-01-13 13:13:55
问题 I want to invoke a method daily at a specific time in my iPhone application. How can I achieve this? 回答1: There's not a whole lot you can do with the iPhone SDK and a closed app. You can have it send local push notifications at specific times, but that won't execute your code until the user manually opens your app. See this related question recently asked: Is it possible to have my closed app run code in iOS? One thing I've seen apps do (like alarm clock apps, etc) is have you leave your app

Xcode 4 : Can I get a path to the currently active file via AppleScript?

為{幸葍}努か 提交于 2020-01-13 09:15:32
问题 I am trying to write a custom xcode4 behavior to check out the current active file with Perforce. I know I can write a custom behavior to run when hit a key (e.g., F1 ) I'd like that custom behavior to launch an AppleScript (or any kind of script for that matter) that discerns the currently "active" source document in Xcode, get its path, and attempt to check it out via Perforce. As far as I can tell AppleScript is the best way to get to the target document as it can navigate the Xcode DOM