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 6 years ago
  • Reactions: 8
  • Comments: 22 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@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

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.

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.

Would be useful to get an error message stating that the file was saved in the wrong encoding. Just spent half an hour troubleshooting due to the Script Editor saving it in UTF16 by default. After setting the encoding to UTF8 it worked again, but the error message I got wasn’t helpful:

Reason: Process tried to run, but failed Domain: scripts Time: 12:25:51.852 Underlying: Domain: NSPOSIXErrorDomain 8 Reason: Exec format error

I hope by putting this here, people will find the resolution easier. Bonus points if Raycast could hint to the user that the encoding isn’t correct.

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

Same issue in 2024. Switching the encoding to UTF-8 in Sublime seems to fix it. Raycast should implement a fix.

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.