xuzo Posted November 16, 2015 Author Posted November 16, 2015 If you try to write a variable to notepad - it must first exist. If you don't create the variable - it doesn't exist. If you want to write information to notepad, the information has to come from somewhere. Go figure!BTW - IV does not work.Step IV does work. The pop up message displays the correct variable, time after time, even if it's commented out.
Developers Jos Posted November 16, 2015 Developers Posted November 16, 2015 Your posted step IV will not work and error out on the MsgBox() as it doesn't know the value for $my_variable.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.
xuzo Posted November 16, 2015 Author Posted November 16, 2015 (edited) It works for me, I'm pretty sure I'm not clear as what I want done here...When I press F5, regardless if:Global $my_variable = "text"is commented or not.The pop up works and displays properly, there is an error in the console, but it doesn't affect the results I need.My goal is to declare at the top of the script, and be able to comment out the declaration, and still have work later in the script.Sorry...I'm sure I have all this wrong... !I'm trying to emulate the functionality of Vista Task studio, http://www.vtaskstudio.com/index.phpThat software lets you declare variables, and pause steps, then use them later.I have other ways to do this, I will simply save the variables in a separate text file, then write a new script and re-declare, something like that.Thanks to everybody, you can close this post, I give up! Edited November 16, 2015 by xuzo
czardas Posted November 16, 2015 Posted November 16, 2015 (edited) Depending on which version of AutoIt / SciTE you are using, and whether you run the script from the SciTE console, or not, the message may appear. AutoIt throws an error on the ConsoleWrite section afterwards. SciTE should throw an error immediately. Older versions of AutoIt had the option to ignore some warnings - this may still be possible (I'm not sure). The code in #IV is incorrect regardless. Edited November 16, 2015 by czardas operator64 ArrayWorkshop
minxomat Posted November 16, 2015 Posted November 16, 2015 Depending on which version of AutoIt / SciTE you are using, and whether you run the script from the SciTE console, or not, the message may appear. AutoIt throws an error on the ConsoleWrite section afterwards. SciTE should throw an error immediately. Older versions of AutoIt had the option to ignore some warnings - this may still be possible (I'm not sure). The code in #IV is incorrect regardless.Well SciTe shouldn't throw any error. Au3Check should catch it. I will answer every single PM, and you are free to ask anything anytime.
czardas Posted November 16, 2015 Posted November 16, 2015 Yeah, I know. Good point though. operator64 ArrayWorkshop
Guest Posted December 6, 2015 Posted December 6, 2015 (edited) If you don't want to declare the variable and still use it then it is "possible" but only if you are not going to change this "variable" later.This is the FAKE variable concept and I personally use it a lotI changed your non-working example ;Global $my_variable = "text" IniRead("IniFile.ini", "Storage", "Variable", "") IniWrite("IniFile.ini", "Storage", "Variable", $my_variable) Local $hWnd = WinWait("[CLASS:Notepad++]", "", 10) WinActivate($hWnd) send ($my_variable) To this:#AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/PE ; ^ Very important for this to work ;Global $my_variable = "text" ;^ This will not work. Global Const $my_variable = "test" ;^ This will work and when you compile the script, this variable will be deleted and will not declared + the script will work with no error. IniRead("IniFile.ini", "Storage", "Variable", "") IniWrite("IniFile.ini", "Storage", "Variable", $my_variable) Local $hWnd = WinWait("[CLASS:Notepad++]", "", 10) WinActivate($hWnd) send ($my_variable) What is happening here is that you use variable without declaring it only if you compile it through SciTE. When you compile it through through SciTE, this code is converted to this:IniRead("IniFile.ini", "Storage", "Variable", "") IniWrite("IniFile.ini", "Storage", "Variable", "test") Local $hWnd = WinWait("[CLASS:Notepad++]", "", 10) WinActivate($hWnd) send("test") What it does it just replace every "$my_variable" to its value - in this case "test" Edited December 6, 2015 by Guest
xuzo Posted December 30, 2015 Author Posted December 30, 2015 Been too busy but will try last solution, thanks?
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