Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

AutoIt3Wrapper can not run Obfuscator if the SciTE.exe does not exists.


  • Please log in to reply
29 replies to this topic

#1 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 05:59 PM

Hi guys,
I just found out that the latest beta of AutoIt3Wrapper (v2.1.0.17) can not run Obfuscator if the SciTE.exe does not exists.
This is because of this condition in the source (lines 205-207 from http://www.autoitscript.com/autoit3/scit...ad/beta_SciTE4AutoIt3/AutoIt3W):

If Not FileExists($SciTE_Dir & "\SciTE.exe") Then    $SciTE_Dir = StringReplace(SendSciTE_GetInfo($My_Hwnd, $SciTE_hwnd, "askproperty:SciteDefaultHome"), "\\", "\") EndIf


The above code always returns empty string for me.

And the compiled version (12/12/2011 - v2.1.0.7) available here: http://www.autoitscript.com/site/autoit-script-editor/downloads/ also has this problem, even though it is under the "Included Utilities I’ve created for those running other editors:" statement.

I'm using the PSPad editor and I'm currently unable to use the latest AutoIt3Wrapper with Obfuscator. I'll try to tamper with its source and compile an EXE for temporary use, but an official fix would be appreciated. :)







#2 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 06:09 PM

Did you fix this by something like this after the shown files?

If Not FileExists($SciTE_Dir) Then     $SciTE_Dir = ".." & @ScriptDir EndIf

I am trying to keep the utilities portable...

Edited by Jos, 23 February 2012 - 06:10 PM.

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 9,557 posts

Posted 23 February 2012 - 06:14 PM

What I did when working with a portable version of AutoIt/SciTe/Etc. I modified the wrapper so that it wouldn't look in the registry for the scite folder's location, and used an environment variable that pointed to where I had it, because the thumb drive letter changes depending upon which computer I'm plugged into. Then modified the wrapper to use that environment variable as the location of the Scite folder.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#4 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 06:25 PM

I am assuming the directory structure and use that. In case that SciTE isn't found it will "ask" the running SciTE program.
In the above case, SciTE doesn't exists, so I have to assume that the Editor program directory is "one up" from the AutoIt3Wrapper directory.
Don't like that idea that you need to set an Environment variable before this works.

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#5 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 06:31 PM

I think the best way would be to add a compiler directive for the Obfuscator path. Maybe something like:
#AutoIt3Wrapper_ObfuscatorEXE=...

Because I usually put these tools in my AutoIt folder, instead of the editor folder.
Just a thought... :)

Edit: My temporary fix is just to comment these 3 lines, because they do not really matter to me.

Edited by dv8, 23 February 2012 - 06:33 PM.


#6 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 06:37 PM

So that means that the original value set is working for you and should be restored when SciTE.exe doesn't exists and SciTE not running:

Global $SciTE_Dir = _PathFull(@ScriptDir & "....")

Not going to add a directive for this and think it is fair that Obfuscator is assumed to be in the relative path of AutoIt3Wrapper in that way.

Jos

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#7 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 06:40 PM

Just give the current Beta a try....

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#8 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 06:44 PM

Yeap, the relative path works for me, but I had to look into the source to figure out where it expects the file to be.
It was only showing the "ObfuscatorObfuscator.exe" in the error message during the wrapping. But I guess now that it is set up correctly it should give the expected path in that error message.
Let me try the beta and I'll let you know... :)

#9 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 06:49 PM

Yes! ;)
Works like a charm! And displays the whole path in the error message so people will know where to put it...

Thank you VERY MUCH for the extremely fast reply and fix! You guys are amazing!
I just scheduled another small donation for tomorrow, when my paycheck arrives. :)

#10 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 9,557 posts

Posted 23 February 2012 - 07:04 PM

I am assuming the directory structure and use that. In case that SciTE isn't found it will "ask" the running SciTE program.
In the above case, SciTE doesn't exists, so I have to assume that the Editor program directory is "one up" from the AutoIt3Wrapper directory.
Don't like that idea that you need to set an Environment variable before this works.

This was done before the latest updates to the program, prior to the 3.3.8.0 release, because before that it wouldn't work if I had the program on a thumb drive.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#11 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 07:10 PM

