applescript

Display Magic Mouse Battery in Touch bar using BetterTouchTool

柔情痞子 提交于 2019-12-13 03:01:41
问题 I'm using this BetterTouchToll for make my touch bar more interesting, what is very cool. He accept some Apple Scripts for more dynamic, so I start to study this scripts. Now I wanna to display my Magic Mouse Battery on my touch bar, for this I was trying this code, but is not working. if application "Mouse" is running then tell application "Mouse" return (get Battery) end tell end if return "no mouse" My guess is that Mouse is not a application, but don't know what to put in the place 回答1:

How to scroll down on applescript?

元气小坏坏 提交于 2019-12-13 02:37:08
问题 Im trying to make a follow/unfollow bot for Depop. Here is what i got so far. tell application "Safari" activate end tell set Username to display dialog "What is your Depop username?" default answer "" set Username to text returned of the result tell application "Safari" activate open location "https://www.depop.com/" & Username delay 5 end tell tell application "System Events" tell process "Safari" click at {350, 305} -- {from left, from top} click at {350, 305} -- {from left, from top}

How can Applescript objects be referenced before they are defined?

泪湿孤枕 提交于 2019-12-13 02:33:27
问题 Does anyone know why this applescript works? I do not understand why. The script generates three dialog boxes containing the same message: "Hi There". I have two questions: 1) How can j and k be set to reference i before i is defined? 2) Why does not r reference the i defined in test2? on test1() return get a reference to i end test on run set j to test1() set k to a reference to i set i to "Hi there" display dialog j display dialog k test2() end run on test2() set i to "now see here" set r

How do you properly use “write” in Applescript?

我的未来我决定 提交于 2019-12-13 02:06:42
问题 I'm having trouble figuring out how to properly use "write" in applescript. I currently have code like this: set randomArray to {"hello", "text", "file"} set saveFile to (path to desktop as text) & "RandomFile.txt" write randomArray to saveFile starting at eof as list I know that this is not right, but I can't seem to figure out what the correct thing to put where "saveFile" is would be. Any help is appreciated, thanks :) 回答1: A good example to write to a file can be found in the code-snippet

Mail Rules with javascript instead of applescript

谁都会走 提交于 2019-12-13 01:45:05
问题 In a Mac mail rule, I am trying to run a javascript instead of an applescript. This has been asked in Mail Rules using JavaScript for Automation instead of AppleScript but the answer is not working for me! I have tried to simplify the code as much as I can. So, the following applescript works fine: on perform mail action with messages theMessages say "running!" end perform mail action with messages but the equivalent javascript is not working. function performMailActionWithMessages(messages)

How to get filename without extension from Omnigraffle?

自作多情 提交于 2019-12-13 01:26:11
问题 I'm trying to get the filename without the extension of the current document file in Omnigraffle Professional 5. tell application "OmniGraffle Professional 5" set _document to front document set _path to path of _document -- Get filename without extension tell application "Finder" set {_filename, _extension, _ishidden} to the {displayed_name, name_extension, extension_hidden} of the _path end tell end tell This gives me the following error: error "Can’t get displayed_name of \"/Users/ca

play a stream in iTunes without adding it to the library / playlist

一个人想着一个人 提交于 2019-12-13 01:00:38
问题 I am controlling iTunes via AppleScript and I am playing streams from an HTTP server. The code I'm using looks like this: tell application "iTunes" open location "your_url_here" play end tell It works fine, but I would like to avoid those URLs to show up in the iTunes library or any playlist afterwards. Is there a trick to achieve that? 回答1: Have you considered using QuickTimePlayer to play the stream instead? tell application "QuickTime Player" open URL "http://www.a-1radio.com/listen.pls"

AppleScript to save pdf as pdf-x in Acrobat

吃可爱长大的小学妹 提交于 2019-12-13 00:09:25
问题 I am currently using Adobe Acrobat Pro DC 2015.23 on macOS Sierra. My goal is to create AppleScript that do such things: Open PDF File Save this file to pdf-x format Close file I create AppleScript, that do all steps, but i can't find any documentation how to choose with PDF standard to use while saving. If I want to do this manually I do following steps: Open PDF in Adobe Acrobat Choose PDF Standards Menu Click (Save as PDF/X) Press save The question is how to set PDF/X standard while saving

Problem passing parameter to applescript via terminal/bashscript

杀马特。学长 韩版系。学妹 提交于 2019-12-12 23:24:31
问题 I'm trying to control multiple VLC instances via bashscript and applescript - i access them via their pid. I got this working in a small manual test, which works fine: tell application "System Events" set VLC_VGA to application processes whose unix id is 598 repeat with proc in VLC_VGA set the frontmost of proc to true keystroke "p" using {command down} end repeat end tell I now want to dynamically insert the pid (598 or whatever it may be). This is what I have so far - but won't work:

Applescript - Replace character “Cant get every item of alias”

人盡茶涼 提交于 2019-12-12 23:23:53
问题 Below is my code to rename file. The code basically check for special character and replace with "_" (underscore). Code set thefile to choose file set Filename to my replace_chars(thefile, " ", " ") set Filename to my replace_chars(thefile, " ", " ") set Filename to my replace_chars(thefile, " ", "_") set Filename to my replace_chars(thefile, ",", "_") set Filename to my replace_chars(thefile, "!", "_") set Filename to my replace_chars(thefile, "~", "_") set Filename to my replace_chars