如何简单地从 mac excel 2016 运行 applescript 任务

编程入门 行业动态 更新时间:2024-10-24 20:13:42
本文介绍了如何简单地从 mac excel 2016 运行 applescript 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我目前正在编写工作中的 VBA 宏,但是我遇到了一个问题,希望您能帮助我.

I am currently in the process of writing a VBA macro at work however I have run into a problem which I am hoping you can help me with.

我想要做的只是从 excel 中运行一个 applescript 应用程序,这在 2011 版中很容易做到,但在 2016 版中似乎变得更加复杂.

All I am trying to do is simply run an applescript app from excel, this was very easy to do in the 2011 version but has seemingly gotten a lot more complicated in the 2016 edition.

我在网上研究了很多地方,但没有运气,我遇到的唯一文章和指南指向参数和检查文件,但不幸的是我不知道这些是什么.我想做的就是提供applescript的文件路径,以便excel可以运行它,这些还有可能吗?

I have researched various places online but with no luck, the only articles and guides I have come across point towards parameters and checking files but unfortunately I have no idea what any of those are. All I would like to do is to provide the filepath of the applescript so that excel can run it, is these even possible anymore?

我已经附上了相关的applescript文件,请不要过分评价我有多糟糕,我上周才开始学习.

I have attached the relevant applescript file, please don't judge me too hard for how bad it is, I only started learning last week.

在 Excel 2011 中工作的代码如下:

The code that worked in Excel 2011 was as follows:

OSA = "/usr/bin/osascript"
SCRIPT = "/users/savePDF.scpt"




MacScript ("do shell script " & Chr(34) & OSA & " " & SCRIPT & Chr(34))

但是,在 excel 2016 中,我尝试使用 AppleScript 任务命令,但出现编译错误,表明该参数不是可选的.虽然我不确定他们在谈论什么论点

However in excel 2016 I am trying to use the AppleScript task command but get a compile error that the argument is not optional. Although I am not sure what argument they are talking about

非常感谢您的帮助.

推荐答案

这似乎是个愚蠢的问题,现在我终于找到了答案.

Seems like such a stupid question now I've finally figured out the answer.

鉴于我没有控制任何变量或在 applescript 和 VBA 之间来回传递任何值,applescripttask 命令对我来说毫无用处.

Seeing as I didn't to control any variables or pass any values back and forth between applescript and VBA, the applescripttask command was pretty useless for me.

我最终能够通过简单地使用超链接命令来启动.app",如下所示:

I ended up being able to launch the ".app" by simple using the hyperlink command, as follows:

   ActiveWorkbook.FollowHyperlink Address:="/Users/(usernamehere)/Desktop/savePDF1.app", NewWindow:=True

这篇关于如何简单地从 mac excel 2016 运行 applescript 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 15:03:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/915728.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简单   mac   excel   applescript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!