Jump to content

Regular Expressions


piccaso
 Share

Recommended Posts

:)

oh no!

i didnt know that nativ reglular expressions where in development.

no i'm no genius, here is the source for _regex.dll

#COMPILE DLL
#TOOLS OFF
#OPTION VERSION3 ' Windows NT3 and up (NT4/2K/95/98/ME/XP)

FUNCTION Regexp ALIAS "Regexp" ( _
                                regexmask AS ASCIIZ PTR, _
                                regexmain AS ASCIIZ PTR, _
                                regexstart AS LONG, _
                                BYREF regexipos AS LONG, _
                                BYREF regexilen AS LONG _
                             ) EXPORT AS STRING
    regexipos = 0
    regexilen = 0
    REGEXPR @regexmask IN @regexmain AT regexstart TO regexipos , regexilen
END FUNCTION

Just using Regex from power basic, nothing special.

I nedded Regular Expressions so i found a way...

i just took a peek into nutsters thread in the dev forum, you just cant compare nutsters work to mine ...

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

I just took a peek into Nutster's thread in the dev forum.  You just cant compare Nutster's work to mine ...

<{POST_SNAPBACK}>

So yours is sooo much better, is that it? :) I will see what is in the .zip file and see if I can use any of the ideas, but I am trying to get what I have right now working first. More ideas get implemented later.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

@Nutster

you dont get the point (or its my bad english) :)

my work (_regexp.dll) was easy done.

but you are implementing native regular expressions, i dont even know where to start when it comes to parsing the pattern :)

i doubt that my code can inspire you.

but you could take a look at pcre (Perl Compatible Regular Expressions) , i think its open source (Search sf.net for it) or the source of the ereg* functions of php...

Were not having a contest here.

My implementation might be Fast, Stable and Ready to use but i'm sure you will catch up soon.

And even if i spend time working on it it will never be native and will hang around in a dll forever ... :">

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

@picasso

I understand that you aren't trying to compete with Nutster, but what you did is still a useful implementable solution. Be proud of your accomplishment. There is a lot to be said about making advanced functionality external instead of embedding everything nativly. If I write a basic automation script why should I take the performance and resource hit of a RegEx parser? I am not trying to diminish the importance of Nutsters work at all but it is still pretty spectacular having the functionality. This is the true strength of having DllCall in AutoIt. Scalabilty is a key feature looked for in languages today whether for scripting or compilation. You provided a single example of how to do things without begging the developers for it. Good Job!

*** Matt @ MPCS

Link to comment
Share on other sites

Updated !

added a new function: _EnumWindowsTitles()

i decided to make this dll (+wrapper) a function toolbox to aid in finding Window Names/Handles using Regular expressions on Window Title or Text and pids

next step will be a function Returning Window Names and Pids.

function is done, just have to find a way to pass it back to autoit

i'm stuck with titles for now, the api returns numeric (DWORD) representation of hWnd ;) any idea how to translate ?

(just hex()ing them doesent work :) )

My implementation might be Fast, Stable and Ready to use

This only stands for the Regexp function :)
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

i did it :)

now you can get a nice list like

1 Pid: 1360 Title: Startmenü
2 Pid: 1360 Title: SysFader
3 Pid: 672  Title: NetDDE Agent
4 Pid: 1212 Title: AutoIt v3
5 Pid: 1556 Title: C:\Programme\AutoIt3\projekte\Dll\Regex\_regexp.au3 - SciTE [3 of 3]
6 Pid: 1112 Title: AutoIt Forums -> Antwort zum Thema: Regular Exp[b][/b]ressions - Mozilla Firefox
7 Pid: 1360 Title: C:\Programme\AutoIt3\projekte\Dll\Regex
8 Pid: 1100 Title: C:\WINDOWS\system32\cmd.exe
9 Pid: 1112 Title: Downloads
10 Pid: 1588    Title: PowerBASIC Compiler for Windows IDE - [C:\Programme\AutoIt3\projekte\Dll\Regex\_regexp.bas]
11 Pid: 1588    Title: Super Utilities
12 Pid: 1112    Title: Java Sys Tray
13 Pid: 1112    Title: theAwtToolkitWindow
...
...
...

example use included

source of dll included this time (forgot bevore)

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

i did it :)

now you can get a nice list like

1 Pid: 1360    Title: Startmenü
2 Pid: 1360    Title: SysFader
3 Pid: 672    Title: NetDDE Agent
4 Pid: 1212    Title: AutoIt v3
5 Pid: 1556    Title: C:\Programme\AutoIt3\projekte\Dll\Regex\_regexp.au3 - SciTE [3 of 3]
6 Pid: 1112    Title: AutoIt Forums -> Antwort zum Thema: Regular Exp[b][/b]ressions - Mozilla Firefox
7 Pid: 1360    Title: C:\Programme\AutoIt3\projekte\Dll\Regex
8 Pid: 1100    Title: C:\WINDOWS\system32\cmd.exe
9 Pid: 1112    Title: Downloads
10 Pid: 1588    Title: PowerBASIC Compiler for Windows IDE - [C:\Programme\AutoIt3\projekte\Dll\Regex\_regexp.bas]
11 Pid: 1588    Title: Super Utilities
12 Pid: 1112    Title: Java Sys Tray
13 Pid: 1112    Title: theAwtToolkitWindow
...
...
...

example use included

source of dll included this time (forgot bevore)

<{POST_SNAPBACK}>

This is a very good example how to add functionality to AutoIt with your favourite language. There is no need to include everything as internal function. Maybe we will start sharing UDF's and also dll's in 'Scripts & scraps' section? God I love dllCall and the possibilities that come with it...

Good work!

Link to comment
Share on other sites

Just a small suggestion: perhaps you could add the lincecount-function into this library.

Sorry, forgot the exact name of the command and have no access to PB here...something like CountLines, LineCount or such. Returns simply the number of lines which a given file contains, and it is of course somewhat faster than the UDF function :)

Best regards,

Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

The window functions where useless... (removed) :)

you can use GetWindow and GetWindowThreadProcessId directly from autoit using dllcall... (kept a copy http://www.autoitscript.com/fileman/users/public/piccaso/_regexp.old.zip)

upxed the dll, its only 6kb now ;)

@marc

do you mean FILESCAN ?

... probably, it counts lines quickly :D

i dont think it fits in here.

im working on a lib containing md5,rc4 and base64 functions which will be done soon, i'll append it there if you want, or do you want it in a seperate dll ?

@nutster

still pissed? :)

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

@this-is-me

http://www.autoitscript.com/fileman/users/public/piccaso/md5.dll

use it like

$r = DllCall("md5.dll", "str", "GetMD5FromFile", "str","C:\windows\regedit.exe")
or
$r = DllCall("md5.dll", "str", "GetMD5FromString", "str","lol")

$r[0] will be the hash

GetMd5FromFile doesent check if file is accessable.

if file access fails it returns a hash of an empty string (d41d8cd98f00b204e9800998ecf8427e)

dont know how long the string can be that is passed to GetMD5FromString, but let me know if you find out...

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...