applescript

Typing with Applescript

蹲街弑〆低调 提交于 2019-12-25 03:59:14
问题 Is it possible to have my mac type for you with applescript? What I want is this: when compiled, this applescript will type a phrase, then press enter. Is there any code simulating the pressing of keys? 回答1: The keystroke command will work for you. tell application "System Events" to keystroke "A phrase" & return & "Another phrase" If you want a specific application to do the typing, just do something along these lines: tell application "System Events" to tell process "TextEdit" to keystroke

py-appscript is starting a new Finder instance

。_饼干妹妹 提交于 2019-12-25 03:43:23
问题 i have a py2app application, which runs an appscript using py-appscript. the Applescript code is this one line: app('Finder').update(<file alias of a certain file>) What this normally does is update a file's preview in Finder. It works most of the time, except for Leopard. In Leopard, everytime that script is executed, instead of updating the file, it starts a new instance of Finder. What am I doing wrong? The app was built on the same machine (the Leopard). 回答1: Seeing as how py-appscript is

Trigger Handler twice in Applescript results in error

末鹿安然 提交于 2019-12-25 02:10:44
问题 so i written this code so far, it works very well, the only issue is, calling the code twice results with an error «script» doesn’t understand the Remi message. (-1708) Whats to point here and how can i unset the handler after it was triggered? The Code: my Remi() on Remi() set cD to (current date) tell application "Reminders" --set output to name of reminders if (count of (reminders whose completed is false)) > 0 then set output to "" set todoList to name of reminders whose completed is

How to Auto Login to a web-site?

て烟熏妆下的殇ゞ 提交于 2019-12-25 01:09:20
问题 Hello, I need to login to a web-site automatically. It is a dashboard. Is there a URL link code which I can create as shortcut link or VBScript code to achieve this? Also is there a AppleScript for MAC? 回答1: Here's an example of a javascript bookmarklet that creates a form hidden in a div at the bottom of the current page and then submits it. (I included a time stamp cause many dashboard logins include a hidden timestamp field in the form.) javascript:self.moveTo(0,0);self.resizeTo(screen

Passing Multiple Parameters from Applescript to Terminal Command Script

夙愿已清 提交于 2019-12-24 23:27:46
问题 I have been trying to figure out how to pass multiple parameters from an Applescript to a Terminal Command Script. For example when running a terminal command file you are able to receive parameters programatically like so: #!/bin/bash var=$1 var=$2 The Applescript Code that I have been working with is below for reference: tell application "System Events" to set app_directory to POSIX path of (container of (path to me)) set thisFile to "Dev" set testTarget to "/Users/lab/Desktop/TestTarget/"

Applescript for batch-converting text delimited .txt to .xls

柔情痞子 提交于 2019-12-24 23:09:19
问题 Each day, I'm delivered ~5 .txt data files delimited with "^". Manual steps taken to convert each to spreadsheet: • Open .txt file in Excel • Text-To-Columns • Run through the delimiting wizard Would love to have an applescript or applet to drop the 5 files into. A Google Sheets script would be even more magical. Thanks in advance for any guidance. Sample data: developer^project^lender^uuid^id^remarks^code^transfer_date 1500^1502^009^f1e97d20-b311-41cf-a40f-59db90b25ba8^73890^a10a46e8-bca8

Cocoa Scripting Bridge and <contents> element

烈酒焚心 提交于 2019-12-24 21:33:16
问题 So, the application I'm trying to script has a scripting definition file that includes a <contents> element, which is an "implicitly specified container." The question, how do I get at what's inside this element using Scripting Bridge? Or alternatively, how do I send the Apple Event necessary to retrieve it and then transform what I get back into an SBObject? I already tried: [document nameOfKey] document.nameofKey [document contents] document.contents 回答1: Not sure if this will help but I

Using Automator or Applescript or both to recursively print documents to PDF

♀尐吖头ヾ 提交于 2019-12-24 17:12:33
问题 I have a massive set of files (4000+) that are in an old Apple format (Appleworks). My employed needs them all updated to PDF. By opening the documents in Appleworks and using the system print dialogue, I can save them to PDF—this is ideal. I'm a complete nub with Applescript/Automator, however. Using a Python script I was able to gather all the Appleworks files from my bosses computer and put them in a directory; each file is then in a subdirectory with a .txt file containing its original

plain text URL to HTML code (Automator/AppleScript)

橙三吉。 提交于 2019-12-24 15:30:35
问题 Suppose I have a plain txt file in a text editor such as TextEdit: title 1 http://a.b/c title 2 http://d.e/f ... I'd like to convert all the lines beginning with http:// to HTML code for URL, so that the aforementioned content will become: title 1 <a href="http://a.b/c">http://a.b/c</a> title 2 <a href="http://d.e/f">http://d.e/f</a> ... How can I get this done in Automator or AppleScript? (My current solution is using Gmail, but it involves multi-step copy-paste.) Thank you very much in

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