qwert Posted November 9, 2014 Share Posted November 9, 2014 I use a couple of instances of #ForceDef to cover cases where variables aren't declared in a "proper order" within the script. The problem is that when I compile the script with the strip option on, the line is removed and the AU3 PreCheck fails. I solve things by inserting the #ForceDef line into the displayed MyScript Stripped.au3 result and then compiling that version. But that's an extra step I have to perform on every recompile. Should Au3Stripper leave #ForceDefs alone? Or is there a way to "force the ForceDefs"? Link to comment Share on other sites More sharing options...
BrewManNH Posted November 9, 2014 Share Posted November 9, 2014 You should only strip the file just before compiling the script to an exe. Is that when this happens or does it happen after stripping and then you manually compile it? If you're manually compiling the script after stripping it, don't run Au3Check on it, it should already have run on the script prior to stripping 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 XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! 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. 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 editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
qwert Posted November 9, 2014 Author Share Posted November 9, 2014 Thanks for your response. ... don't run Au3Check on it, it should already have run on the script prior to stripping it. . It is true that the script is fully vetted for errors before I compile. But I've never been certain whether or not ForceDef did something behind the scenes, like create placeholders for the referenced variables. If it's only invoking an "ignore" state, then what you're suggesting is the answer. Sound right? Link to comment Share on other sites More sharing options...
FaridAgl Posted November 9, 2014 Share Posted November 9, 2014 Well, I guess using #forcrdef is not a good idea because usually with a little extra effort the script could be written in a way which it won't need #forcedef at all. And about Au3Stripper, it's doing its job well, as #forcedef is a preprocessor directive, there is no reason for it to remain in the final compiled script. For now, you can compile your stripped script manualy, like what you are currently donig. http://faridaghili.ir Link to comment Share on other sites More sharing options...
Developers Jos Posted November 9, 2014 Developers Share Posted November 9, 2014 au3stripper is reading the #forceref defined variables, not the #forcedef, but when would that be needed? Can you show an example? 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...
qwert Posted November 9, 2014 Author Share Posted November 9, 2014 This just got confusing to me. au3stripper is reading the #forceref defined variables, not the #forcedef . Honestly, I never noticed #forceref. For my use of #forcedef, I have some rarely-used functions that I sometimes paste in at the end of a script to keep them out of the way. Sometimes, those functions declare Global variables that can be referenced by any calling script segment. Such variables always result in a "used before declared" notice. A #forcedef at the top of the main script takes care of those references and the script works. Although I can bypass the reference problem by skipping the last-moment check pass, I'm still curious why the Au3Stripper needs to even bother with removing them. Is it just programmed to remove all # statements? Link to comment Share on other sites More sharing options...
qwert Posted November 9, 2014 Author Share Posted November 9, 2014 For anyone following, I found an excellent explanation and example of #forceref: Indeed, I found that exact use in my scripts. It has been there so long that I no longer noticed it. Is there something similar for #forcedef? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 10, 2014 Developers Share Posted November 10, 2014 Although I can bypass the reference problem by skipping the last-moment check pass, I'm still curious why the Au3Stripper needs to even bother with removing them. Is it just programmed to remove all # statements? Guess I understand your issue now as au3stripper should leave that statement all together... 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