 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Sat Sep 09, 2006 3:20 pm Post subject: Wrapper for cheetah2.dll // xBase for AutoHotkey |
|
|
| cornell2 wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=21377#21377
Is there anyway I can get AHK to directly read excel (xls) files or ,dbf files (ie foxpro, dbase etc). and I mean directly read - without requiring me to convert to text or other format. (even better if I could also use index files too .. but that would be asking too much ; )
The easist thing would be a driver or function ... but alternatives where I could access a file and sort by a particular field, and directly access records ... this is the intention and need. |
| cornell2 wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=21411#21411
Yes, I am considering the comma delimted approach as an option. However, the ability to sort, index etc, and treat a file as random access would be kludgy at best.
Also - it is implied elsewhere that there is not much demand for this feature ... As a lifelong marketing person I implore the tech people here not to fall into that trap. Features don't become essentials or even in demand until consumers get a chance to see them up close and personal. As we say in the marketing field "Before they were available - no *consumer* ever asked for a microwave oven, VCR, PC or Television. But once they saw one - they had to have it".
If a DLL or other method of working with xls or database files were in AHK, I guarantee you it would start a whole new mini-industry using AHK ; ) |
| Chris wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=21438#21438
I like the idea of built-in ODBC support someday; but I lack the experience to code it. Another idea is a plugin DLL that would provide such support (I'd be a little surprised if there weren't already some stand-alone interface DLLs [other than ODBC] available for database access). |
| cornell2 wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=21456#21456
Thanks - maybe some enterprising AHK user here could one day add some "plug in" style support. A lot of people were suggesting other viable solutions but taking me completely away from AHK. (therefore its not really a solution to *this* problem).
There are certain solutions that (if I can speak for others), because they are very important to a smaller audience, many of us would be willing to pay a shareware like fee for such modules.
And now that functions are a part of AHK, maybe this just got easier for others to provide "plug-ins" or libraries. |
| AHKnow* wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=34261#34261
I think the ability to use personal databases like Access (.mdb), Dbase (.dbf), and Excel (.xls) are very useful.
This ability would be very useful for quiz, word games, dictionary, translation, etc... type programs.
I would also like to see AutoHotkey have some database features and connectivity built into it. |
| Chris wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=34318#34318
There is some tentative plan for this. However, it's my understanding that ODBC.dll can be called directly with DllCall. If you or anyone else has some ODBC programming knowledge, perhaps you could write an includable script that provides a set of easy-to-use ODBC functions. If no one else does this, I'll probably wind up doing it myself within the next 6-12 months (a long time, I know). |
| Rabiator wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=34328#34328
With the Windows Scripting Host and VBScript it is simple to access the contents of excel tables, without knowing anything about the structure of Excel files. VBSs can easily be controlled by AHK, e.g. with a CSV file as an interface. |
| PhiLho wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=76080#76080
A good point for Cheetah: already has lot of wrapper for various Basic idioms. It shows it is easy to make such wrappers, and these could be used as a base for an AutoHotkey wrapepr (like I did for GDI+).
....
Goyyah, if you try to do a wrapper for either database, I will help you, of course (I am mildly interested, after all...). But you need to do the homework first (learn the API, write the base code...). |
| PhiLho wrote: | http://www.autohotkey.com/forum/viewtopic.php?p=76402#76402
Yes, I think you should start a specific topic, as this one is becoming big.
Just add proper cross-referencing, of course...
I suggest you put the new topic in Ask for Help instead, as it is still AHK programming. Once you have working code, you will create one in Scripts & Functions section. |
_________________
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Sat Sep 09, 2006 3:46 pm Post subject: |
|
|
Dear PhiLho,
| Quote: | From Cheetah2 Doc:
Returning Strings from a Function
Some functions allow a string to be returned as the result of a function. For example, the xdbFieldValue function. In cases of the OLE version, the string is returned and assigned to the variable directly.
FieldValue$ = xdbFieldValue(dbHandle&, "CUSTID", 0)
The Nul Terminated version returns the address of the string data in memory. You will need to assign your string to this memory address based on the procedure used for your programming language. |
| Code: | | Country:=DllCall("Cheetah2\XDBFIELDVALUE_Z",Int,1,Str,"COUNTRY",Int,0) |
In the above line of code, the var Country should contain a character string like "INDIA" and whereas it contains some number like 9201645!
Okay! It is the memory address where the string data is available.
After three days of head banging on my desktop ( not the virtual one ) I am able to retrieve it with the following code:
| Code: | . . .
. . .
Country:=DllCall("Cheetah2\XDBFIELDVALUE_Z",Int,1,Str,"COUNTRY",Int,0)
Country:=ExtractStringData(Country)
MsgBox, % Country
Return
ExtractStringData(ByRef xdbVar) {
Loop {
Int:=*(xdbVar+(A_Index-1))
IfEqual,Int,0, Break
Inte=% Inte Chr(Int)
} Return Inte
}
|
You can easily guess that I have adapted it from your code here.
Please enlighten me on the right way of coding it! I am worried that the loop might go infinite!
One more thing .. Opening Cheetah4.dll (open source) in Dependency Walker reveals only two functions! Does it mean it is ActiveX?
How to identify whether a DLL is ActiveX?
Regards,  _________________
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Sun Sep 10, 2006 5:50 am Post subject: |
|
|
Here is some code to call two non-db commands from cheetah2.dll
| Code: | ; Requires cheetah2.dll to be in the same folder!
MemAdd:=DllCall("Cheetah2\XDBVERSION_Z")
Version:=ExtractStringData(MemAdd)
MsgBox, 0, Version / Copyright, % Version
MemAdd:=DllCall("Cheetah2\XDBTEMPFILENAME_Z")
Tempfile:=ExtractStringData(MemAdd)
MsgBox, 0, Unique Tempfile name, % Tempfile
Return
ExtractStringData(ByRef xdbVar) {
Loop {
Int:=*(xdbVar+(A_Index-1))
IfEqual,Int,0, Break
Inte=% Inte Chr(Int)
} Return Inte
} |
Please test it and comment on ExtractStringData().
Regards,  _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Sep 11, 2006 1:19 pm Post subject: |
|
|
Sorry, I couldn't answer this week-end, and today I was a bit busy playing with MySQL...
Didn't lost my time, as I will reuse a trick from these to get the strings:
| Code: | appTitle = Cheetah Test
hModule := DllCall("LoadLibrary"
, "Str", "C:\Program Files\UDev\CheetahDatabase\bin\cheetah2.dll")
If (hModule = 0)
{
MsgBox 16, %appTitle%, Can't load cheetah2.dll
ExitApp
}
versionPointer := DllCall("Cheetah2\XDBVERSION_Z")
length := DllCall("lstrlen", "UInt", versionPointer)
VarSetCapacity(version, length)
DllCall("lstrcpy", "Str", version, "UInt", versionPointer)
MsgBox 64, %appTitle%, Version / Copyright:`n%version%
tempFileNamePointer := DllCall("Cheetah2\XDBTEMPFILENAME_Z")
length := DllCall("lstrlen", "UInt", tempFileNamePointer)
VarSetCapacity(tempFileName, length)
DllCall("lstrcpy", "Str", tempFileName, "UInt", tempFileNamePointer)
MsgBox 64, %appTitle%, Unique Tempfile name:`n%tempFileName%
Return
| It was a good idea to show your problem with API functions working without database, as I could test easily.
I suggest, if you have a small (or not so small, I don't care) test database to share, to upload it so we can have the same data for tests.
Also perhaps share your code so far.
| Goyyah wrote: | One more thing .. Opening Cheetah4.dll (open source) in Dependency Walker reveals only two functions! Does it mean it is ActiveX?
How to identify whether a DLL is ActiveX? | Could be... What are these functions? _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Mon Sep 11, 2006 3:41 pm Post subject: |
|
|
Dear PhiLho,
| Quote: | | Sorry, I couldn't answer this week-end, and today I was a bit busy |
"Better late than never" .. I was worried that you had lost interest in supporting this wrapper!
Thanks for the code! Wonderful!
I knew my code was stupid .. But it did work , and paved way for me to proceed further.
Here is the modifed version of ExtractStringData() that will be called by many of the XDB? functions :
| Code: | ExtractStringData(xdbPtr) {
xdbPtrLen:=DllCall("lstrlen", UInt,xdbPtr)
VarSetCapacity(CharStr,xdbPtrLen)
DllCall("lstrcpy", Str,CharStr, UInt,xdbPtr)
Return CharStr
} |
| Quote: | | I suggest, if you have a small (or not so small, I don't care) test database to share, to upload it so we can have the same data for tests. |
Here is a very small (just 10 record) country.dbf.
You might want a portable DBFViewer.
You may download the zipped version of DBFViewer Plus [638K].
It is not so great .. but I am storing the wrapper in a DBF file . Here is a snapshot.
If Cheetah becomes popular here, I might want to automate HTML documentation.
| Quote: | | Also perhaps share your code so far. |
Sure! 60% complete .. Just a day or two .. I want to test all functions written so far .. I guess already the wrapper is fit enough to start writing a decent DB app.
| Quote: | | Goyyah wrote: | | One more thing .. Opening Cheetah4.dll (open source) in Dependency Walker reveals only two functions! Does it mean it is ActiveX? |
| PhiLho wrote: | | Could be... What are these functions? |
|
I mailed Mr.Paul Squires ( developer of Cheetah DLL ) a link to this topic and he kindly and quickly responded with the following mail:
| Quote: | Hi Suresh,
I no longer maintain Cheetah2. I released it as freeware last year. If you are attempting to interface to Cheetah via AutoHotKey then I suggest that you try it using Cheetah4. Cheetah4 is open source and is much better than Cheetah2 and it is the only source code that I will continue to develop. You also only have one function to deal with (xdbCheetah). You will need to write wrappers to perform what you need (e.g. xdbCreateDatabase, xdbSeek, etc...). I have already done this for the PowerBASIC and FreeBasic languages (Visual Basic is currently being worked on). You can model your wrappers after the existing PB and FB wrappers (they are found in the \include directory).
Cheetah4 makes it much easier to deal with strings. When you send a string to the DLL you simply specify the address of the string and its length. When Cheetah returns a string, it returns the memory address and length. This means that you don't have to deal with nul terminated strings or BASIC style BSTR strings.
Also, Cheetah4 is a traditional Windows 32-bit DLL. It is not an ActiveX DLL.
Hope this helps.
--
Best regards,
Paul Squires |
Simultaneously - I had also registered and requested at PlanetSquires forum and recieved an answer.
Regards,  _________________

Last edited by SKAN on Tue Sep 12, 2006 1:37 pm; edited 1 time in total |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Sep 11, 2006 4:20 pm Post subject: |
|
|
Thank you for the resources.
| Quote: | I no longer maintain Cheetah2. I released it as freeware last year. If you are attempting to interface to Cheetah via AutoHotKey then I suggest that you try it using Cheetah4. Cheetah4 is open source and is much better than Cheetah2 and it is the only source code that I will continue to develop. You also only have one function to deal with (xdbCheetah). You will need to write wrappers to perform what you need (e.g. xdbCreateDatabase, xdbSeek, etc...). I have already done this for the PowerBASIC and FreeBasic languages (Visual Basic is currently being worked on). You can model your wrappers after the existing PB and FB wrappers (they are found in the \include directory).
Cheetah4 makes it much easier to deal with strings. When you send a string to the DLL you simply specify the address of the string and its length. When Cheetah returns a string, it returns the memory address and length. This means that you don't have to deal with nul terminated strings or BASIC style BSTR strings. | Well, I took a look at the project.
It is written in PowerBasic, it seems... Not really a problem, but a bit surprising. I wonder if Cheetah2 used the same language.
I am a bit dubious on the ease of use of Ch4 over Ch2, at least in AHK...
Looking at the wrappers, I see that there is only once function that you feed with a structure describing what to do.
As you know, current handling of structures in AutoHotkey is still a bit uneasy (using SetInteger or the like), so there is no clear advantage here.
And for strings, if getting the lengths would avoid a call to lstrlen, that's not a paramount advantage.
Keep up the good work. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Last edited by PhiLho on Tue Sep 12, 2006 8:56 am; edited 1 time in total |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Mon Sep 11, 2006 4:50 pm Post subject: |
|
|
| PhiLho wrote: | I am a bit dubious on the ease of use of Ch4 over Ch2, at least in AHK...
Looking at the wrappers, I see that there is only once function that you feed with a structure describing what to do.
As you know, current handling of structures in AutoHotkey is still a bit uneasy (using SetInteger or the like), so there is no clear advantage here.
And for strings, if getting the lengths would avoid a call to lstrlen, that's not a paramount advantage. |
Thanks for the Info .. I will post the incomplete wrapper and a simple DB app soon.
Regards,  _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Sep 12, 2006 9:24 am Post subject: |
|
|
Just some additional thoughts on Ch2 vs. Ch4.
There are several ways to write a wrapper around an API (a DLL).
- What we usually do, just to see if it works: write linear code, calling this or that function with DllCall, checking results, etc. That's what I first did for the MySQL wrapper. To avoid in the long term, unless you are doing a "code this, run it and throw away" script.
- Write a thin wrapper around each function of the API, perhaps processing the arguments before the call (convert to Unicode, for example), making the call, and processing the result after the call (getting a string buffer, for example). Then use this super API like we would do in C.
- Write a thick wrapper, that can even use the thin one, that performs usual operations, hidding the grunt job. That's what I did in the MySQL wrapper with the MySQL_ProcessQueryWithResults. Of course, this one is just a quick hack for display, it should return the result in a way easier to handle by caller.
The advantage of the wrappers is that you define an API suited for the target language, here AutoHotkey: it should use the idioms and idiosyncrasies of the language to offer a familiar look.
Another advantage is that it hides the original API. So, hopefully, perhaps someday we would be able to switch from Ch2 to Ch4, changing only some code in the thin wrapper, but keeping the AHK API. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Tue Sep 12, 2006 6:47 pm Post subject: |
|
|
Many thanks for the suggestions, PhiLho.
I am working hard to develop an working example to post along with
incomplete wrapper..
Let me post the wrapper first .. I do not mind re-writing it from the scratch after considering .. er .. whatever you have said above
Best Regards,
PS: _________________
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Fri Sep 15, 2006 10:44 pm Post subject: |
|
|
Dear PhiLho,
Here is the first ever portable DB Application
written in AutoHotkey :
Visit the Webpage: The English Dictionary
The download size of the archive is a whopping 8.14 MB ,
but the compression ratio is good! The DB itself will be
more than 100 MB! 176086 word entries along with meanings!
Will eagerly await your valuable reply!
Regards,  _________________
 |
|
| Back to top |
|
 |
Roland
Joined: 08 Jun 2006 Posts: 244
|
Posted: Sat Sep 16, 2006 10:34 am Post subject: |
|
|
| Wow. Great work as always Goyyah! |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sat Sep 16, 2006 4:52 pm Post subject: |
|
|
Will try later, seems wonderful. You didn't needed much help, after all...
The Web page is nice, except the "Untitled Document", showing off it was made with some WYSIWYG software... I guess searching this title (and "Document sans titre", etc.) would bring lot of pages...  _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Sat Sep 16, 2006 5:31 pm Post subject: |
|
|
| Roland wrote: | | Wow. Great work as always Goyyah! |
Many thanks Roland
Dear PhiLho,
| You wrote: | | You didn't needed much help, after all... |
I do need .. Please look into the wrapper and give suggestions!
I am yet to code the Query part (the major functionality of Cheetah2)!
I do not want to code it before taking suggestions from you.
| You wrote: | The Web page is nice, except the "Untitled Document", showing off it was made with some WYSIWYG software... I guess searching this title (and "Document sans titre", etc.) would bring lot of pages...  |
I noticed it late ..
The web page had complex tables . So I moved the tables to a fair copy where I forgot to change the title .
That web page is actually the local help file available from Help > About in the GUI menu.
So I also have to change the HTML available inside the archive TED.ZIP.
| You wrote: | | Will try later |
Please take time .. But I need a critical assesment.
Regards,  _________________
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6223
|
Posted: Sun Sep 17, 2006 6:27 pm Post subject: FileAppend Alternative |
|
|
I find that FileAppend command is very slow and it is not feasable to call call it inside a loop that might have thousands of iterations.
Quite understandable, knowing the fact that it opens and closes the file for each & every instance of that command.
A DB application will require text reporting, so I experimented to see how fast things are with AHK+Cheetah combo ...
.. and I am not very happy with the results!
The experiment: DBF to CSV conversion
- The TARGET FILE was Words-CSV.txt which is EXCEL Compatible CSV listing of the total database.
The output size of the text file would be 15.24 MB and shall contain 176086 lines of text!
- The SOURCE FILE is WORDS.DBF which is a part of "The English Dictionary" demo project.
The size of the database exceeds 90 MB and contains 176086 records in total.
- My Computer system is an AMD Sempron / 1.4Ghz / 256 Mb RAM / 80GB SATA HDD
OS: Windows 2000 SP4 / FAT32 FS
The Results:
- With the conventional FileAppend command inside the loop - the script consumed a whopping 1hr 56m 12s
, the slowness might owe to the opening and closing of Words-CSV.txt 176086 times!
- I tried to avoid the opening/closing for every iteration by writing some dumb binary routines .. and not to my surprise the script consumed only 9m 34s .. much to my relief! This was quite acceptable for the given no of records! Back in 1993-94 Foxpro 2.6 for DOS would have taken the same amount of time with equilvalent code running on a 386.
- Out of curiosity, I tested equivalent Foxpro program to output the same file.. It took a mere 4.5s
- Dumbstruck, I rechecked the code for any missing optimisation! I had completely forgotten the SetBatchLines -1
. With that command included, the output was created in 4m 42s .. Much better, but still not fast enough!
The following are the scripts with which I conducted this experiment.
These scripts have to be run from the root folder of The English Dictionary
Conventional FileAppend method:
| Code: | hCheetah := LoadCheetahAPI() ; Load the Cheetah DLL
dbDebugMode(1) ; Turns DLL Debug mode on!
db1 := dbOpen("Database\WORDS.DBF") ; Opens DB & assign handle
ix1:=dbOpenIndex("Database\WORDS.IDX",db1) ; Opens Index & assigns handle
dbMoveFirst(db1,ix1) ; Goto the Top most record
FileDelete, Words.CSV1.txt
Begin_TC := A_TickCount
Loop, 1760 { ; 1760 is 1% of WORDS.DBF
Word := dbFieldValue(db1,"",1)
Type := dbFieldValue(db1,"",2)
Mean := dbFieldValue(db1,"",3)
Line = "%Word%"`,"%Type%"`,"%Mean%" ; Construct the Line
FileAppend, %Line%`n, Words.CSV1.TXT ; THE CONVENTIONAL METHOD
dbMoveNext(db1, ix1) ; Goto next record
}
End_TC := A_TickCount
dbClose(db1) ; Close the database
hCheetah := FreeCheetahAPI() ; Free the DLL
MsgBox % (End_TC-Begin_TC) / 1000
ExitApp
Return
#Include Include\Functions.ahk ; Supplementary functions
#Include Include\dbWrapper-0-61.ahk ; The wrapper for Cheetah2.dll |
Improvised Binary method of Text file writing:
| Code: | SetBatchLines, -1
hCheetah := LoadCheetahAPI() ; Load the Cheetah DLL
dbDebugMode(1) ; Turns DLL Debug mode on!
db1 := dbOpen("Database\WORDS.DBF") ; Opens DB & assign handle
ix1:=dbOpenIndex("Database\WORDS.IDX",db1) ; Opens Index & assigns handle
dbMoveFirst(db1,ix1) ; Goto the Top most record
FileDelete, Words.CSV2.txt
Begin_TC := A_TickCount
tx1:=TextOpen("Words.CSV2.txt") ; Creates/Opens TextFile & assigns handle
Loop, 1760 { ; 1760 is 1% of WORDS.DBF
Word := dbFieldValue(db1,"",1)
Type := dbFieldValue(db1,"",2)
Mean := dbFieldValue(db1,"",3)
Line = "%Word%"`,"%Type%"`,"%Mean%" ; Construct the Line
TextWrite(tx1, Line) ; THE BINARY METHOD
dbMoveNext(db1, ix1) ; Goto next record
}
TextClose(tx1) ; Close the Text File
End_TC := A_TickCount
dbClose(db1)
hCheetah := FreeCheetahAPI()
MsgBox % (End_TC-Begin_TC) / 1000
ExitApp
Return
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
; FileAppend Alternative -- Binary Routines
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TextOpen(Textfilename) {
Return DllCall("CreateFile",Str,TextFilename,Uint,4
, Uint,0, UInt,0, UInt,4, UInt,0, UInt,0)
}
TextWrite(txtHandle,txtStr="",NewLine=1) {
IfEqual,NewLine,1, SetEnv,txtStr, % txtStr . Chr(13) . Chr(10)
DllCall("WriteFile", UInt, txtHandle, Str,txtStr
, UInt,StrLen(txtStr), "UInt *",bytesWritten, UInt,0)
Return bytesWritten
}
TextClose(txtHandle) {
Return DllCall("CloseHandle", UInt,txtHandle)
}
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#Include Include\Functions.ahk ; Supplementary functions
#Include Include\dbWrapper-0-61.ahk ; The wrapper for Cheetah2.dll |
The help I require:
I need help to perfect the text appending binary functions [ TextOpen() TextWrite() TextClose() ] that I have written in the experiment code.
The loop calls dbFieldValue() - a wrapper to Cheetah's xdbFieldValue_Z() function which returns the result as a pointer to memory address. The ExtractStringData() is called by dbFieldValue() to retrieve the text string.. ExtractStringData() has to be scrutinised for any possible optimisation.
Please help!
Regards,
@Mr.Chris: Am I missing any piece of related information? _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Sep 18, 2006 10:00 am Post subject: |
|
|
Downloading TED.zip right now. It is a bit slow...
I don't mind getting it, but I would suggest to provide access to your wrapper library separately, so those interested by your Cheetah interface could skip the downloading of a large database.
You didn't changed the title of your page, do you have trouble updating it?
I don't know if you can gain lot of speed. You cannot compare an program run by an interpreted language with one made with a compiled language...
Even Lua, which is amongst the fastest interpreted languages (see, for example, comparison with JavaScript), is very slow compared to C programs.
Since you use native functions, most of the difference of time is in the loop handling by AutoHotkey: overhead of function calls, of string building, etc.
I can try and give some advices which, cumulated, can gain some seconds, but not much more.
For example, I remember a discussion of writing "Str" vs. Str.
I recall that using "Str" was faster, because the Str form cause a variable lookup, and before #NoEnv, it was slow because checking the environment. If you use #NoEnv, perhaps it is the reverse, we should make a test to be sure. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|