osascript

Macbook OpenEmu Python send keystrokes

懵懂的女人 提交于 2021-02-10 07:53:58
问题 I am really impressed by this MarlIO project and want to implement something similar using Python. However, I got the emulator OpenEmu working, however, I don't know how to control the game using Python. Isn't it just a matter of sending a few keystrokes?! Man, it is not that straightforward on a Mac. In [41]: cmd1 Out[41]: '\nosascript -e \'tell application "System Events" to key code 48 using {command down}\' \n' In [42]: cmd2 Out[42]: '\nosascript -e \'tell application "System Events" to

App build failed in xcode with Continuing in background (Failed to display Xcode notification) due to the sentry

半世苍凉 提交于 2020-03-25 19:19:49
问题 Unable to build my app suddenly. This is the error which I got after running the caused by: script error: osascript: no such component "JavaScript". Continuing in background. Error: Failed to display Xcode notification caused by: script error: osascript: no such component "JavaScript". /Users//Library/Developer/Xcode/DerivedData/App-dvcafjcjvuogulagizfflouagntd/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script

App build failed in xcode with Continuing in background (Failed to display Xcode notification) due to the sentry

风格不统一 提交于 2020-03-25 19:19:10
问题 Unable to build my app suddenly. This is the error which I got after running the caused by: script error: osascript: no such component "JavaScript". Continuing in background. Error: Failed to display Xcode notification caused by: script error: osascript: no such component "JavaScript". /Users//Library/Developer/Xcode/DerivedData/App-dvcafjcjvuogulagizfflouagntd/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script

Applescript (osascript): opening split panes in iTerm 2 and performing commands

雨燕双飞 提交于 2020-01-11 01:28:12
问题 The following works to open two tabs in iTerm 2. I can't seem to figure out how to get this to using split panes instead. I've tried applying what I see on several forums, but it never works. Could someone point me in the right direction? osascript <<-eof tell application "iterm" set myterm to (make new terminal) tell myterm launch session "Default session" tell the last session set name to "Server" write text "cd $projectsFolder" end tell launch session "Default session" tell the last

What does ${1-1} in bash mean?

无人久伴 提交于 2020-01-06 01:37:26
问题 I'm reading the scripts from here and trying to understand what's going on. This function performs changing the directory of a Finder window: function ee { osascript -e 'set cwd to do shell script "pwd"'\ -e 'tell application "Finder"'\ -e "if (${1-1} <= (count Finder windows)) then"\ -e "set the target of window ${1-1} to (POSIX file cwd) as string"\ -e 'else' -e "open (POSIX file cwd) as string"\ -e 'end if' -e 'end tell';\ };\ I'm assuming the $ is interpreted by bash, since it's inside

Pass variable into AppleScript from python

我与影子孤独终老i 提交于 2019-12-25 08:47:48
问题 Can someone show me how to pass a variable into an Applescript using osascript in python? I've seen some documentation/samples on doing this but I'm not understanding it at all. Here is my python code: # I want to pass this value into my apple script below myPythonVariable = 10 cmd = """ osascript -e ' tell application "System Events" set activeApp to name of first application process whose frontmost is true if "MyApp" is in activeApp then set stepCount to myPythonVariableIPassIn repeat with

Make osascript print stdout interactively / in real-time

荒凉一梦 提交于 2019-12-24 14:13:45
问题 Ok, so I have this very simple python script: import time import sys for i in range(25): time.sleep(1) print(i) sys.exit() When I use python to run it ( /usr/local/bin/python3.6 testscript.py ), all works fine and the output reads: 1 2 3 4 etc.. With each number printed 1 second after the other. However when I run: /usr/bin/osascript -e 'do shell script "/usr/local/bin/python3.6 testscript.py" with prompt "Sart Testing " with administrator privileges' There isn't any output for 25 seconds and

AppleScript that reads active application name, title and URL

青春壹個敷衍的年華 提交于 2019-12-22 14:04:33
问题 I need AppleScript that, when lunched from command line, will return three things: current active application name; ex. "Google Chrome", "Safari", "Steam", "iTunes", "Atom" ect. current active application title, if there is one if current active application is a browser, I want the current active tab URL examples: Google Chrome; AppleScript: How to get URL of Safari tab which failed to load? - Stack Overflow; https://stackoverflow.com/ iTunes; iTunes iTerm2; 1. node test.js (sleep) Safari,

javascript for automation [open location in finder]

血红的双手。 提交于 2019-12-22 09:26:07
问题 I am trying to figure out how JXA(JavaScript for Automation) works, so try to translate a simple applescript as below to JXA. tell application "Finder" open location "smb://XXXXXXXX" end tell what I tried is here: finder = Application("Finder") finder.open({location:"smb://xxxxxx"}) but I fail..., and I am new to applescript, not really understand the description in library. and here is how the library describe the open open (v) : Open the specified object(s) open specifier : list of objects

How to display modal window using osascript or AppleScript in OS X

你离开我真会死。 提交于 2019-12-21 21:53:53
问题 How to display modal(over all apps, windows) window using osascript or AppleScript in OS X 10.6.8 and later. Here a script I do: #!/bin/bash osascript -e 'tell app "System Events" to display dialog "My Dialog" buttons {"OK"} default button 1 with title "My Dialog" with icon caution' The problem is that it's not modal. How to fix the following issue? 回答1: I wrote a script recently to monitor my macbook battery when it got low. To make sure I didn't miss the alert I did the following... repeat