automator

Run Golang script from shell script

血红的双手。 提交于 2019-12-11 07:29:44
问题 I'm trying to run my golang program whenever I log into OSX. I'm trying the following script with Automator: #!/bin/sh export GOPATH=/Volumes/DTSE9/worker go run /Volumes/worker/worker.go Whenever I run this with Automator, it tells me go: command not found 回答1: Create a file like say file.go and it's content should look like: ///path-to/bin/go run $0 $@; exit $? package main func main() { println("Hello World!") } Then run chmod +x file.go and then you can execute it as ./file.go p1 p2 .

Create new folder named with a specified file name in Automator

瘦欲@ 提交于 2019-12-11 05:09:33
问题 I want to create a new folder named with the filename of the file used for the input. Example: If I use my new service with the file "test (test).jpg" I want to automatically create a folder named "test (test)". 回答1: To do this with regular Automator actions it gets a bit convoluted, since you need to save the original input, get the name, make the folder, get the original input back, etc. You can use a Run AppleScript action to do most of that in one go, although it depends on what you are

Applescript - creating a folder if it doesn't exist

与世无争的帅哥 提交于 2019-12-11 04:01:24
问题 Can someone please point out why this bit of Applescript isn't working? Thanks! on open droppedItems tell application "Finder" set inputFolder to (container of first item of droppedItems) as Unicode text if (exists folder ("converted") of inputFolder) then set outputFolder to (inputFolder & "/converted/") as text else make new folder at inputFolder with properties {name:"converted"} set outputFolder to the result as text end if end tell end 回答1: Here is another approach: mkdir -p will create

Automator or Applescript, detect a new file in folder

≡放荡痞女 提交于 2019-12-10 23:05:33
问题 I am trying to write something that will detect a new file in a certain specified directory. I preferably would like this script to continue running indefinitely, and whenever I see a new file, I can copy it and move it somewhere else. I know this has to be possible, because dropbox does it, but I just do not know how to get this working or where to start. Any ideas? 回答1: What you're looking for (to spawn off Applescripts when adding new files into a "hot folder") is called "Folder Actions",

Grab the title of a web article within Automator workflow

为君一笑 提交于 2019-12-10 19:21:02
问题 I am trying to create a workflow that converts a list of URLs into plain text using Instapaper, and then saves the text in text documents on my machine. So far, I have been able to grab the list of URLs, convert them, and save text documents. The problem is that I can't figure out how to use the name of each web page as the name of the subsequent document. I use my Instapaper RSS URL to grab the articles. Then I use "Get Link URLs from Articles" followed by an Applescript to convert to the

Finder application hangs / freezes sometimes when applescript is executed

给你一囗甜甜゛ 提交于 2019-12-08 12:35:25
问题 I am an applescript beginner and I am trying to automate some processes in the Finder. My script includes some simulated mouseclicks (cliclick), key codes and keystrokes to navigate through the Finder application. Sadly, in some cases the Finder application kind of freezes. As soon as i click on anywhere manually, Finder is running again but suddenly all the key codes, keystrokes etc. are executed at once without delays, leading the script to mess up the actions. I know that the answer or

Is there a way to trigger a Hot Key/Keyboard Shortcut via a Shell Script, a AppleScript or a Automator Workflow?

眉间皱痕 提交于 2019-12-08 05:17:21
问题 I'm an avid Keyboard Maestro user and I need a workaround for triggering a keyboard shortcut like ⌘⇧L (externally, without Keyboard Maestro). So I thought a bash script would be capable of doing such a thing. An AppleScript or an Automator workflow would be sufficient, too. I anybody could help me this would be great. You don't have to read this, but here's why I want to do what I want to do: I have a the same string assigned to various Markdown macros, I use a string instead of Hotkeys

How to click UI element using JXA

六眼飞鱼酱① 提交于 2019-12-08 03:35:02
问题 Please tell me how do I click in point coordinates in application window? I trying to UI automate my application on OSX 10.10 using JXA technology. In documentation I found that it's possible using click at event. By I'am beginner of JXA and cant find how make a call. Code snippet which I tried in Script Editor: var app = Application('my_application_path') app.window.click.at('{100,100}') Thank you for help 回答1: You can interact with an application's user interface using the System Events

Add a service in Mac Finder using CLI

人盡茶涼 提交于 2019-12-08 03:26:21
问题 I write a Python script and I want to add it as a service item in Mac Finder. I know I can open Automator window and set it. But I need a command line way. I search the method for a long time and still get nothing... Do anyone know how to achieve this? Thanks a lot. (Using python, apple script or any builtin CLI tool is also acceptable to me) 回答1: To go with my comment here is a very basic example. Which is to show you how services are registered, even the Automator ones. And why I think you

AppleScript: Create new folder from file name and move file into that folder

断了今生、忘了曾经 提交于 2019-12-08 01:59:28
问题 Basically, I'm trying to create a folder action in Automator so whenever a file is added to a specific folder, it will create a subfolder that matches the filename (without the extension), then move the file into that subfolder. So far, I have successfully used a post from this site (Create new folder named with a specified file name in Automator) to create a script that will create the new folder. However, I have been unable to modify the script to move the original file into the new folder.