Announcement

Collapse
No announcement yet.

Unicode Action Plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unicode Action Plugin

    Hello,

    I had some free time on my hands today, and decided to start coding a new action plugin. Here is the first release, very simple at this point (it may get some enhancements in the future - or not), but I think that it can help in a few cases.

    With this free action plugin, you will be able to import any Unicode or UTF-8 encoded text files into a string, which allows you to then process the information further using the Lua scripting engine. At the same time, the plugin allows you to save a string as a new Unicode or UTF-8 encoded text file.

    There are currently just two functions:
    Unicode.ReadToString(string Filename, string Encoding) and
    Unicode.WriteFromString(string Filename, string Text, string Encoding)

    Using the plugin, you may be able to read a Unicode text file directly, without having to convert it first with an external program, saving the converted file to disk and finally reading it into AutoPlay Media Studio (or Setup Factory, TrueUpdate or Visual Patch). The Unicode or UTF-8 encoded file will be converted into a ANSI (Latin-1) encoded string. Depending on the feedback, I might be going to add Unicode.ReadToTable(string Filename, string Encoding) and Unicode.WriteFromTable(string Filename, string Text, string Encoding) actions later, so the plugin would work similar to the standard TextFile actions.

    Here is the screen from the example project:

    The plugin and example project can be downloaded from my AMS page.

    Ulrich
    Last edited by Ulrich; 06-03-2009, 09:48 PM.

  • #2
    Nice one, This is something AMS should have always had.

    Comment


    • #3
      Thanks a lot

      Thanks, i've waited for this soooooo long, great and thanks again

      Comment


      • #4
        nice plugin, very useful, thanks :yes

        any plan to include a function that can convert a ANSI string to Uni string for sending unicode arguments to dll files?

        Comment


        • #5
          Nice, thanks, I agree with shadow lol
          Bas Groothedde
          Imagine Programming :: Blog

          AMS8 Plugins
          IMXLH Compiler

          Comment


          • #6
            WOW

            but, is posible add unicde.FileFind, Unicode.FileDoesExist, Unicode.FolderDoesExist, Unicode.SetLabelText (label, paragraf, button etc), Unicode.ReadINI actions?

            Or more better option; Unicode.StringConvert (for example conver one string with one path with one filename in unicode)

            Example:

            aa = INI.ReadValue(file, section, value (this in unicode or not))

            bb = Unicode.StringConvert(aa)

            result = Labet.SetText(namelabel, bb)

            THANKS
            Last edited by Tomasin; 06-04-2009, 06:47 AM.

            Comment


            • #7
              Ams6

              Maybe a stupid question, but would it be possible to use this plug-in with AMS6??

              I hope to hear from you

              Comment


              • #8
                Originally posted by Tomasin View Post
                Example:
                aa = INI.ReadValue(file, section, value (this in unicode or not))
                bb = Unicode.StringConvert(aa)
                result = Labet.SetText(namelabel, bb)
                This will not work. The unicode encoded string can not be passed along to the Lua environment. So, in your example, "aa" would already contain garbage, and there would be no way for Unicode.StringConvert() retrieve the ANSI equivalent of the original text. Instead, the plugin would need to read the INI file by itself, extract and convert the value to ANSI, so you could use it to set the text of the Label.

                Originally posted by Friethoe View Post
                Maybe a stupid question, but would it be possible to use this plug-in with AMS6??
                The plugin should work normally with AutoPlay Media Studio 6.0.

                Ulrich

                Comment


                • #9
                  I need find.files in my system, but if the filename contain unicode caracters AMS retuns "????"... and with this FIle.DoesExis not work.

                  If read one INI file for set text in specific label, button, paragraf, etc and the text contain unicode caracters, AMS not display the text (obvius... xD).

                  Comment


                  • #10
                    Originally posted by upeters View Post
                    This will not work. The unicode encoded string can not be passed along to the Lua environment. So, in your example, "aa" would already contain garbage, and there would be no way for Unicode.StringConvert() retrieve the ANSI equivalent of the original text. Instead, the plugin would need to read the INI file by itself, extract and convert the value to ANSI, so you could use it to set the text of the Label.

                    Ulrich
                    i take it the same goes for the DLL.CallUnicode

                    i have attempted to write a dll that calls the unicode dll but it dont work unless its compiled with unicode enabled and thats really not much help.

                    Comment


                    • #11
                      Originally posted by MicroByte View Post
                      i take it the same goes for the DLL.CallUnicode
                      i have attempted to write a dll that calls the unicode dll but it dont work unless its compiled with unicode enabled and thats really not much help.
                      Exactly. As you can't pass a string with Unicode encoding back to Lua, there is no way to use it as an argument for another function, like a call to a dll. I can use UTF-8 and Unicode inside the plugin, but I can't return the string with this encoding back to AMS (it would result in garbage, just like shown in the screen shot of the original post), it must be converted to ANSI first.

                      For very the same reason, File.DoesExist() is impossible, because if you expect the function to return something, the search criteria (the parameter) would need to be Unicode. And how would you pass the parameter in this encoding when Lua does not support it? So the simple workaround is: do not use Unicode in the filename, or check for the DOS 8.3 equivalent.

                      Ulrich

                      Comment


                      • #12
                        Please help

                        I still work with AMS6 and never worked with LUA. It's not available in my setting.

                        I think I don't use the right terms to find out how to get a lua -plugin into my AMS6.

                        Could someone guide me how to get things running, because I would really like to use this plugin (lua) with this great convertiontool for my projects.

                        Information would be very welcome

                        Comment


                        • #13
                          Originally posted by upeters View Post
                          This will not work. The unicode encoded string can not be passed along to the Lua environment. So, in your example, "aa" would already contain garbage, and there would be no way for Unicode.StringConvert() retrieve the ANSI equivalent of the original text.
                          You are mistaken sir. Lua handles strings as a plain char*, a pointer to an array of bytes (be them signed or unsigned doesn't matter in this case). You can easily send UTF-8 through it, though don't exceptany string manipulation to work for anything but ASCII, as AMS assumes ASCII. Since AMS uses the ANSI version of the Windows API you might get a way by converting to the current locale encoding and displaying, and if the text is in that locale boom native language display. To make it work you'd have to either replace the Lua engine or umm... replace the whole AMS API.

                          Comment


                          • #14
                            Originally posted by Friethoe View Post
                            I still work with AMS6 and never worked with LUA. It's not available in my setting.

                            I think I don't use the right terms to find out how to get a lua -plugin into my AMS6.

                            Could someone guide me how to get things running, because I would really like to use this plugin (lua) with this great convertiontool for my projects.

                            Information would be very welcome
                            Okay, found it, at last :o

                            Ulrich, thanks again!

                            Comment


                            • #15
                              I added two new functions to the plugin, now at version 1.0.2.0:

                              Unicode.ReadToTable(string Filename, string Encoding) and
                              Unicode.WriteFromTable(string Filename, table Text, string Encoding).

                              Ulrich

                              Comment

                              Working...
                              X