Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to pass arbitrary scripts #9

Open
cuotos opened this issue Jul 7, 2021 · 1 comment
Open

Add ability to pass arbitrary scripts #9

cuotos opened this issue Jul 7, 2021 · 1 comment

Comments

@cuotos
Copy link

cuotos commented Jul 7, 2021

I want to be able to use mack for some simple Tell's, but also have some logic that requires if application X is running before calling a tell in the same tool.

Either the ability to call mack.If and pass in a Tell if it tests true, or simply to be able to pass and entire script as a string to mack. mack.Run(script string) or something along those lines would be handy

@bohtho
Copy link

bohtho commented Jan 28, 2022

Couldn't you just import "os/exec" too and do something like this to run a more advanced AppleScript ?

info, err := exec.Command("osascript", "getApps.scpt").Output()

You should get any return data from AppleScript in one form or other into "info".

Possibly also embed the AppleScript in the compiled file to make it invisible to the user (and to in effect "pass an entire script as a string"). Haven't tested any of this concretely for Mack or AppleScript-files, but am curious.

I’m just being practical and understand your original issue was regarding further development of Mack.

Btw, this fork is slightly more updated as long as this current repo doesn't respond to pull requests.

Edit: and this repo seems to be thinking much the same as us: https://github.com/drgrib/mac/blob/4f366006daac7355ea4a771f5367f6dde2b8f2ca/mac.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants