Script copied from a forum post does not run on Windows 10 Home Korean (solved)

Script copied from a forum post does not run on Windows 10 Home Korean (solved)

Basic UserBasic User

    Jan 25, 2019#1


    I use Windows 10 Home Korean and UEStudio version

    I read these two articles below thoroughly:
    1. UltraEdit script does not run
    2. How to create a script from a post in the forum?
    But I am still having a trouble in executing the script below.

    Code: Select all

    UltraEdit.activeDocument.write("Hello World");
    Here is what I did:
    1. Ctrl + N  // Created a new file.
    2. DOS, 949 (ANSI/OEM-Korean) // on the status bar at bottom of the UES
    3. I copied UltraEdit.activeDocument.write("Hello World"); and pasted it.
    4. Saved this file with these two options below as Hello_World.js using Save as with
      1. Encoding: ANSI/ASCII
      2. Save (DOS line ends - CR/LF) or SAVE   // Did either one
    5. Added this script to the Play script list.
    6. I played Hello_World script.
    I am getting the error below in the output window:

    Code: Select all

    Running script: C:\JS\Hello_World.js
    An error occurred on line 0:
    Script failed.
    I can't get it to work.

    Is there anything I did wrong?

    Thank you very much in advance.

    Grand MasterGrand Master

      Jan 26, 2019#2

      The script file in formerly attached ZIP file works.

      Some advice for writing UltraEdit/UEStudio scripts:
      1. Click on ribbon tab Layout in second ribbon group Views on check box item Output Window to open the output window view and if necessary click on pin symbol on title bar of this view to make it permanently visible. Syntax error messages detected by JavaScript interpreter on execution of a script are redirected by UEStudio to the output window, except configuration setting Show status information in output window is checked at Advanced - Settings or Configuration - Scripting. This configuration setting should be not checked on developing a script.
      2. Open Advanced - Settings or Configuration - Editor display - Miscellaneous and check the setting Auto-correct keywords. Then UEStudio automatically corrects words defined in active syntax highlighting wordfile on language being case-sensitive and the keyword is not correct typed. This is a really useful feature on writing scripts.
      3. Click on ribbon tab Layout in second ribbon group Views on check box item Tag list and select at top the group UE/UES Script Commands. Double click on a tag in Tag List view to insert at current position of caret in active file the tag. That saves a lot of typing and avoids typing mistakes. The caret is positioned after inserting a tag on where something must be added manually if that is necessary at all for inserted command or property.
      Good luck on further coding of UEStudio scripts.

      By the way: You are using already UEStudio v18.20.0.18 which is a full Unicode aware application and supports also UTF-8 and UTF-16 encoded script files without or with BOM. So feel free to code the script with Korean characters in comments and yes, also in strings, in Unicode using encoding UTF-8 or UTF-16. You can see on execution that the Unicode characters in JavaScript strings are correct written into a Unicode encoded file or copied to clipboard on execution of the script.
      Best regards from an UC/UE/UES for Windows user from Austria

      Basic UserBasic User

        Jan 27, 2019#3

        I can't thank you enough, Mofi.

        Mofi's suggestion, especially turning on auto-correct keywords function, was very helpful. Actually it's awesome.

        But I am afraid the super simple script is still NOT working.

        I uploaded the a video, see

        I pressed CTRL+H  to show HEX at the end of the video. Did it help?

        I use UEStudio with unlimited upgrades license two years ago and every software I use is authentic.

        What causes this UNBELIEVABLE error?

        Once again, thank you very much!

        Grand MasterGrand Master

          Jan 28, 2019#4

          Hm, I don't have a problem to do what you have done and documented with the video. The script runs fine without any error taking into account that there are two general issues.
          1. The directory C:\Program Files\IDM Computer Solutions\UEStudio\scripts is usually write-protected because of all directories and files in C:\Program Files are usually write-protected by Windows.
            I needed to disable user account control, log off and log on to be able to start UEStudio and extract the script file from ZIP file into the directory C:\Program Files\IDM Computer Solutions\UEStudio\scripts.

            Do you have also disabled user account control or do you start UEStudio as administrator or do you have changed the NTFS permissions on the file or one of the directories to the file to create/edit the script file in this directory?

            I would suggest to save your script files in a directory which is by default not write-protected and not so carefully observed by anti-virus applications as the program files directory. What about using %APPDATA%\IDMComp\UEStudio\Scripts? This directory does not exist by default, but you can create it without use of special permissions because you have always full control on the application data directory of your account. It is also possible to use any other directory. But it is advisable that the directory is not write-protected for your account at least on developing a script.
          2. It is not advisable to run a script which writes strings into active file on having the script file itself opened. This means modifying the script while it is run. That is no good idea. In my test it worked. But it would be better to have a different file like a new file opened and active on running the script.
            Modifying the script file C:\Program Files\IDM Computer Solutions\UEStudio\scripts\hello_world.js with execution of this script worked on my Windows 7 x64 with using UEStudio v18.20.0.18 after having disabled UAC to have write access to this file at all. But in general it is better to have a different file than the script file active on running a script which modifies active file. The script file succeeded even on C:\Program Files\IDM Computer Solutions\UEStudio\scripts\hello_world.js being the active file, but I have set read-only attribute on this file. The string is not written into the file in this case, but the script execution itself succeeded according to message in output window.
          I selected also code page 949 after opening the script file. But the default code page on my Windows 7 computer was still Windows-1252 and not ANSI/OEM 949 Korean which could be another problem source. But first I suggest to run the script on active file being a new file instead of the script file itself.

          The hexadecimal view in video does not show the first 32 bytes of the file, but the remaining 15 bytes are identical to hexadecimal view of the script file as on my computer. So it looks like the file contains also on your computer just 47 bytes being all ASCII characters.

          What I really do not understand is the line number 0 in the error message which means the internal JavaScript interpreter could not read at least one line from script file.

          What happens on opening Advanced - Settings or Configuration - File handling - Encoding and configure 1252 (ANSI - Latin I) as Default code page (for ANSI encoding)? Does the script run with code page 1252 instead of 949 as default code page?

          What happens on saving the script file as UTF-16 encoded file with BOM which is supported by UEStudio v18.20? Does the script run on being encoded with UTF-16 Little Endian with byte order mark?

            Feb 07, 2019#5

            After some more posts deleted later as it turned out they were of no help on this issue.

            I can't reproduce what I could see on your videos using 32-bit UEStudio v18.20.0.18 on English Windows 7 x64 with region settings for German (Austria). It could be that the region/language settings of Windows 10 have some unexpected effects on saving non-ASCII characters as well as on running a script which do not occur on Windows 7.

            You don't know how to modify NTFS permissions. So it is clear that you have not modified the NTFS security permissions on folder C:\Program Files. So you either must have disabled UAC sometime in the past or confirmed elevation to local administrator on saving script file in C:\Program Files\IDM Computer Solutions\UEStudio\scripts or ran UEStudio as administrator. However, NTFS security permissions are definitely not the source of the problem as it turned out because of running the script from your downloads folder resulted in same error message. There is surely no file access permissions problem with script file in your downloads folder on running UEStudio with your user account.

            Do you have saved the hello world script once also as UTF-16 file with BOM and executed this UTF-16 encoded script file from Script List with UEStudio v18.20.0.18? Does it make a difference to ASCII encoded script?

            I am pretty sure that all script executions failed all the time because of Windows 10 and Korean language settings. So we should focus on this source of possible reasons.

            I suggest to download the ZIP file of free Sysinternals (Microsoft) application Process Monitor. Then process following steps with reference to attached image:
            1. Extract the ZIP file directly in your downloads folder into the folder suggested by Windows on extraction of the ZIP file.
            2. Start Procmon.exe after extraction with a double click and accept the EULA.
            3. Next is shown the Process Monitor Filter dialog. Configure in this dialog Path ends with hello_world.js then Include and press button Add. Then press button OK.
            4. On the toolbar click on right side once on most right five icons with exception of the icon showing a filing cabinet. That toggles off showing registry, network, process and thread activities and profiling events and so just file system activities are shown by Process Monitor.
            5. Press Ctrl+X or click on fifth symbol in toolbar from left side to clear everything already recorded by Process Monitor.
            6. Switch to UEStudio and run the script with file name hello_world.js from the Script List.
            7. Switch back to Process Monitor, stop capturing by pressing Ctrl+E or clicking on third symbol on toolbar from left side.
            8. Press Ctrl+S to open the Save To File dialog, uncheck the option Also include profiling events because of those information are of no help on this issue and just make the saved file unnecessary large, look on Path to know where the file is saved and click on button OK.
            9. Compress the *.PML file created by Process Monitor into a ZIP file and attach this ZIP file to your next post.
            I will look into it and hopefully can see the reason for the script execution problem.
            process_monitor_settings.png (13.82KiB)
            Process Monitor filter and save settings for recording file accesses on hello_world.js and hello_world2.js.
            Best regards from an UC/UE/UES for Windows user from Austria

            Basic UserBasic User

              Feb 17, 2019#6

              Hi, Mofi. 

              I am attaching a ZIP file (deleted later) with two files. As you know, hello_world.js file contains only this: UltraEdit.newFile();    

              The file name has nothing to do with a normal one printing Hello World! on the screen.

              It's in C:\Program Files (x86)\IDM Computer Solutions\UEStudio\scripts folder.

              I created exactly the same file in the C:\Users\MY NAME\Downloads with a different name hello_world2.js and ran the script.

              They gave the error below.

              Running script: C:\Program Files (x86)\IDM Computer Solutions\UEStudio\scripts\hello_world.js
              An error occurred on line 0:
              Script failed.

              Running script: C:\Users\MY NAME\Downloads\hello_world2.js
              An error occurred on line 0:
              Script failed.

              1_Logfile.PML file was the one monitored when running hello_world.js which is in C:\Program Files (x86)\IDM Computer Solutions\UEStudio\scripts.

              2_Logfile.PML file was created when running hello_world2.js in C:\Users\MY NAME\Downloads.

              Thank you very much for your endless concern and help.

              I really appreciate it!

                Feb 18, 2019#7

                Today I reset my laptop, running Windows 10 Home Korean. I just updated the Windows 10 and ran the Process Monitor. I haven't installed any program, not even Chrome browser. The only program I installed is UES 64 bit

                For this time, I ran the script hello_world.js having this:

                UltraEdit.activeDocument.write("Hello World");

                I am getting the same error message posted above.

                Thank you very much.

                Grand MasterGrand Master

                  Feb 18, 2019#8

                  I could not see on your Process Monitor log files the reason for failure on script execution. But I could see on log files your user account name, a string consisting of three Korean characters which must be Unicode encoded in file system. So I used next Process Monitor on my machine to find out if UE/UES use the temporary files directory on running a script and the answer is: yes, it does. UE/UES use the directory specified by environment variable TMP.

                  So I tried what happens if I create the directory C:\Users\YourAccountName\AppData\Local\Temp and edit my user account related environment variables TEMP and TMP to this path with the three Unicode encoded Korean characters. After making this modification on my environment variables, I started UltraEdit and executed the script. It worked and I was really surprised that it worked.

                  I looked on Process Monitor log on my Windows 7 computer how an environment variable is defined by Windows 7 which contains Unicode characters. Well, the environment variable is defined as Unicode encoded string. So no problem if the application is full Unicode aware and uses the Unicode variant of the environment variable. But I wanted to know how such a path is managed by Windows for non-Unicode aware applications. Therefore I opened next a command prompt window and executed command line set T to see all environment variables starting with letter T in any case and saw TEMP and TMP defined using short 8.3 path of C:\Users\YourAccountName\AppData\Local\Temp which does not contain Unicode characters.

                  Then I wanted to know what happens if the folder path assigned to environment variable TMP specifies a folder which does not exist at all. So I edited once more the TMP variable and modified the path to C:\Users\YourAccountName\AppData\Local\TempX and saved the modification. There was of course no directory with name TempX. After restarting UltraEdit to get the modification of environment variable TMP effective for UltraEdit process, I executed the script once again and now it failed with the same error message as you see always in output window. I looked on the environment variable TMP in a newly opened command prompt window and it was defined as C:\Users\???\AppData\Local\TempX. There was three times the wildcard character ? in folder path instead of short 8.3 name of the user account directory. This is of course invalid. The wildcards ? and * are not allowed in file/folder paths. So if Windows can't find the directory containing the Unicode characters in path to determine the path in short 8.3 format, it replaces the Unicode characters by question marks and application's behavior becomes unexpected.

                  I suggest following:
                  1. Create a directory C:\Temp
                  2. Open System settings of Windows Control Panel.
                  3. Click on Advanced system settings on left side.
                  4. Click at bottom on button Environment Variables.
                  5. In the upper half of the window double click on variable TEMP, modify the variable value at bottom to C:\Temp and click on button OK.
                  6. In the upper half of the window double click on variable TMP, modify the variable value at bottom also to C:\Temp and click on button OK.
                  7. Close the Environment Variables dialog window with button OK.
                  8. Close the System Properties dialog window with button OK.
                  9. Start now UltraEdit or UEStudio.
                    It is important to start UE/UES new if they were already running as otherwise the changes on the two environment variables do not become effective.
                  10. Run the script from the script list.
                  Does it work now as expected by me with directory for temporary files being C:\Temp?

                  I recommend restarting Windows if the change of the directory for temporary files to simple C:\Temp really works because of other applications should use now this directory, too.
                  Best regards from an UC/UE/UES for Windows user from Austria

                  Basic UserBasic User

                    Feb 19, 2019#9

                    Oh, My Goodness!!!

                    It's working perfect or perfectly or whatever!


                    I was over the moon when I saw it working!

                    Properly working UES is all that takes to put me on cloud 9!


                    I mean I was having a really hard time because I couldn't do things what I wanted to do with my UES.

                    So, I was thinking of getting another text editor but I couldn't find anything better than UES/UE.

                    (But they must make UE/UES better because sometimes UE/UES can't run a little bit complicated regular expression while Notepad++ does well.)

                    I mean, I haven't used JavaScript for more than 5 years.

                    One of the best things with UE/UES, there is someone in the forum who gives the answer to a layman like me!

                    If there were no Mofi, I couldn't do much with UE/UES.

                    This forum really gotta take the cake! 

                    You know what? I emailed IDM computer solutions, Inc.

                    What I heard from them was this:


                    Thank you for your response and the additional information. I don't have Windows 10 Home Korean, but I did test what you've described on a Korean version of Windows 10 Enterprise and installed the Korean version of UEStudio v18.20.0.18. A simple "Hello world" script runs without any issues in my tests.

                    Please could you send us the script you're trying to run as a zipped attachment so I can test this using the exact same script you're using?


                    I just thought they had to take SOLUTIONS out of their company name. 

                    Just IDM Computer, Inc. would be enough, I think.



                    Thanks a million, Mofi.

                    I can't thank you enough!

                    I really appreciate it!

                    Once again, you are a life saver, Mofi!
                    bow.jpg (54.57KiB)

                    Grand MasterGrand Master

                      Feb 19, 2019#10

                      Well, support of IDM Computer Solutions, Inc. could only grope around in the dark like I before I saw your account name respectively the name of your user's profile directory with three Korean characters in Process Monitor logs. Nobody in Western European or North American countries would ever come on the idea to use non Windows-1252 characters for the user account. You have always made your account name unreadable or replaced it by a generic string for understandable reasons to keep it private, but the Unicode encoded account name was the important information we would have needed to find out why the script executions always failed on your computers.

                      However, problem is solved now and I learned a lot about how Windows handles user accounts with Unicode characters which could be helpful in similar use cases in the future.
                      Best regards from an UC/UE/UES for Windows user from Austria

                      Basic UserBasic User

                        Feb 20, 2019#11

                        Hi, Mofi.

                        I am so happy now.

                        All I can say is I can't thank you enough!

                        Well, I am doing my own business now.

                        I will send you our first product, which is a health functional food made of mushroom, as a token of my appreciation when it is out on the market 

                        It will take about 4 or 5 months, I think.

                        Once again, thank you so much.

                        I really appreciate it!

                        Sincerely, Jae. : )