Error with plugin Eneroth Open Newer Version

Toda vez que tento abrir um arquivo antigo no plugin Eneroth Open Newer Version aparece essa mensagem, ja tentei fazer de tudo e não consegui resolver!!

Uso um o windows 10 (64bits)
Sketchup Pro 2016
Plugin Eneroth Open Newer Version 1.0.8

1 Like

The system cannot find the temporary VBS script that Eneroth’s extension tries to write to the user TEMP folder.

@eneroth3

1 Like

Ok, sabe como eu resolvo isso?

A pasta se encontra nesse diretório, mas por algum motivo o programa não encontra!

1 Like

Estou com a mesma dificuldade. Alguém sabe resolver?

This fault is caused by the encoding of words like usuário in the path name. Ruby and Windows use two different encodings for these characters.

My suggestion is to download the Suforyou Save As SketchUp application which appears to work correctly.

1 Like

The user name starts with a capital U. The same happens if folder names in the path, too start with a capital U. Ruby, I understand, is case sensitive while Windows is not, and Ruby interprets /U as an escape sequence.

Anssi is correct.

For the record, I could also cause a failure by inserting the á chareacter into a foldername in the path to the executable file.

BTW, I am not the American National Standards Institute (not that it wouldn’t be prestigious). My first name ends with “ssi”. :laughing:

1 Like

It is actually "\uNNNN" (lowercase U) following a backslash, with hexadecimal character number, that is interpreted as a Unicode specification.

But some extension code downcases the whole path (the Sketchup::require method is an example,) which can lead to load errors like this shown above.

Interestingly, Sketchup::temp_dir returns a path with forward slashes which are not interpolated for escape sequences.
IE:

Sketchup.temp_dir
=> "C:/Users/Dan/AppData/Local/Temp"

Windows in use today is a version of NT (Network Terminal) and has always accepted network pathnames using forward slashes. But there may be still some API methods that spit out pathnames with backslashes. Extension coders need to be careful and convert double and single backslashes to a single forward slash in such strings:

path = path.gsub(/(\\\\|\\)/, '/')
1 Like

Long trip around the block today but I found a basic problem. The code was writting UTF-8 encoded strings that contained multibyte characters to a tempfile that was expecting only 8-bit characters.

Couple that with the fact that VBScript only allows two character encodings either ANSI or UTC-2 LE. Forcing us to find a way to write our data in a multibyte format.

Here’s what I believe works (I didn’t try any Japanese characters yet!)

Happy Holidays

 # Run system call without flashing command line window on Windows.
      # Runs asynchronously.
      # Windows only hack.
      #
      # @param cmd String.
      #
      # @return [Void].
      def self.system_call(cmd)
        # HACK: Run the command through a VBS script to avoid flashing command line
        # window.

        file = Tempfile.new(["cmd", ".vbs"],  binmode: true)
        #file.write("Set WshShell = CreateObject(\"WScript.Shell\")\n")
        #file.write("WshShell.Run \"#{cmd.gsub('"', '""')}\", 0\n")


        # Hack #2 - allow Unicode Characters in the file name and path (on windows 10)
        #   VBScript only recognizes two character encodings, i.e. ANSI, and UCS-2 LE
        #   We manually create a UCS-2 LE compatible file by writting the BOM followed by
        #   the ruby string (utf-8 encoded) reencoded as a utf-16le string
        #
        # Added Dec.13,2023 by S. Williams
        #
        str = "Set WshShell = CreateObject(\"WScript.Shell\")\n"
        file << "\xFF\xFE".force_encoding('utf-16le') + str.force_encoding('utf-8').encode('utf-16le')
        
        str = "WshShell.Run \"#{cmd.gsub('"', '""')}\", 0\n"
        file << str.force_encoding('utf-8').encode('utf-16le')
        
        file.close
        UI.openURL("file://#{file.path}")

        nil
      end

(1) We can transcode string data as it is written out using IO::write | File::write

(2) Why isn’t this being done in Ruby?

require 'win32ole'

shell = WIN32OLE.new('WScript.Shell')
shell.Run("#{cmd.gsub('"', '""')}\", 0\n")

Good morning Eneroth, first of all my compliments for the Newer version program, really useful… I have two computers with SketchUp 2020 installed; on the laptop everything works very well, but on the computer that I normally use after “Save as XXX(SU 2020).skp” the computer starts to think and the program freezes. The only thing left to do is close the program. This is probably a Windows issue, because this happens to me with any version of SketchUp installed on the same computer. Any ideas on how I can intervene to eliminate this behavior and make the program work? THANK YOU!