script-commands: Applescript with emoji icon fail to run

Hi,

first of all I want to say that I love what you are doing with Raycast. I’m tweaking it a bit with script and I have bumbed to tricky issue. When I try to run applescript in Raycast to which contains emoji icon it won’t run if there is a tell block over multiple lines.

I have tried sleep command from this repo and it worked fine. But when I tried to run toggle-desktop-icons it failed and nothing happen. I have tried to change mode to compact and it write Operaction couldn't be completed. Exec format error.. But if I delete # @raycast.icon line script works.

macOS version 10.15.7

Tested it with Raycast 1.1.0 and 1.1.1.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

In case it is still helpful to anyone:

I just tried creating an applescript script and I got hit with [Exec format error] when trying to run it. After reading this thread, removing the default Raycast line # @raycast.icon 🤖 solved the problem.

@kastnerorz your script works on my machine. What error do you get when removing the @raycast.icon from the script? Also, could you make sure to set the encoding to UTF-8. I attached a screenshot on how to do it in VS Code. We encountered some issues in the community that the encoding was sometimes set to something else for AppleScript and it broke the execution.

CleanShot 2020-12-12 at 11 57 34@2x

could you make sure to set the encoding to UTF-8. I attached a screenshot on how to do it in VS Code. We encountered some issues in the community that the encoding was sometimes set to something else for AppleScript and it broke the execution.

I was having this issue, and the above suggestion fixed it for me. In VSC I’ve re-saved the file with UTF-8 encoding and my script started working, without making any other change.

@thomaspaulmann I think it’s the encoding issue. I saved it with script editor, after I copy and re-edit with vim, it works.

Adding to the comment above Note that VSCode will give you the encoding in its status bar.

Also @thomasbaart thanks for the Kyria!

Also, could you make sure to set the encoding to UTF-8. I attached a screenshot on how to do it in VS Code.

FYI: I was having the same issue. Above suggestion from @thomaspaulmann fixed it. For some reason every time I edit the script in Script Editor it encodes it as UTF-16, and then Raycast won’t run the script. Changing the script file to UTF-8 fixes that.