This was done before the latest updates to the program, prior to the 3.3.8.0 release, because before that it wouldn't work if I had the program on a thumb drive.

Agree and that is one of the modifications in the latest versions of AutoIt3Wrapper to allow portability and running it from any directory or drive without the need to update the registry or config files.

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#12 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 07:44 PM

Hey guys, while I have you reading this topic, may I ask you the question that started all this Obfuscator adventure for me?
The main purpose for me to start using the Obfuscator was to have obfuscated source and hopefully be able to match the line number of the error message given by the compiled EXE with the obfuscated source.
This was suggested in this thread: http://www.autoitscript.com/forum/topic/134279-no-runtime-errors-but-compiled-exe-gives-error/page__view__findpost__p__965471

I just tried that approach and tested it by intentionally adding a buggy line in my code, and the error was reported on the 14111 line, but the buggy line in the obfuscated code is 14366. :)

So my main question that started this all was:
Is there any way I can get the final source code with all the includes added, just the way it is composed by the Aut2exe so I can find the error reported by the EXE file on the same line number?

I really hope someone can suggest a straightforward way to do that.

#13 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 9,557 posts

Posted 23 February 2012 - 08:12 PM

I think that may be related to lines that are continued on the line(s) below it, the program sees it as one long line while the code is written on several lines. So what that does is it pushes your error line down in the editor but not in the actual script as far as the interpreter sees it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#14 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 08:22 PM

Actually the reported line (14111) is above the actual line in the script (14366). And according to your theory it should be the other way around...
EDIT: Sorry, I just reread your post and saw I misunderstood you... Please disregard the above line.
I'm thinking, what good is the reported line number for, if there is no way you can actually match it, unless your script has only a few lines and no includes.
And since Aut2Exe is preparing this whole bunch of code before the actual compilation, why isn't there a compiler option to save a copy of this code to a file for error tracking purposes?
I don't have any knowledge about the internals of the compilers, so excuse me if this question seams silly to you. That's just my logic talking...

Edited by dv8, 23 February 2012 - 08:25 PM.


#15 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 08:27 PM

Run this on your script source generated by Obfuscator and see if the line number are correct now:


$SourceFileName = FileOpenDialog("Specify the file to be processed", @ScriptDir, "AutoIt3 Script (*.au3)", 3) If @error Then Exit ; $ScriptData = Fileread($SourceFileName) ;Merge Continuation line into one line $ScriptData = StringRegExpReplace($ScriptData, "( _rn)", "") $TargetFileName = StringReplace($SourceFileName,".","_N.",-1) FileDelete($TargetFileName) FileWrite($TargetFileName, $ScriptData) ConsoleWrite("> newfile: " & $TargetFileName & @crlf )

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#16 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 08:38 PM

Actually I just counted the "_"s at the end of the lines in it and they were exactly 255 (14366-14111) :)
But thanks for the script! I'll use it in the future. ;)
Thank you guys once again! I spent almost the entire day on these issues and finally I feel there is a progress here!
I appreciate your help!
If any of you finds himself in Plovdiv - Bulgaria, drop me a PM here and I'll be glad to meet you and buy you a lunch or dinner! ;) I'm serious!

#17 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 23 February 2012 - 09:28 PM

Jos,
Do you think you can consider adding a new /SILENT command line option in the wrapper to prevent the progress from popping up and taking the focus from the current window? :)
I've set up some BAT files to batch compile multiple scripts in the background and it is just annoying when these progresses start popping up and taking the focus while I'm typing or doing something else.
I really hope you find this suggestion reasonable. ;)

#18 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 23 February 2012 - 09:56 PM

Want fries and mayo with that? :)

Current Beta has the following addition:
- Added /NoStatus commandline option to suppress the Progress window.


Enjoy,
Jos

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#19 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 24 February 2012 - 05:59 AM

THANK YOU! You are the man! :)

#20 dv8

dv8

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 24 February 2012 - 06:32 AM

Guys I just wanted to let you know that the Donation page and button are currently nowhere to be seen on the site through the available links (except on the "AutoIt Tools: Logoff Screensaver" page). I had to do a search for "donation" in order to find the donation page.
You may want to fix that, because it may lower the number of donations for you...

Thank you, once again.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users