Tapatalk

Combining ASP and JavaScript (not VBScript)

Combining ASP and JavaScript (not VBScript)

3
NewbieNewbie
3

    Apr 03, 2012#1

    Hi,
    How do I set the editor to use JavaScript-driven ASP?

    Thanks,
    -Russ

    6,685587
    Grand MasterGrand Master
    6,685587

      Apr 04, 2012#2

      The problem is that I'm an expert in configuring syntax highlighting of UltraEdit. But I don't know anything about the structure of an ASP file. ASP files are usually multi-language files containing VBScript or Javascript, HTML, CSS, ... Without having an example code and knowing the tags used by applications parsing ASP files to determine which block is in which language, I can't help you setting up an appropriate syntax highlighting for *.ASP file with Javascript as base language.

      I have explained basically the method used by UltraEdit to detect the blocks of different languages in HTML files with other languages embedded in topic Syntax highlighting between different languages.

      Which *.uew file respectively syntax highlighting language should be associated with files with extension ASP and which other *.uew files should contain the other possible language marker strings as listed at Syntax Highlighting near the bottom depends on the structure of Javascript driven ASP files which I don't know.

      3
      NewbieNewbie
      3

        Apr 04, 2012#3

        Thank you, that was more helpful.

        ASP files are basically a combination of (VBScript & HTML) OR (JavaScript & HTML).

        UE treats *.asp files as VBScript/HTML. ie. all VBScript syntax and HTML syntax is highlighted.

        It seems that UE arbitrarily chose the VBScript/HTML combination to treat *.asp files instead of the JavaScript/HTML combination.

        I was just wondering if there was an option to choose JavaScript/HTML for *.asp instead of the default VBScript/HTML. I figure since UE can do one, it could do the other.

        -Russ

        6,685587
        Grand MasterGrand Master
        6,685587

          Apr 05, 2012#4

          Open in UltraEdit Advanced - Configuration - Editor Display - Syntax Highlighting. You see there the path to the wordfiles directory. Select the path, copy it to clipboard with Ctrl+C, paste the path into address bar of Windows Explorer and press key RETURN. Usually this directory is %APPDATA%\IDMComp\UltraEdit\wordfiles\ with APPDATA referencing the value of environment variable APPDATA.

          You see now the *.uew files in the wordfiles directory currently used by UltraEdit. Because you make changes now, it would be advisable to create a copy of the entire wordfiles directory with a different name. For example copy wordfiles to mywordfiles.

          In mywordfiles delete first all *.uew files you surely never need to speed up starting of UltraEdit because less wordfiles to parse.

          Next you have to either delete vbscript.uew in mywordfiles or open this file in UltraEdit, remove the language marker keyword ASP_LANG and save the wordfile.

          Further you have to create a copy of javascript.uew for example with name asp_javascript.uew. Open asp_javascript.uew, replace in first line JSCRIPT_LANG by ASP_LANG and remove File Extensions = JS. Change also the language name from "JavaScript" to "ASP-JS" in this wordfile. And remove the color groups /C6 and /C7 from this wordfile because of no use for Javascript based ASP files. Save the modified wordfile which should be interpreted now by UltraEdit as basic language file for files with file extension ASP.

          Now open in UltraEdit once again Advanced - Configuration - Editor Display - Syntax Highlighting and modify the path to mywordfiles. Best is to exit UltraEdit after this change and restart it, although that should not be really necessary. Open now a *.asp file. Is the syntax highlighting now as expected?

          I can't test if the configuration as explained here really works because of having no ASP file whether with VBScript nor with Javascript is basic language.

          You see in the status bar or in submenu View - View as (Highlighting File Type) which syntax highlighting language is active at current position of the caret in active file. If you see now ASP-JS with caret in a Javascript section within an ASP file the syntax highlighting is working as I think it should work.

          3
          NewbieNewbie
          3

            Apr 05, 2012#5

            mofi,

            Thank you for the detailed instructions.

            I did everything you said except the part about removing /C6 and /C7. When you said to remove those color groups, did you mean remove the entire line for each of those, or just the actual characters "/C6" and "/C7"?

            So far the files look more like JavaScript, but with a few exceptions; most JavaScript keywords are blue, but some are red. Also, some of the pure ASP code (separate from JavaScript or VBScript) is pink and some of it is blue. The pure HTML also has various colors. Is this because I did not delete /C6 and /C7 yet. I'm sure there are many modifications I can make to force the ASP-only code and the HTML code to be custom colors.

            Thank you,
            -Russ

            6,685587
            Grand MasterGrand Master
            6,685587

              Apr 05, 2012#6

              Delete /C6"UE/UES Script Commands" STYLE_FUNCTION and everything below up to end of file in asp_javascript.uew because these 2 color groups and all the keywords listed in these 2 color groups are for UltraEdit/UEStudio scripts being interpreted with Javascript core. You will have surely never UltraEdit scripting commands in your ASP files. Keeping those words could just disturb you when giving a variable a name which is by chance identical to a scripting command or property in UltraEdit scripts.

              The colors can be configured also in the syntax highlighting configuration dialog and are stored in the wordfiles. Just select in the syntax highlighting configuration dialog the language HTML and configure the colors for the available color groups. Do the same for language ASP-JS.

              As I have wrote already you can see on the status bar at bottom of the UltraEdit window in 4th box at any time which syntax highlighting is active at current position of the caret (text cursor) in active file. A displayed HTML indicates that the language HTML as defined in html.uew is active, a displayed ASP-JS indicates that this language as defined in asp_javascript.uew is active.