Valik Posted March 16, 2008 Share Posted March 16, 2008 Jos, you have to be careful trying to optimize like that. Consider the following code. It has side effects but from the sounds of your description, it will get stripped. Sure, in this case, the side-effect is trivial, but in some cases, it might not be: Global $g_sIni Global $unused = IniRead(GetIni(), "Section", "Key", "Default"); Will this be stripped? Func GetIni() If Not $g_sIni Then $g_sIni = @ScriptDir & "\My.ini" Return $g_sIni EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted March 16, 2008 Share Posted March 16, 2008 (edited) What I have done in the version available in the BETA directory is refine my test to ensure there is text between "=" and "(". Also added tests for common used functions that can be safely removed: "BitOR" , "Iniread" and "DllStructCreate" Any other will be left in the script. Have a go and see if that works for you. I tested that Beta on my azpro_verze.au3 and only 1 line wasn't removed (compared to older version): Global Const $tagREBARINFO = DllStructCreate("uint cbSize;uint fMask;hwnd himl") So your test for DllStructCreate isn't 100% perfect but it's much better than version before. EDIT: There is BUG in StructureConstants.au3 Global Const $tagREBARINFO = DllStructCreate("uint cbSize;uint fMask;hwnd himl") should be Global Const $tagREBARINFO = "uint cbSize;uint fMask;hwnd himl" So maybe this one line wasn't removed due to that BUG I will post it in BugTrac ... Edited March 16, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Developers Jos Posted March 16, 2008 Author Developers Share Posted March 16, 2008 I tested that Beta on my azpro_verze.au3 and only 1 line wasn't removed (compared to older version): Global Const $tagREBARINFO = DllStructCreate("uint cbSize;uint fMask;hwnd himl") So your test for DllStructCreate isn't 100% perfect but it's much better than version before.You were probably too fast downloading it... I updated it shortly after i posted because i saw the test for that has a CASE issue. 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...
Developers Jos Posted March 16, 2008 Author Developers Share Posted March 16, 2008 (edited) Jos, you have to be careful trying to optimize like that. Consider the following code. It has side effects but from the sounds of your description, it will get stripped. Sure, in this case, the side-effect is trivial, but in some cases, it might not be: Global $g_sIni Global $unused = IniRead(GetIni(), "Section", "Key", "Default"); Will this be stripped? Func GetIni() If Not $g_sIni Then $g_sIni = @ScriptDir & "\My.ini" Return $g_sIni EndFuncYea, there is a risk for "complex" Global statements but there won't be too many people scripting like that. I will remove the IniRead() from the tests anyways since that isn't used in standard Include files. Jos Edited March 16, 2008 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...
Zedna Posted March 16, 2008 Share Posted March 16, 2008 You were probably too fast downloading it... I updated it shortly after i posted because i saw the test for that has a CASE issue.JosYes. I downloaded it again and it's OK now.Thanks. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
wraithdu Posted March 17, 2008 Share Posted March 17, 2008 I could use some help if you don't mind. I've got AutoIt3 and SciTE4AutoIt3 setup portably on my USB harddrive. I've had to alter some paths and such in the SciTE config files, AutoItWrapper source, and SciTEConfig source. But I'm having problems with Tidy and Obfuscator. I can't seem to find where they get their path info from. For example, I get errors from Obfuscator that it can't find the include files. Tidy and Obfuscator don't have AU3 source files for me to alter accordingly. Is there anything I can do to get these working? Link to comment Share on other sites More sharing options...
Developers Jos Posted March 18, 2008 Author Developers Share Posted March 18, 2008 (edited) I could use some help if you don't mind.I've got AutoIt3 and SciTE4AutoIt3 setup portably on my USB harddrive. I've had to alter some paths and such in the SciTE config files, AutoItWrapper source, and SciTEConfig source. But I'm having problems with Tidy and Obfuscator. I can't seem to find where they get their path info from. For example, I get errors from Obfuscator that it can't find the include files. Tidy and Obfuscator don't have AU3 source files for me to alter accordingly. Is there anything I can do to get these working?Obfuscator uses the same logic as AutoIt3.exe to locate the include files and retrieves the Autoit3 location from the Registry: "HKEY_LOCAL_MACHINE\Software\AutoIt v3\Autoit", "InstallDir".Not sure what the issue with Tidy is since you didn't give any details about the issues you have.I have posted a script a while ago that enables you to run SciTE4AutoIt3 from an USBstick (JumpDrive) but it might need some updating.http://www.autoitscript.com/forum/index.ph...mp;hl=JumpDrive Edited March 18, 2008 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...
MHz Posted March 19, 2008 Share Posted March 19, 2008 Obfuscator uses the same logic as AutoIt3.exe to locate the include files and retrieves the Autoit3 location from the Registry: "HKEY_LOCAL_MACHINE\Software\AutoIt v3\Autoit", "InstallDir".Hmm, AutoIt3.exe does not behave like that AFAIK. If I copy AutoIt3.exe from the InstallDir to C:\ and also create test.au3 in C:\. Then execute AutoIt3.exe to run test.au3 or drag'n'drop the file onto the copied AutoIt3.exe, then I get a opening include error so AutoIt3.exe did not look into the registry to find the location of the include folder. Test.au3 and error output shown below. Test.au3#include <Constants.au3> Msgbox showing error --------------------------- AutoIt Error --------------------------- Line 2 (File "C:\test.au3"): #include <Constants.au3> Error: Error opening the file. --------------------------- OK --------------------------- Link to comment Share on other sites More sharing options...
Valik Posted March 19, 2008 Share Posted March 19, 2008 The text stating that the installer is necessary needs removed. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 19, 2008 Author Developers Share Posted March 19, 2008 Hmm, AutoIt3.exe does not behave like that AFAIK.Let me explain what I meant: Obfuscator does use the same logic as AutoIt3.exe as stated in the helpfile but obviously needs the initial startingpoint being the autoit3 program directory. That is retrieved from the registry.Hope that clearifies it. 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...
NELyon Posted March 21, 2008 Share Posted March 21, 2008 I'm having a little trouble with using the Beta with the latest SciTe on my USB Drive. When I start SciTE, I get a small message in the console: "Need to change au3.properties: BETA_AUTOIT = 0" So I go into au3.properties and change the value to a 1. All of the beta tools show up in my menu. They all work just fine (They execute the script under beta, etc) but then when I exit SciTe, I get the error message again, my previous session is wiped out, and the BETA_AUTOIT property is back on 0. The appropriate reg keys are there. Why is this happening? Link to comment Share on other sites More sharing options...
Developers Jos Posted March 21, 2008 Author Developers Share Posted March 21, 2008 I'm having a little trouble with using the Beta with the latest SciTe on my USB Drive.When I start SciTE, I get a small message in the console: "Need to change au3.properties: BETA_AUTOIT = 0"So I go into au3.properties and change the value to a 1. All of the beta tools show up in my menu. They all work just fine (They execute the script under beta, etc) but then when I exit SciTe, I get the error message again, my previous session is wiped out, and the BETA_AUTOIT property is back on 0. The appropriate reg keys are there. Why is this happening?This is a LUA script (AutoItTools.lua) that tests for BETA tools to be shown or not. Is the value for autoit3dir set correctly in the au3.properties file?How are you running it from an USB drive, using a script as I proposed a while ago to set the .au3 extention stuff or without any changes?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...
Developers Jos Posted March 21, 2008 Author Developers Share Posted March 21, 2008 Perhaps Obfuscator could use a switch to pass $(autoit3dir) to it?Added support for /autoit3dir as AutoIt3Wrapper does. It will now follow the following sequence to retrieve the AutoIt3 directory:- Commandline param /AutoIt3Dir- Check for Autoit in the same directory as Obfuscator- Check for Autoit in the ..\ relative to the Obfuscator directory.- Check for Autoit in the ..\..\ relative to the Obfuscator directory.- Check the registry for "HKEY_LOCAL_MACHINE\Software\AutoIt v3\Autoit", "InstallDir".Think that should cover it. 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...
MHz Posted March 21, 2008 Share Posted March 21, 2008 - Commandline param /AutoIt3Dir- Check for Autoit in the same directory as Obfuscator- Check for Autoit in the ..\ relative to the Obfuscator directory.- Check for Autoit in the ..\..\ relative to the Obfuscator directory.- Check the registry for "HKEY_LOCAL_MACHINE\Software\AutoIt v3\Autoit", "InstallDir".Thanks Jos!The search sequence looks very good and the /AutoIt3Dir switch is a nice addition. Link to comment Share on other sites More sharing options...
NELyon Posted March 21, 2008 Share Posted March 21, 2008 This is a LUA script (AutoItTools.lua) that tests for BETA tools to be shown or not. Is the value for autoit3dir set correctly in the au3.properties file?How are you running it from an USB drive, using a script as I proposed a while ago to set the .au3 extention stuff or without any changes?JosI messed around in the AutoitTools.lua file and got it to work. The problem was it was searching for ..\beta\{files here}, but the dir was ..\Beta\{files here}Linux makes everything case sensitive Link to comment Share on other sites More sharing options...
Valik Posted March 21, 2008 Share Posted March 21, 2008 Linux makes everything case sensitive Windows makes everything case insensitive thus leading people to be careless with directory names. The world would be a much simpler place for programmers if Microsoft didn't insist on doing everything their own way completely ignoring precedence in many cases. Link to comment Share on other sites More sharing options...
wraithdu Posted March 24, 2008 Share Posted March 24, 2008 Added support for /autoit3dir as AutoIt3Wrapper does. It will now follow the following sequence to retrieve the AutoIt3 directory:- Commandline param /AutoIt3Dir- Check for Autoit in the same directory as Obfuscator- Check for Autoit in the ..\ relative to the Obfuscator directory.- Check for Autoit in the ..\..\ relative to the Obfuscator directory.- Check the registry for "HKEY_LOCAL_MACHINE\Software\AutoIt v3\Autoit", "InstallDir".Think that should cover it. Thanks for this change! Makes things much easier now Link to comment Share on other sites More sharing options...
wraithdu Posted March 25, 2008 Share Posted March 25, 2008 @Jos If it's not too much trouble, could you update SciteConfig.exe with the same path search order for - $SciTE_Dir $autoit3dir as AutoIt3Wrapper and Obfuscator? That would complete the package I think. When do you think you will release the Obfuscator update you made BTW? Again, thanks for everything. Keep up the great work!! Link to comment Share on other sites More sharing options...
MHz Posted March 25, 2008 Share Posted March 25, 2008 If it's not too much trouble, could you update SciteConfig.exe with the same path search order for -The %Scite_Home% variable is the ideal way to switch Updatedefs and SciteConfig into portable mode (including Scite as a whole). I have modified versions that check if %Scite_Home% is set. If you set %Scite_home% to the same folder as $(SciteDefaultHome) then everything is searched from the $(SciteDefaultHome) directory including User.properties... This allows for a separate executable to launch Scite with %Scite_Home% set to portable mode (as previously mentioned) without changes to the properties files. Just thought it might be worth a mention.as AutoIt3Wrapper and Obfuscator? That would complete the package I think. When do you think you will release the Obfuscator update you made BTW?Scite4AutoIt3 Beta stuff. The link exists at the bottom of the Scite4AutoIt3 download page. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 25, 2008 Author Developers Share Posted March 25, 2008 @JosIf it's not too much trouble, could you update SciteConfig.exe with the same path search order for -$SciTE_Dir$autoit3diras AutoIt3Wrapper and Obfuscator? That would complete the package I think. When do you think you will release the Obfuscator update you made BTW?Again, thanks for everything. Keep up the great work!!I will have a look at SciTEConfig. The new Obfuscator version is available in the Beta directory: http://www.autoitscript.com/autoit3/scite/..._SciTE4AutoIt3/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...
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