Professor_Bernd Posted January 23, 2021 Share Posted January 23, 2021 Hello @Jos. There may be a bug in AutoIt3Wrapper.au3 19.1127.1402.20: If the path to a custom script contains certain characters, e.g. "ö" or "à", an incorrect path is used for the macros @ScriptDir, @ScriptName and @ScriptFullPath: "C:\Users\<UserName>\AppData\Local\Temp\AutoIt3WrapperRunTmpFiles\test file u.au3" Correct path would be for example: "C:\Users\<UserName>\Desktop\test file ö.au3" Tested AutoIt3Wrapper versions: 19.1127.1402.0 - All right 19.1127.1402.18 - Error encountered 19.1127.1402.20 - Error encountered Can you test if it's a bug or if I did something wrong? Attached 2 sample files for testing. AutoIt3Wrapper tests 2021-01-23.zip Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2021 Developers Share Posted January 23, 2021 (edited) No sure what you mean so please provide a zip file with the required directory structure and files which I can run and see the issue as both attached scripts work fine for me when running them with AutoItWrapper v19.1127.1402.20. oh and that path change is correct as files a temporarely copied when containing an none standard ascii character: Quote 19.1127.1402.8 Fix for support of filenames containing special ascii characters too. Jos Edited January 23, 2021 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 No specific directory structure is required. You can unpack the two files wherever you want, e.g. in "D:\tests\". For AutoItWrapper v19.1127.1402.20 my result looks like this when I open the following files with SciTe and start them (F5): "D:\tests\test file a.au3" => "D:\tests\test file ö.au3" => 29 minutes ago, Jos said: ... as both attached scripts work fine for me ... Which paths are displayed for you? Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 39 minutes ago, Jos said: oh and that path change is correct as files a temporarely copied when containing an none standard ascii character: Does this mean that in SciTe now you always get a wrong path for @ScriptDir if the file path contains a certain character? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2021 Developers Share Posted January 23, 2021 So you are having an problem with this change ...right? If so: Please do me a fovor and show me an example and the steps to take to see this issue or else we are just trowing words at eachother. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 Here is an example script that should read a file (@ScriptDir & "\Hello world.txt") and output the content ("Hello, World!"). But this does not work, because @ScriptDir specifies a wrong directory. Unpack the zip into a folder of your choice. The unzipped folder should then contain: "Hello world.txt" and "test file ö 2.au3". Open the "test file ö 2.au3" in SciTe and start it with F5. An error is displayed because the "Hello world.txt" is not found. AutoIt3Wrapper tests 2021-01-23 b.zip Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 Here is a second example that is encountered more often. A key value is to be read from an ini file in the script folder. Unzip the file into a folder of your choice. The unzipped folder should contain: "test file ö 3.au3" and "test.ini". Open the "test file ö 3.au3" in SciTe and start it with F5. An error is displayed because the "test.ini" is not found. AutoIt3Wrapper tests 2021-01-23 c.zip Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2021 Developers Share Posted January 23, 2021 Understand the issue now that I introduced with that change... thanks for that! ...just need to rethink how this can be solved, but likely will have to copy the temp file into the original script directory..... stay tunned. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 (edited) 51 minutes ago, Jos said: Understand the issue now that I introduced with that change... thanks for that! Some things are hard to explain and I'm glad you understood what I meant. Thank you very much! How about this idea: Instead of copying the temp file to the temp folder and back to the script folder, wouldn't it be easier to create the temp file directly in the script folder? Then @ScriptDir would always show the correct path, right? What is the reason for creating the temp file? Can it perhaps only be created in RAM? Edit: Forget the last sentence, because then @ScriptDir would show a wrong path again. Edited January 23, 2021 by Professor_Bernd Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2021 Developers Share Posted January 23, 2021 1 minute ago, Professor_Bernd said: Instead of copying the temp file to the temp folder and back to the script folder, wouldn't it be easier to create the temp file directly in the script folder? Then @ScriptDir would always show the correct path, right? Don't think so as a subdirectory will give the same issue. I have made change to the logic so it will copy the temp script into the same directory as the original script to avoid issues like this. The scriptname will be converted to ascii charaters and prefixed by "_#@#@#_". These files will be recycled at the end of te run: +>12:53:08 Starting AutoIt3Wrapper (19.1127.1402.21) from:SciTE.exe (4.2.0.0) Keyboard:00020409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0413) CodePage:65001 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\jvdza\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\jvdza\AppData\Local\AutoIt v3\SciTE ->Main script copied to temp file because of unicode characters in one of the filenames: D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3 >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3 +>12:53:09 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. +>12:53:11 AutoIt3.exe ended.rc:0 +>12:53:11 AutoIt3Wrapper Finished. ->Recycled:D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3 >Exit code: 0 Time: 3.696 It obviously does mean that you always need write access to the scriptdirectory. See if this works now and not break anything else. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 12 minutes ago, Professor_Bernd said: How about this idea: Instead of copying the temp file to the temp folder and back to the script folder, wouldn't it be easier to create the temp file directly in the script folder? 4 minutes ago, Jos said: Don't think so as a subdirectory will give the same issue. Could it be that you read "directory" instead of "directly"? Because I meant it exactly the way you have solved it now. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 +>12:53:08 Starting AutoIt3Wrapper (19.1127.1402.21) from:SciTE.exe (4.2.0.0) Keyboard:00020409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0413) CodePage:65001 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\jvdza\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\jvdza\AppData\Local\AutoIt v3\SciTE ->Main script copied to temp file because of unicode characters in one of the filenames: D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3 >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3 +>12:53:09 AU3Check ended.rc:0 ; Can't you recycle the temp file already here, because AutoIt3.exe should be able to ; handle extended ascii characters, right? Then you could pass the file with the non-standard ; ascii characters in the path to AutoIt3.exe, which avoids further problems. >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. +>12:53:11 AutoIt3.exe ended.rc:0 +>12:53:11 AutoIt3Wrapper Finished. ->Recycled:D:\Users\jvdza\Downloads\AutoIt3Wrapper tests 2021-01-23 b\_#@#@#_test file u 2.au3 >Exit code: 0 Time: 3.696 Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 I see another problem if you create the temp file in the original script folder. What if there is a non-standard ascii character in the path before the file? So for example "C:\Users\Jörg\Desktop\AutoIt3Wrapper tests\test file.au3" The same is true if you use the user temp folder: "C:\Users\Jörg\AppData\Local\Temp\AutoIt3WrapperRunTmpFiles\test file.au3" Or does the problem exist only when there is a non-standard ascii character in the filename, not in the path? Musashi 1 Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2021 Developers Share Posted January 23, 2021 Agree ... so I need to revert to the previous version and use the original script during the RUN operation as you suggested. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 23, 2021 Developers Share Posted January 23, 2021 Ok ... next "try": New Beta is available which is a revert of the previous version and this time simply uses the original filename in the RUN function. Professor_Bernd and Musashi 1 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 23, 2021 Author Share Posted January 23, 2021 Tests performed with AutoIt3Wrapper.au3 19.1127.1402.21 - on Win 10 with user name WITHOUT non-standard ascii characters - on Win 7 with user name WITH non-standard ascii characters Using @ScriptDir works on both PCs. Thanks a lot! 👍 Why is the original script copied to a temp file at all if there is a non-standard ascii character in the name? What is achieved by this? In a post above I wrote that a non-standard ascii character can occur in the username. Then the character is also in the path to the folder where you copy the temp file, e.g. "C:\Users\Jörg\AppData\Local\Temp\AutoIt3WrapperRunTmpFiles\test file u 3.au3" What problems do you encounter then? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 24, 2021 Developers Share Posted January 24, 2021 This is the reason the files are copied when containing UTF/Special characters. Thanks for your feedback. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 25, 2021 Author Share Posted January 25, 2021 (edited) 20 hours ago, Jos said: Thanks for your feedback. Thanks for the link to the Topic Include file with regional special characters with UTF-8 ! Can you take a look at the following lines in AutoIt3Wrapper.au3 19.1127.1402.21? Line 550 If $ScriptFile_In <> "" And FileExists($ScriptFile_In And $Option <> "RunAdmin") Then ; <== parentheses Line 5939 to 5942 $IncludeFile = StringStripWS(StringMid(StringStripWS($Include_Rec, 3), 9), 3) Local $sIncludeFile = $IncludeFile ;~ ConsoleWrite(... $IncludeFile = StringStripWS($IncludeFile, 3) ; <= This line may not be necessary? Edited January 25, 2021 by Professor_Bernd Link to comment Share on other sites More sharing options...
Developers Jos Posted January 25, 2021 Developers Share Posted January 25, 2021 6 hours ago, Professor_Bernd said: Line 550 Mmm.. that looks indeed quite wrong and am surpriced that never caused issues. 6 hours ago, Professor_Bernd said: Line 5939 to 5942 I've clearely have been having some issue there with all those commented debug statements but would agree the firstline result should already strip what is needed. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Professor_Bernd Posted January 25, 2021 Author Share Posted January 25, 2021 Line 1326 to 1335 Func Run_the_Script($Init = 0) #forceref $Init ... If IsDeclared("Init") Then ; <== Is this not always True ... Else ; and the Else branch is never executed? ... Is it ok to show this possible errors? I hope it will be a help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now