The PrimalScript gold mine: lots of hidden gems

I’ve received a bunch of questions about PrimalScript since the public beta was release and most of them deal with just getting started. I thought I would prepare a short intro to PrimalScript that some people might find helpful.

PrimalScript is a fast and fully featured IDE. It supports many many languages, as such you may find some things in there that you may have no use for (A good example is the windows scripting features). After installation there is very little you will have to do to get PrimalScript working–it automatically adds the Flash MX 2004 help files and will detect the AS Class path.

What is PrimalSense?

PrimalSense is PrimalScript’s language parsing engine that will give powerful code hinting features and is the single best feature in PrimalScript. PrimalSense provides for a huge improvement in accuracy and speed of programming and is one feature that Flash Developers have not had access to before.

To test out this feature, select File > New > File… > Script File > ActionScript Class, and type “import mx.” You should see a list of available package names appear. This is only part of what PrimalSense provides. Once you have played with it a bit you will see many more useful places where PrimalSense is used.

Although you don’t really need to know how this works, some background information on what is parsed is good to know. Flash MX 2004 ships with class definitions placed in the classes folder for all built in classes (MovieClip, XML, etc), and also includes many classes not built into the player (UIObject, Tween, etc). PrimalSense parses these classes to provide accurate code hinting for all the classes in that folder. Not only does it do that, but it will also parse all ActionScript files in the current project and the current file you are working on. So at any given moment, PrimalScript ensures that any class in any of those locations will be available via PrimalSense. This will require you to always keep in mind a couple of things.

  1. Our file needs to have an extension of .as or .asi.
  2. If we want code hinting for custom classes, we will need to have a project and include all our classes in the project. Developers who have worked in other languages/environments will be used to this but many ActionScript developrs have never had to do this, so it might need some minor adjustments in your workflow if you never used a project definition to manage your files.

Simply, PrimalSense is a dynamic code hinting system that is not static and is smart enough to parse AS2 classes and provide good and useful code hinting.

Help Integration

PrimalScript integrates well with Flash’s help file system. As a quick test, open a new ActionScript file and type in “MovieClip” then hit F1. If this is the first time you use the context sensitive help integration, PrimalScript will create an index of Flash’s help system for fast retrieval.
Features of the help integration;

  • When hitting F1, the help file index is used to look-up a match. If it only finds one match then that page will be automatically opened in a new tab inside PrimalScript.
  • If several matches are found you will be presented with a list of matches to choose from.
  • The help system also allows you to do a full-text search on the help files.
  • Keep in mind that the index file is created the first time you launch the help system. If you update your Flash help files, you will need to click on the “reset index” button to instruct PrimalScript to rebuild the index file.
  • The help system is smart. If you have a variable of type MovieClip (var myMc:MovieClip) and somewhere later on in the class you hit F1 on myMc, the help system will know that the variable is of type MovieClip and present you with help for that.
  • You can specify the location of the help documentation in the preferences.

Hidden gems – Shortcuts & Nice features

