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

Extended hs.osascript with functions to execute as/js from a file #1616

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@rkalis
Contributor

rkalis commented Dec 8, 2017

This allows people to import an AppleScript file to execute, instead of writing it inline in a Lua file. This also makes it easier to debug these scripts before integrating it with Hammerspoon as the files can be run separately first.

Added hs.osascript.applescriptFromFile and hs.osascript.javascriptFro…
…mFile functions, which import apple/javascript from a file, and exefcute it using the existing osascript functions
--- Returns:
--- * A boolean value indicating whether the code succeeded or not
--- * An object containing the parsed output that can be any type, or nil if unsuccessful
--- * If the code succeeded, the raw output of the code string. If the code failed, a table containing an error dictionary

This comment has been minimized.

@stickler-ci

stickler-ci Dec 8, 2017

(W631) line is too long (123 > 120)

---
--- Notes:
--- * This function uses hs.osascript.applescript for execution.
--- * Use hs.osascript._osascript(source, "AppleScript") if you always want the result as a string, even when a failure occurs. However, this function can only take a string, and not a file name.

This comment has been minimized.

@stickler-ci

stickler-ci Dec 8, 2017

(W631) line is too long (196 > 120)

--- Returns:
--- * A boolean value indicating whether the code succeeded or not
--- * An object containing the parsed output that can be any type, or nil if unsuccessful
--- * If the code succeeded, the raw output of the code string. If the code failed, a table containing an error dictionary

This comment has been minimized.

@stickler-ci

stickler-ci Dec 8, 2017

(W631) line is too long (123 > 120)

---
--- Notes:
--- * This function uses hs.osascript.javascript for execution.
--- * Use hs.osascript._osascript(source, "JavaScript") if you always want the result as a string, even when a failure occurs. However, this function can only take a string, and not a file name.

This comment has been minimized.

@stickler-ci

stickler-ci Dec 8, 2017

(W631) line is too long (195 > 120)

@cmsj

This comment has been minimized.

Member

cmsj commented Dec 8, 2017

@rkalis please ignore the stickler-ci comments for now - we've only just enabled it and I'm still bedding it down as to what is reasonable :)

@rkalis

This comment has been minimized.

Contributor

rkalis commented Dec 8, 2017

@cmsj Aah good to know, I was confused already, as some of the new lines of documentation (like the returns) were exactly the same as some existing ones 😅😅

@cmsj cmsj closed this in ea4b56e Dec 11, 2017

@cmsj

This comment has been minimized.

Member

cmsj commented Dec 11, 2017

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment