Date   

Re: Use Visual Studio Code (VSC) to Write, Compile, and Run JXA Scripts #script #vsc

 

I've now learned the following:

  1. Note that the extension is named “AppleScript” because it also supports AppleScript. But all you need to do is save a file with a .jxa extension and VSC will auto-recognize it as a JSA script.

  2. To compile and run JXA scripts, open the Command Palette with ⌘⇧P, and type “JXA” to see the choices for it. Or, just use these shortcuts:

    • JXA: Run Script – Shift+Opt+R
    • JXA: Compile Script – Shift+Opt+B
    • But you can easily change these if you prefer other, using Key Bindings for Visual Studio Code
      • I prefer the shortcuts used by both Script Editor and Script Debugger:

        JXA: Run Script – ⌘R
        JXA: Compile Script – ⌘K

  3. Creating .scpt File from .jxa File

    Good news. When you compile/run the .jxa file in VSC, it automatically creates a companion .scpt file, which you will need if you want to run the file from a KM Execute JXA from a file, or via FastScripts.

    image

  4. Opening a .scpt File in VSC

    Short answer is you can’t. You will need to save a text file with a .jxa extension.


That's all for now.
--
JMichaelTX


Use Visual Studio Code (VSC) to Write, Compile, and Run JXA Scripts #script #vsc

 

Great news folks!  An extension for Visual Studio Code (VSC) is available that supports JXA scripts.
See 

AppleScript & JXA - Visual Studio Marketplace 


I've just started testing it, but so far, so good.

If you haven't used VSC, I highly recommend it.  It is free and has great features.  Among them is code completion, which  is far superior to Script Editor.

I hope some of you with join with me in learning and testing the JXA extension for VSC.  Please post your questions, issues, and/or suggestions here.

--
JMichaelTX


Script to Get Path Info of Finder Selected Item #script #finder #path

 
Edited

I have just uploaded the following file to the Files section of this group:

@Path Get @Finder Item Path Info @JXA.scpt 

Please feel free to download, use, and make any comments or improvements.
Please post your comments in this thread.

--
JMichaelTX


JavaScript for Automation (JXA) Wiki #wiki

 

I have now started a wiki for this group:

JavaScript for Automation (JXA) Wiki

We are just getting started, and are looking for wiki contributors of all sizes and shapes. You don't have to be an "expert", or a "guru" to contribute, but you do need to be correct. So please double-check ✅✅ your posts to this wiki to make sure they are factual, correct, and clear. One of the great features of wikis is that they can be easily edited by multiple authors. So, if you spot a mistake, an error, or you find the text confusing, please jump in and edit the wiki article to make it better. If you are not sure about what is correct, or you would like confirmation first, then just post a topic here (with a hashtag of "#wiki"), and present the issue/question.

We want everyone to know they can rely on the information they find in this wiki! 😀

One technical note: The Wiki has been setup to use the Markdown format for posting. So before you create or edit a Wiki page, you will need to go to [YourProfile] > Account > Preferences > Post Preference and choose Markdown.

If you have any suggestions concerning the wiki, please feel free to post here.

So, please join with us in making this the best JXA site on the web❗️

JMichaelTX


Re: Test Add Image when in HTML Post Mode

 

OK, it will NOT let me edit my original post in Markdown mode, even after I changed my Preference to "Markdown". However, when I reply, I do get Markdown mode.

-- JMichaelTX


Test Add Image when in HTML Post Mode

 

First I'll try drag/drop of image just below this:
<FAILED>
image did NOT appear in post, but in a new, unrelated window.

Try Insert Image from Toolbar:


OK, this worked very well.

I save this post, change my pref back to Markdown, and edit.


--
JMichaelTX


Test Attachment from Markdown Toolbar

 

TEST add of image attachment. Doesn't appear any way to show inline with text.

-- JMichaelTX


JXA Resources

 
Edited

Here is a resource I'd like to share:
[JavaScript for Automation (JXA) Resources](https://apple-dev.groups.io/g/jxa/wiki/JXA-Resources)

But I'm sure it can be improved. Please post resources you have found useful.

This article is now part of our Wiki.

--
JMichaelTX