I’m a sucker for shortcuts and hidden features and PrimalScript doesn’t skimp on those at all. Here are a list of shortcuts and some hidden features that I have found useful

  • CTRL+Q/CTRL+SHIFT+Q (Comment/Un-comment a line)
  • Code snippets: There are many code snippets that ship with PrimalScript and you can create your own. To test it out, type “class” and hit ctrl+j. You can check out and edit the snippets in the Snippets Nexus panel. Snippets are on a per language basis so make sure when you create your own snippets that they are saved in the appropriate folder. Shippets can also be used by dragging a snippet from the Snippets Nexus to the current file.
  • SHIFT+Delete to delete a single line at a time.
  • Double click the middle mouse button or scroll wheel button to hide the nexus window. ColdFusion Studio or HomeSite users may want to associate F9 with this command which can be done through Tools > Customize…
  • Drag a folder from the windows explorer to the Workspace Nexus (project) to add the folder and all it’s sub-folders/contents quickly.
  • Right click a document tab and select “Open containing folder” to open the folder where the file is contained.
  • CTRL-I then begin typing part of a search string. PrimalScript will start looking for a match in the current file and hitting F3 will allow you to find the same string again and again.
  • Double-click on the little trash can at the bottom right. PrimalScript keeps a history of code in case you have erased something by mistake.
  • You can add the help files for JSFL and FlashComm Server Side ActionScript and receive PrimalSense for them too.
  • CTRL-L will allow you to jump to a specific line number.
  • CTRL-E to go back to the last edited line
  • You can convert the NetConnection debugger into a projector and add it to the tools nexus for fast/quick access.
  • You can add the Flash Comm admin utility pages to your info nexus for quick access.
  • You can add many document formats and any tools to the info and tools nexus. Great for quick access to things like ASV and Document Generators
  • Make sure to check out the Macro tools. You don’t need them often but when you do they can save you a lot of time. You can also save macro’s and map keyboard shortcuts to them.
  • You can set up a command line compiler via jsfl for the project. Right click the project and add your command line tool application information there. You can even launch a jsfl file directly. Once that is configured you should be able to hit F9 to compile. (we’re working on some extensions to allow compile and run within PrimalScript and even view trace output inside PrimalScript. Keep an eye out, but don’t hold your breadth.)
  • If you right-click a saved document, you should see an option to add the file to the current project.
  • You can enabled PrimalScript to open the last open document/project automatically when it starts up in Tools > options > Text Editor > General > Restore Last opened file at startup.
  • If you have Tortoise CVS installed, you will be able to gain access to it from the File Nexus browser by right-clicking on any folder. When working in a project, you can right-click on any file in a project and “Open Containing Folder in File Nexus” for quick syncing of the Workspace Nexus and File Nexus.
  • PrimalScript also has traditional SourceControl integration through SCC plug-ins.
  • Make sure to play with the color and font settings in the options to suite your preference (Black background anyone :)

For more information on PrimalScript be sure to check out Sapien’s website. You may also find the beta forum (news.sapien.com) of interest to see all the little things that were requested and added to this new version, and how amazingly responsive the Sapien engineers have been.

13 thoughts on “The PrimalScript gold mine: lots of hidden gems

  1. It works for as 2.0, but is there a way to make it be the editor for actionscript 2.0 & actionscript 1.0??

    When i open a as1.0 file i see some highlighting but dont see the function list etc…

    Nick

  2. We already added suffix support, so that will be available in the next beta build.
    We also will add an alternate actionscript.sense file in case you do not even have a newer version of Flash installed.

    Alex

  3. I have used PrimalScript beta for last 4 days, and all what i can tell about it that it is lovely. Very comfortable environment for developing: i have connected it to SourceSafe to forget about version headache; have write a simple jsfl to make flash compile the project.. the whole system gives me a real pleasure! Souscebrowser nexus rules too :)

  4. I’ve been using it for about a week now. At first I wasn’t so impressed, but the more I use it, the more I find little things I like. I am slowly being convinced. Keep the tips coming!

  5. Rostik, I’ll have to agree with you there. EditPlus has nice virtual word wrapping–although it’s missing everything else. Please log on to the Sapien beta groups and request it there to make the request official. More people request, the higher priority it should get.

  6. The beta group is public. You can use any news reader like Outlook Express or Free Agent (http://download.com.com/3000-2164-10180540.html?tag=lst-0-3) to access the groups. Set it to use news.sapien.com as the news server and then retrieve the groups list. There will be four groups, PrimalScript, PrimalCode, PrimalScript Beta, and PrimalCode Beta. Read through the PrimalScript beta group and post all feedback and requests regarding 3.1 there.

  7. Sam, thank you a lot! I missed your mention about the beta forum (news.sapien.com) out of my attention (shame on me!)

    I am joining right now!

  8. I’m coming late into this but I can’t seem to get the package list from “import mx” that Chafic mentioned at the top.

    When I open the program, choose “ActionScript Class” from the template list, it opens a new file. I don’t understand where to type “import mx” to get the list of packages.

    Thanks for helping to clarify this!

    -jonathan

  9. Jonathan: In that step, the “import mx.” (notice thd dot should be typed in the new document body. You should see a list of available packages from the Flash MX 2004 classes. If you had your own class in there, and typed “import com.” it would list your “amethystinteractive” package in there. The only way PrimalScript knows it needs to list packages is if you type “com.” or the start of a package and hit “.”, or if you are creating typed object like this “var myObj:”. Hopefully that answers your question.

  10. Hi Guys,

    Excellent this argument, but something is not yet clear to me, how can I setup the AS compiler. I would like to at least check sintax and compile the AS. Is it possible? Also, is there a way to run MAIN classes to get tracing messages?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>