There are a few good tutorials with precise examples of working with AutoIt code. Several are already listed in the menu at http://dundats.mvps.org/autoit/ and I hope to soon add this one to the list.
http://403forbidden.dyndns.org/?page_id=26
Tuesday, May 25, 2010
Saturday, May 22, 2010
SQLite UDF
This is a great little library with only one minor drawback. The SQLite.au3 file #Includes File.au3 (Which I seldom use at all) all for the sake of a little 6 or 8 line function. Now what?
Simple, I'm going to copy that _TempFile() function into a new copy of SQLite.au3, give the function a new name, modify the calls to it with the new name, and then rename the SQLite.au3 file to SQLiteEx.au3. That will solve the issue and the file changes are very simple with a script doing all the work. I may even go so far as to make a copy of SQLite.dll.au3 and call it SQLiteEx.dll.au3 and make the asociated chnages for that as well. Yes there is a reason for doing it and I'll go into those details at a later time.
Simple, I'm going to copy that _TempFile() function into a new copy of SQLite.au3, give the function a new name, modify the calls to it with the new name, and then rename the SQLite.au3 file to SQLiteEx.au3. That will solve the issue and the file changes are very simple with a script doing all the work. I may even go so far as to make a copy of SQLite.dll.au3 and call it SQLiteEx.dll.au3 and make the asociated chnages for that as well. Yes there is a reason for doing it and I'll go into those details at a later time.
Sunday, May 16, 2010
_GUI Library functions
While I realize that it was a lot of work re-writing PaulIA's old library functions, the one thing I certainly don't appreciate is the lost functionality. They definitly needed work but at least the functions you needed were there.
I don't know who made the decision about what should be removed and what should simply be changed but somewhere along the way things got messed up. On top of that, most of the examples are total garbage. They simply don't apply to what the average user is going to need. I'm also very well aware that I'm not the only one that feels this way, not by a longshot and when it come time to prune down the size of the AutoIt install I'm very apt to suggest that they can all be removed since it's a total waste of time trying to work with them.
That's my gripe for today. Feel free to comment but I'm not in the mood to argue about them and if we get into an argument... you lose.
I don't know who made the decision about what should be removed and what should simply be changed but somewhere along the way things got messed up. On top of that, most of the examples are total garbage. They simply don't apply to what the average user is going to need. I'm also very well aware that I'm not the only one that feels this way, not by a longshot and when it come time to prune down the size of the AutoIt install I'm very apt to suggest that they can all be removed since it's a total waste of time trying to work with them.
That's my gripe for today. Feel free to comment but I'm not in the mood to argue about them and if we get into an argument... you lose.
Wednesday, May 12, 2010
Scripting for cash
There has been a suggestion recently that a forum where people could request a script and then people could bid to write that script for them with some of the proceeds going to AutoItScript.com. On the surface it would appear to be a good suggestion and is primarily the same as RentACoder. I'm not at all sure just how practical it would be in the end. There is a tremendous amount of potential for abuse and indeed even for malicious code to be inserted. In order for it to work as intended, I think it would require a lot of oversight by moderators as well as a registry of users who are able to code the scripts properly. Making it onto that list would require a high level of AutoIt skills and the code would then have to be checked by someone to make sure there is nothing malicious happening in it. Most of the forum moderators are already overburdened with their own work and their forum duties, so who is going to do all this moderating?
Then there is the question of payment.
Just what is the best way to go about making sure that everything is collected for and the proceeds properly apportioned? Can we trust everyone to collect and then forward the correct amount to AutoItScript.com or not? If not then again it takes someone to handle the bookwork and collections. Should there be a minimum charge for the service?
My last question for today is;
Does Jon want this type of service running as a part of the forums? It's really up to him and long discussions about how it could be incorporated and indeed whether or not it should be incorporated are moot at this point.
Personally, it is going to take a lot more thought and some input from Jon before I will decide whether or not to support such an undertaking.
Then there is the question of payment.
Just what is the best way to go about making sure that everything is collected for and the proceeds properly apportioned? Can we trust everyone to collect and then forward the correct amount to AutoItScript.com or not? If not then again it takes someone to handle the bookwork and collections. Should there be a minimum charge for the service?
My last question for today is;
Does Jon want this type of service running as a part of the forums? It's really up to him and long discussions about how it could be incorporated and indeed whether or not it should be incorporated are moot at this point.
Personally, it is going to take a lot more thought and some input from Jon before I will decide whether or not to support such an undertaking.
Thursday, May 6, 2010
PCRE Toolkit Question
I've been asked why the database for the libraries uses binary data. The answer is simple enough, because of some characters used in the Regular expressions, databases wouldn't play nicely so there were 2 possible solutions.
Another question.
Why can't I delete the Samples library? You can as long as it's not the default library. In order to do that, at least one other library must exist and you must change the default to a different library.
Whats in store for the next release? Hopefully I'll get rid of the Up/Down buttons and make it so you can move an item just by dragging it where you want it to go. I'm also considering having new libraries available for download at some point and that may be started in time for the next release. I'm also going to attempt to get at the much hated documentation.
Enjoy what there is and check back for changes.
You can either report bugs to me through a PM in the AutoIt forums or by leaving comments on this blog.
- Use Binary
- Escape the stored data
Another question.
Why can't I delete the Samples library? You can as long as it's not the default library. In order to do that, at least one other library must exist and you must change the default to a different library.
Whats in store for the next release? Hopefully I'll get rid of the Up/Down buttons and make it so you can move an item just by dragging it where you want it to go. I'm also considering having new libraries available for download at some point and that may be started in time for the next release. I'm also going to attempt to get at the much hated documentation.
Enjoy what there is and check back for changes.
You can either report bugs to me through a PM in the AutoIt forums or by leaving comments on this blog.
Labels:
PCRE,
PCRE Toolkit,
Regular Expressions,
Tester,
Tools
Monday, May 3, 2010
PCRE Toolkit Beta
Announcement:
The newest beta release of the toolkit is now available for download. Currently only available as an installer file. The source code is available by request only.
Available at
http://dundats.mvps.org/beta/pcretest.zip
Extract the Setup.exe file from the Zip and install it.
Stay tuned, there are yet more features in progress and I will update the file as they are completed.
What's new? too many things to list but for openers, the button to make the selected library item the current expression is now gone. Just double click the library item and it's taken care of.
Edit: Updated June 11, 2010 (mainly cosmetic)
Edit: Updated June 04, 2010
Now with a new tab for running commands using @ComSpec and reading the StdIO stream so you can check things like Ping 127.0.0.1
Edit: Updated May 19, 2010
Edit: Updated May 10, 2010
Download was updated May 06 /2010
Now with the ability to insert standard RegEx elements into your expression from the Expression>> Insert menus.
The newest beta release of the toolkit is now available for download. Currently only available as an installer file. The source code is available by request only.
Available at
http://dundats.mvps.org/beta/pcretest.zip
Extract the Setup.exe file from the Zip and install it.
Stay tuned, there are yet more features in progress and I will update the file as they are completed.
What's new? too many things to list but for openers, the button to make the selected library item the current expression is now gone. Just double click the library item and it's taken care of.
Edit: Updated June 11, 2010 (mainly cosmetic)
Edit: Updated June 04, 2010
Now with a new tab for running commands using @ComSpec and reading the StdIO stream so you can check things like Ping 127.0.0.1
Edit: Updated May 19, 2010
Edit: Updated May 10, 2010
Download was updated May 06 /2010
Now with the ability to insert standard RegEx elements into your expression from the Expression>> Insert menus.
Labels:
PCRE,
PCRE Toolkit,
Regular Expressions,
Tester,
Tools
Tuesday, April 20, 2010
How do I ask a question about regular expressions?
We are getting more and more regular expression questions being asked and people have a tendency to not give us enough details to work with. The best method is to post an example of the string you are working with and follow that with a list of the expected matches. If you are refering to web page html code then either give us a link to the page or post enough of the page that it includes all of the functional bits that you want to parse and that means some of the code on both sides of the element that you want to work with.
That gives us a starting point and you will usually get a working answer or an answer that is very close and only needs a bit of touch up to be what you want it to be.
That gives us a starting point and you will usually get a working answer or an answer that is very close and only needs a bit of touch up to be what you want it to be.
Wednesday, April 14, 2010
More on regular expressions
Regular expressions are a very powerful tool, but they require a very precise understanding of what they are expected to accomplish. Regexps are a way to express complex rules in a compact way, but there must be rules to direct their behavior. It's those rules that you have to take the time to learn, and it WILL take time. Should you use regular expressions for all string search functions. No, in general the native AutoIt string functions are faster than the regular expression method.
For example, you wouldn't use $sStr = StringRegExp("This is some string.", "(.+{7}", 1) when you can use
$sStr = StringLeft("This is some string", 7) to do exactly the same thing.
Now if it was a situation where for example the string contained digits that appeared at various locations in the string, the RegExp is better
$sStr = "This string 9085 contains digits at 7693 locations."
$sRtn = StringRegExp($sStr, "\d+", 3) will return both sets of digits
$sRtn = StringRegExp($sStr, "\d{3}", 3) will return the first 3 digits of each set
$sRtn = StringRegExp($sStr, ".*?(\d+).*", 1) returns the first set of digits
$sRtn = StringRegExp($sStr, ".*\D(\d+).*", 1) returns the last set of digits.
From this example you can see the power of SRE's compared to using native string functions. A couple of those examples would likely have to be run through several native functions or would be impossible using anything except a regular expression.
I general, if you can do it in one or two simple native functions then do it that way. If it's more complex, use the SRE.
I should also mention that when it comes to the speed differences, we are talking about micro-seconds in either case so it makes no noticeable difference unless you are doing hundreds or even thousands of iterations.
By the way, my new AutoIt regular Expression ToolKit is now ready for Beta testing so, if you want to help out, contact me through the AutoIt forums and the application is available here as a win32 installer in a zip file.
For example, you wouldn't use $sStr = StringRegExp("This is some string.", "(.+{7}", 1) when you can use
$sStr = StringLeft("This is some string", 7) to do exactly the same thing.
Now if it was a situation where for example the string contained digits that appeared at various locations in the string, the RegExp is better
$sStr = "This string 9085 contains digits at 7693 locations."
$sRtn = StringRegExp($sStr, "\d+", 3) will return both sets of digits
$sRtn = StringRegExp($sStr, "\d{3}", 3) will return the first 3 digits of each set
$sRtn = StringRegExp($sStr, ".*?(\d+).*", 1) returns the first set of digits
$sRtn = StringRegExp($sStr, ".*\D(\d+).*", 1) returns the last set of digits.
From this example you can see the power of SRE's compared to using native string functions. A couple of those examples would likely have to be run through several native functions or would be impossible using anything except a regular expression.
I general, if you can do it in one or two simple native functions then do it that way. If it's more complex, use the SRE.
I should also mention that when it comes to the speed differences, we are talking about micro-seconds in either case so it makes no noticeable difference unless you are doing hundreds or even thousands of iterations.
By the way, my new AutoIt regular Expression ToolKit is now ready for Beta testing so, if you want to help out, contact me through the AutoIt forums and the application is available here as a win32 installer in a zip file.
Monday, April 5, 2010
Where are they now?
Every once in a while I get to reminiscing and today was one of those days.
I was looking through the members list and suddenly realized that a lot of my old forum friends (if I had any) have just up and disappeared on me. Now that shouldn't be a surprise since I've been in the forums since 2003 but it seems that with few exceptions there is suddenly no posts from people you have come accustommed to seeing. here is a short list of people I would love to touch base with again. If you are on the list or have the contact information for anyone on the list then please let me know.
I was looking through the members list and suddenly realized that a lot of my old forum friends (if I had any) have just up and disappeared on me. Now that shouldn't be a surprise since I've been in the forums since 2003 but it seems that with few exceptions there is suddenly no posts from people you have come accustommed to seeing. here is a short list of people I would love to touch base with again. If you are on the list or have the contact information for anyone on the list then please let me know.
- CyberSlug
- SvenP
- ScriptKitty
- Helge
- tylo
- Holger
- PaulIA
Saturday, April 3, 2010
Bad replies
Yes we do get them once in a while and I'm as guilty as anyone at times. A common error is to post a reply without testing it as shown here from an actual quoted reply.
[quote]
Well where is the problem whe you know what you want to do ? : )
[code]
You can define the text you put into clip as variable and then write it to a file
[/quote]
Alright, here is what's wrong
According to the help file ClipPut() will return 1 for success and 0 for failure. That means that the variable $towrite will contain the value 1, NOT the the clipboard data so that line should have been written as
The FileOpen() should have a flag set to determine the mode, although it can be open in read plus one of the write modes simultaneously, so that should have been
Now why did I use $hFile? Because FileOpen() will actually return a handle to the file so it's better to use that handle instead of the actual file name or variable that contains the file name.
It goes without saying that a simple quick test would have shown the problem. Like I say, we all do it on occasion but really we should take a bit more care. The people we reply to generally are new to coding and may not see what will be obvious to the rest of us.
[quote]
Well where is the problem whe you know what you want to do ? : )
[code]
$towrite = ClipPut($yourdata)
FileOpen($file)
FileWrite($file,$towrite & @Crlf)
FileClose($file)
[/code]FileOpen($file)
FileWrite($file,$towrite & @Crlf)
FileClose($file)
You can define the text you put into clip as variable and then write it to a file
[/quote]
Alright, here is what's wrong
According to the help file ClipPut() will return 1 for success and 0 for failure. That means that the variable $towrite will contain the value 1, NOT the the clipboard data so that line should have been written as
ClipPut($yourdata)
$towrite = ClipGet()
$towrite = ClipGet()
The FileOpen() should have a flag set to determine the mode, although it can be open in read plus one of the write modes simultaneously, so that should have been
$hFile = FileOpen($file, 1) ;; here I'm using the append mode.
FileWrite($hFile, $towrite) ;; Better in this case would be FileWriteLine($hFile, $towrite)
FileClose($hFile)
FileWrite($hFile, $towrite) ;; Better in this case would be FileWriteLine($hFile, $towrite)
FileClose($hFile)
Now why did I use $hFile? Because FileOpen() will actually return a handle to the file so it's better to use that handle instead of the actual file name or variable that contains the file name.
It goes without saying that a simple quick test would have shown the problem. Like I say, we all do it on occasion but really we should take a bit more care. The people we reply to generally are new to coding and may not see what will be obvious to the rest of us.
Subscribe to:
Posts (Atom)