Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/17/2014 in all areas

  1. This is basically two functions (plus supporting infrastructure): _Xbase_ReadToArray($filename, Byref $array, [...]) _Xbase_WriteFromArray($filename, Byref $array, [...]) that transfer all data from one container to the other. Various optional formatting parameters are detailed in the Remarks section of the script; a small test script plus dbf test file (the latter from the (free) Harbour distribution, see here) are provided for your entertainment. Note that the $array variable has to exist already, as it's parsed ByRef, but it does not have to have the correct dimensions. This is pure AutoIt (no SQL, no ADO, no dlls, no external dependencies). The Xbase specification was gleaned from here. There is no support (either currently or planned) for a GUI, or additional functionality; it's just a simple data interface I needed for my MatrixFileConverter for Eigen4Autoit (link in signature), that might be of use to others (see MatrixFileConverter.au3 for an implementation example). One thing to keep in mind is AutoIt's array size limitation (16 MB elements); Xbase files can be considerably larger. On the other hand, AutoIt arrays are less restricted in their number of columns than (certain versions of) Xbase (see script for details). Appropriate error messages will inform you when you've hit these buffers. Xbase.v0.8.7z third beta release
    2 points
  2. mikell

    Splitting string

    Right. For the fun AND for the apple
    2 points
  3. Melba23

    Pixel color click

    Pandacyber, You appear not to have read the Forum rules since your arrival. Please do read them - particularly the bit about not discussing game automation - before you post again. M23
    2 points
  4. trancexx

    WinHTTP functions

    The other day mikeytown2 posted one post in HTTP UDF's thread that got me thinking if there is better (different) method to send requests through the HTTP protocol to HTTP servers. There is Winhttp.dll that ships with windows and that is its main purpose. I couldn't find any examples of using this dll in AutoIt, so I came up with this. Microsoft about Windows HTTP Services: Microsoft Windows HTTP Services (WinHTTP) provides developers with an HTTP client application programming interface (API) to send requests through the HTTP protocol to other HTTP servers... .. blah, blah, and so on... This is an example of getting page header: #include "WinHttp.au3" Opt("MustDeclareVars", 1) ; Open needed handles Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, "msdn.microsoft.com") ; Specify the reguest: Local $hRequest = _WinHttpOpenRequest($hConnect, Default, "en-us/library/aa384101(VS.85).aspx") ; Send request _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) Local $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header ; Clean _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Display retrieved header MsgBox(0, "Header", $sHeader)Everything you need to be able to use this UDF can be found at WinHttp site. Remember, basic understanding of the HTTP protocol is important to use this interface. ProgAndy, trancexx WinHttp.au3 is completely free and no one has right to charge you for it. That's very important. If you feel WinHttp.au3 was helpful to you and you wish to support my further work you can donate to my personal account via PayPal address: trancexx at yahoo dot com I will appreciate that very much. Thank you in advance! :kiss:
    1 point
  5. czardas

    Splitting string

    I like the part about eating an apple.
    1 point
  6. mikell

    Splitting string

    For the fun #Include <Array.au3> Local $sText="Test text- - ,do-what-ever-you-want ,eat-apple ,write sug-" & @CRLF & "gestion and work hard" & @CRLF & "alot" $aArray = StringSplit(StringRegExpReplace(StringRegExpReplace($sText, '\R|-(?=\w)', " "), '-\h+', ""), ',') _ArrayDisplay($aArray)
    1 point
  7. czardas

    Splitting string

    I'm glad you liked that version. AutoIt is so rich with methods and I'm often surprised by things myself. Simple solutions are usually the best and also fundamental to learning. Sometimes there are many factors to consider and a more complicated solution is required. The code I posted is not able to differentiate between a genuine word split and a hyphenated word interrupted by a line break. There is no general solution for that, as far as I know.
    1 point
  8. mohamad

    Splitting string

    That's amazing ,i never thought such thing could be possible. this helped me alot,thanks!
    1 point
  9. czardas

    Splitting string

    Oh, I wrote something a little more complicated. It checks that the hyphen dash is part of a split word, or not, before joining. It also ignores multiple spaces and line breaks. ; Local $sText="Test text- - ,do-what-ever-you-want ,eat-apple ,write sug-" & @CRLF & "gestion and work hard" & @CRLF & "alot" Local $aArray = StringRegExp(StringRegExpReplace($sText, "(?i)(?<=[a-z])\-\r\n(?=[a-z])", ""), "\S+", 3) _ArrayDisplay($aArray) :; Or with the item count added. Local $sText="Test text- - ,do-what-ever-you-want ,eat-apple ,write sug-" & @CRLF & "gestion and work hard" & @CRLF & "alot" Local $aArray = StringRegExp(StringRegExpReplace("? " & $sText, "(?i)(?<=[a-z])\-\r\n(?=[a-z])", ""), "\S+", 3) $aArray[0] = UBound($aArray) -1 _ArrayDisplay($aArray) ; It's the same approach as Melba23, but a little more fussy.
    1 point
  10. Melba23

    Splitting string

    Mohamed, How about this: #include <Array.au3> Local $sText = "Test text- - ,do-what-ever-you-want ,eat-apple ,write sug-" & @CRLF & "gestion and work hard" & @CRLF & "alot" $sText = StringReplace(StringReplace($sText, "-" & @CRLF, ""), @CRLF, " ") Local $aArray = StringSplit($sText, " ") _ArrayDisplay($aArray) M23
    1 point
  11. [NEW VERSION] - 13 Oct 14 Added: You can now decide whether to delete or retain the items dragged to another ListView. So that the user can prevent items being dragged back into the ListView if they were not deleted and so creating multiple entries, this change has also forced the change in behaviour below. Changed: The ability to prevent external drag and drop operations has now been split into separate drag/drop parameters. This is script-breaking if you had previously blocked ListViews from external drag/drop operations - but as it only involves adding another value to the $iAdded parameter it is not difficult to fix. Thanks to nobbitry for the suggestion. New UDF in the first post. M23
    1 point
×
×
  • Create New...