Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/30/2015 in all areas

  1. martin

    Serial Port /COM Port UDF

    Although serial ports are disappearing, they can still be useful. Here is a COMMs UDF. It provides an easy way to use serial ports without the restrictions and problems some methods have. USB to serial is ok, binary data is ok. This UDF requires my comMG.dll which can be in either the script folder or the Windows folder by default, or in the path specified using the function _CommSetDllPath. Note the following shortcomings: the dll link below is 32 bit so it will not work with a 64 bit apps, but there is a 64 bit version in my post around 25th March 2018 for people to try. The strings and character functions are all AnsiChar. Functions in the UDF are _CommVersion _CommListPorts _CommSetPort _CommPortConnection _CommClearOutputBuffer _CommClearInputBuffer _CommGetInputcount _CommGetOutputcount _CommSendString _CommGetString _CommGetLine _CommReadByte _CommReadChar _CommSendByte _CommSendBreak; not tested!!!!!!!!!! _CommCloseport _CommSwitch _CommReadByteArray _CommSendByteArray _CommsetTimeouts _CommSetXonXoffProperties _CommSetRTS (NB these will not work if Hardware handshaking is selected because _CommSetDTR then these lines are controlled by the data being sent.) _CommSetDllPath _CommGetLineStates -------------------------------------------------------------------------------------------------------------------------------- Go to Download Page For Commgv2 Download includes the dll and udf. Most recent changes 28th March 2014 - dll V2.83 Correct error setting 6 data bits as 7. 11th March 2014 dll V2.82 Allow data bits of 4 to 8 instead of only 7 and 8. 19th August 2013 dll v2.81 removes some unwanted eroor message popups. Might not remove popups for some Windows versions. 27th September 2012 Correct error closing port. New version of UDF if V2.90, new dll is commg.dll V2.79. Thanks to tfabris. 18th January 2012 Corrected typo in UDF V 2.87, and uploaded as V2.88 Increased max baud allowed by the dll from 200000 to 256000. New version now V2.78 17th January 2012 Modified thesleep addition to _CommGetLine so that reading data is not slowed down. 14th January 2012 Corrected _CommReadByte in UDF. Added sleep(20) to while loop in _CommGetLine to reduce CPU usage 20th December 2011 UDF version 2.86. - Changed function GetByte so it returned the error string given by the dll. Dll version 2.77 - removed an unwanted erro message dialogue from GetByte function. (Thanks funkey) 4th December 2011 New dll and example versions. Dll function SetPort corrected because it was not using the parameters passed for DTR and RTS. The example was setting flow control incorrectly: the settings for hardware handshaking and XON./XOFF were reversed. 25th August 2011 corrected function _CommClosePort. Example corrected for setting parity and flow 22nd December 2013 (thanks to MichaelXMike) mgrefcommg CommgExample.au3
    1 point
  2. That would be '2^63-1' actually.
    1 point
  3. guinness

    RegEx course

    In the process of doing this course >> http://campus.codeschool.com/courses/breaking-the-ice-with-regular-expressions/
    1 point
  4. guinness

    RegEx course

    I meant I used two function calls and that second example wasn't there when I posted!
    1 point
  5. guinness

    RegEx course

    Okay, this is better... Local $sFilePath = 'H:\FirstFolderName\SecondFolderName\ThirdFolderName\File.ext' Local $iOccurrence = StringInStr($sFilePath, '\', Default, 2) If $iOccurrence Then $sFilePath = StringTrimLeft($sFilePath, $iOccurrence - 1) EndIf ConsoleWrite($sFilePath & @CRLF)As you can see, you still have a lot to learn =) Which is a good thing.
    1 point
  6. guinness

    RegEx course

    Here >> https://regex101.com/r/aG2gX0/1 What native function did you come up with please?
    1 point
  7. @SkythekidRS I am experimenting with TCP now, I will post a solution once I figure out the problem
    1 point
  8. guinness

    RegEx course

    Did you solve with native? As you said you can, which doesn't necessarily mean you did.
    1 point
  9. Try this: server.au3: TCPStartup() $ip='192.168.1.4' $listen=TCPListen($ip,4444) Do $socket=TCPAccept($listen) $data=TCPRecv($socket,1342177280) Until $data<>Null $op=FileOpen('khang.jpg',18) FileWrite($op,$data)client.au3 TCPStartup() $ip='192.168.1.4' $op=FileOpen('IMG_2474.JPG',16) $connect=TCPConnect($ip,4444) TCPSend($connect,FileRead($op)) TCPSend($connect,Null) FileClose($op) TD
    1 point
  10. Can you show us the full code used to send the picture? We can't help you without any code TD
    1 point
  11. @kcvinu in my case all working ok
    1 point
  12. guinness

    RegEx course

    PreExpand (see my signature) uses regular expressions for parsing an Au3 script file, though it's closed source, so I wouldn't expect you to know that. You can see the regular expressions I have created by looking at my coding sub-forum (see signature). So the course was a little too basic for me, though I wouldn't call myself a guru, but at least I understand look-ahead and look-behind (negative|positive). My advice is, if you can't solve a problem using native string functions, then it's quite difficult for you to solve with regex, because it's all about pattern matching.
    1 point
  13. 1 point
  14. SugarBall, Neither of those - this is the correct syntax: If (....) And (......) ThenM23
    1 point
  15. One If, use "and" for the expressions If ($a > $b) and ($c > $d) thenLook in the helpfile 'Operators'
    1 point
  16. You can get the window handle by using _IEPropertyGet ($oIE, "hwnd") : #Include <IE.au3> $oIE = _IECreate("https://www.autoitscript.com/forum") $hwndIE = _IEPropertyGet ($oIE, "hwnd") WinSetState($hwndIE, "", @SW_MINIMIZE)
    1 point
  17. guinness

    Awesome AutoIt Project

    If you remove the LICENSE, then it's not suggesting they're included under the MIT LICENSE.
    1 point
  18. replace the word properties with he file extension you want this command to be active. Not sure why you are using cmd and echo, but assume that is for testing. # Includer shortcut command.name.35.*.au3= command.35.*.au3="D:\AutoIt Works\EXEs\Includer_2.exe" user.shortcuts=\ Ctrl+Y|1135|
    1 point
  19. Er...heard of an array? Edit: Read the Eval doc, because it clearly states that Eval should be used with variables created with Assign. As you don't use Assign you SHOULDN'T be using Eval.
    1 point
  20. Use SciTEUser.properties instead of au3Properties file and add this : # 40 Includer shortcut command.40.*="D:\AutoIt Works\EXEs\Includer_2.exe" command.name.40.*=Includer shortcut command.shortcut.40.*=Ctrl+Y In my case, I need to use "40" but search for a command number who is not already used for you.
    1 point
  21. mikell

    Thousand Separator

    Yes, this is a typical exercise for regex I used it when learning the \G anchor $sInput = "1234567890.1234" $sOutput = StringRegExpReplace($sInput, '\G(\d+?)(?=(\d{3})+(\D|$))', '$1,') MsgBox(0, "", $sInput & @crlf & $sOutput)
    1 point
  22. MimiOne

    UDF SSH

    Dear fellow citizen. There are at least a bug: Impossible de ce connecté!! >>> Impossible de se connecter !!Commande a envoyé: >> Commande à envoyerCe sera déjà plus "propre" Kind regards
    1 point
  23. In this case the Style property returns an object. Try this to get the style of the text you selected: #include <Word.au3> Local $oWord = _Word_Create() If @error <> 0 Then Exit MsgBox(16, "Word UDF: _Word_DocOpen Example", "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $sDocument = "Test_Format.doc" Local $oDoc = _Word_DocOpen($oWord, $sDocument, Default, Default, True) If @error <> 0 Then Exit MsgBox(16, "Word UDF: _Word_DocOpen Example 1", "Error opening 'Test.doc'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox(64, "Word UDF: _Word_DocOpen Example 1", "Select range!") Local $oRange = _Word_DocRangeSet($oDoc, 0) ConsoleWrite("Selected Text: " & $oRange.Text & @LF) ConsoleWrite("Style of Selected Text: " & $oRange.Style.NameLocal & @LF)
    1 point
  24. $rmdr = Mod(22366435,20930) MsgBox(0,0,$rmdr)
    1 point
  25. twitchyliquid64

    LANChat

    Does this also work for TCP? (Although I doubt it) EG: $newcon = TCPconnect( "192.168.1255", 88) ???
    1 point
  26. jchd

    SQLite with password

    Radu, I have confirmation that the System.Data.SQLite dll is not only sqlite3.dll compatible, but also that the two extra functions for handling encryption (hence access) are the same than the classical one provisionned for payware SEE: Yes, you can just drop it in as a replacement for sqlite3.dll. You don't have to change a thing. You can also rename it sqlite3.dll if you don't want to change a line in your app. And if you just use it as a replacement for sqlite3.dll, it doesn't require .NET. The interface exposes two new functions sqlite3_key and sqlite3_rekey that are identical to the ones in SEE described here: http://www.hwaci.com/sw/sqlite/see.html So you're just a couple of wrapper functions away from starting your project, with a decently encrypted DB. Obviously the overall solution doesn't make the DB imune to attacks by powerful attackers, but it will stop casual users from reading/messing with your data. But wait: there is more after trying it myself: you don't even need to wrap those two functions yourself or have the maintainer (a cool guy ) of the SQLite UDF do it for you. You can use the pragmas mentionned on the page above. You can test it by yourself: download the Windows binary from the System.Data.SQLite webpage and launch that script in the same directory: #include <SQLite.au3> ; don't include sqlite.dll.au3 !!! _SQLite_Startup ("System.Data.SQLite.dll") ConsoleWrite(_SQLite_LibVersion() & @LF) _SQLite_Open("testcrypt.db") _SQLite_Exec(-1, "pragma key = 'Radu is happy!';create table if not exists test (id integer, val text);" & _ "insert into test values (1, 'abc');") Local $row _SQLite_QuerySingleRow(-1, "select * from test;", $row) ConsoleWrite($row[1] & @LF) _SQLite_Close() _SQLite_Shutdown()Take your favorite hex editor and look at what testcrypt.db looks like: white noise, nothing less. Hope you remember the key! The version available from the webpage is 3.6.16, so it's a bit outdated (no foreign keys, no backup API, some dark corner bugs). I can shortly provide a binary compiled with 3.6.23.1 (latest official release), coming from a trusted source. If you need it I can post it and/or instructions about how to compile it. The mud is clearing, isn't it?
    1 point
×
×
  • Create New...