zfisherdrums Posted June 28, 2007 Share Posted June 28, 2007 (edited) Looking at opportunities to port an existing test framework over to AutoIt from WinRunner. I noticed that several WR scripts used a reload statement to load constants into memory.I have not seen anything like this in the forum, and the following experiment failed:test.au3#include <File.au3> Func CallScript( $path ) Local $script _FileReadToArray( $path, $script ) If IsArray( $script ) = 0 then ConsoleWrite( "Not an array" & @CRLF) return false EndIf For $i = 1 to $script[0] Execute( $script[$i] ) Next EndFunc CallScript( "readme.au3" ) ; IsDeclared returns 0. ConsoleWrite( IsDeclared( "$a" ) & @CRLF)readme.au3$a = "Hello World"Maybe this is not possible and declaring the constants in an include would not be a horrible work-around. If I was dead set, I guess I could parse the called script, split the lines and pass the elements to Assign(). But smarter people than I lurk here; any more elegant suggestions? Edited June 28, 2007 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 28, 2007 Share Posted June 28, 2007 Looking at opportunities to port an existing test framework over to AutoIt from WinRunner. I noticed that several WR scripts used a reload statement to load constants into memory.I have not seen anything like this in the forum, and the following experiment failed:Maybe this is not possible and declaring the constants in an include would not be a horrible work-around. If I was dead set, I guess I could parse the called script, split the lines and pass the elements to Assign(). But smarter people than I lurk here; any more elegant suggestions?Loading constants into memory is not the same thing as assigning them to variables. More likely they are stored in an array or even some kind of database object.What about #include<> is "a horrible work-around"? Ever heard of GuiConstants.au3? Seems to work very well! Anyway, if there is some reason you can't use an array or #include, you might take a look at a scripting.dictionary instead of variables.I would just go with an #include, but that's me... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
zfisherdrums Posted June 28, 2007 Author Share Posted June 28, 2007 PsaltyDS,Thanks for the quick reply!More likely they are stored in an array or even some kind of database object.You're right, they were using a database object.What about #include<> is "a horrible work-around"? Ever heard of GuiConstants.au3? Seems to work very well! I believe I said it would NOT be a horrible work around. And yes, I have heard of GUIconstants.au3. Anyway, if there is some reason you can't use an array or #include, you might take a look at a scripting.dictionary instead of variables.I really like your idea and implementation here. I'll give it a spin. Thanks again. Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... 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