Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/04/2014 in all areas

  1. Jon

    autoit 3.3.10.0 is HUGE

    AutoIt compiled with static runtimes: 850KB   AutoIt compiled with dynamic runtimes: 650KB (needs external VC DLLs)   PCRE engine DLL size: 150KB (Full unicode mode)   Total pure AutoIt code minus runtimes and PCRE: 500KB   Let's say we need half of that even for a "no functions" version of AutoIt because of internal classes/utility functions/COM, etc: 250KB.   That gives us a window of 250KB that is available for funtion-level optimization. I don't think I'll be using my very limited dev time for trying to save a couple of hundred KB.
    2 points
  2. Mat

    GUIHotkey.au3

    Sorry to Achilles for nicking his project but... I had a look through some old code and decided that it would be easy enough to do and there was a few things I wanted it to do for a new project. Anyway, here it is, with tonnes of improvements on my old code. His example was very helpful though, so thanks Current functions: * _GUICtrlHotkey_Create * _GUICtrlHotkey_Delete * _GUICtrlHotkey_GetHotkey * _GUICtrlHotkey_GetHotkeyCode * _GUICtrlHotkey_GetHotkeyName * _GUICtrlHotkey_SetFont * _GUICtrlHotkey_SetHotkey * _GUICtrlHotkey_SetHotkeyCode * _GUICtrlHotkey_SetHotkeyName * _GUICtrlHotkey_SetRules Get and Set HotkeyCode refer to the standard format that HKM_SETHOTKEY expects it in. "The LOBYTE of the LOWORD is the virtual key code of the hot key. The HIBYTE of the LOWORD is the key modifier that indicates the keys that define a hot key combination". Unless you really want to thats probably not the best option, so I made the other 2 "types". The "Name" is the string as it would appear in the control itself, and how the end user would expect it as well. For example "CTRL+SHIFT+ALT+2". The normal functions Get and Set Hotkey use the send syntax that can then be used directly with functions such as HotkeySet. Logical eh? This makes it a lot easier YOU to use the control. Its all in proper UDF form etc, and... It goes through Au3Check cleanly which must be a first for me Download link: GUIHotkey.zip M∝τ
    1 point
  3. Most of this code is from an similar project posted here. The difference is that this one uses 100% TCP. It is also just a skeleton of what it could achieve - and not limited like the other one was. So, what is meant by "Passive"? Unlike the other code... As the proxy receives data from the web server, it will immediately forward it to the browser. So, when you download a file, you will see it in real time from the browser, along with whatever progress dialog it may have. I consider this script a good start at what I'd like to see it become eventually -- If and when I find the time to work on it. Please let me know if any crashes, bugs or quirks. Thanks! Updated: August 31, 2014 - Various improvements. Known issues: - Some TCP functions do not work correctly in 64bit. I have not tried to track that down yet. - HTTPS is not supported yet. _TCP_PassiveProxyFilter_v0.3b.au3
    1 point
  4. For anyone who has amended the build scripts, will know why I am not keen on adding this in it's current state.
    1 point
  5. Also this gives you an idea too > http://www.autoitscript.com/wiki/Managing_Multiple_GUIs
    1 point
  6. czardas

    AutoIt Snippets

    My first thought - doesn't regexp already cover _StringBetween() functionality?
    1 point
  7. jchd

    AutoIt Snippets

    A different approach: Func _RegExpStringBetween(Const $test, $start_pattern, Const $end_pattern) $start_pattern = StringRegExpReplace($start_pattern, "((?:\\\\)*)(\\Q.*?\\E)", "\1") StringRegExpReplace($start_pattern, "(?x) (?:\\\\)* \K (?<!\\) ( \( (?= \?< | \?' | \?P< ) | \( (?! \* | \? [-:\|>#\w=!+&(] | \? <= | \? <! | \? P= | \? P> ) )", "") Local $group = @extended Local $string_between = StringRegExp($test, $start_pattern & '(.*?)' & $end_pattern, 1) If @error Then Return SetError(1, 0, False) Else Return $string_between[$group] EndIf EndFunc
    1 point
  8. ms, Changed close / shutdown. Don't know if it's necessary but it is a good practice. The function was cloned from other code that does call the function depending on conditions. Took out some unnecessary calcs to speed it up significantly...I'll stop jacking with the code now #include <sqlite.au3> #include <array.au3> #include <date.au3> local $data, $st, $tdata, $sSaveUser, $sOut $data &= "user1 :: 3 :: www.abc.com :: Dec-12-2013 11:12:13" & @CRLF $data &= "user2 :: 4 :: www.abc1.com :: Nov-12-2013 11:12:18" & @CRLF $data &= "user3 :: 2 :: www.abc2.com :: Oct-12-2013 10:12:18" & @CRLF $data &= "user2 :: 3 :: www.xyz2.com :: Oct-12-2013 09:12:18" & @CRLF $data &= "user1 :: 2 :: www.rrrxxy.com :: Oct-11-2013 09:12:18" & @CRLF $data &= "user2 :: 1 :: www.abcxxy.com :: Oct-18-2013 10:11:18" & @CRLF ;~ for $1 = 1 to 5000 ;~ $data &= 'user' & stringformat('%04i',random(1,20,1)) & ' :: ' & random(1,150,1) & ' :: ' & 'www.' ;~ for $2 = 1 to random(5,16,1) ;~ $data &= chr(random(97,122,1)) ;~ Next ;~ $data &= '.com :: ' ;~ $data &= _dateadd('D',random(-365,365,1),_nowcalc()) & @crlf ;~ next $st = timerinit() _SQLite_Startup() _SQLite_Open(':memory:') _sqlite_exec(-1,'create table tbl1 (user, cnt, url, dte);') _sqlite_exec(-1,'begin transaction') local $a10 = StringSplit($data,@crlf,3), $aTmp for $1 = 0 to ubound($a10) - 1 $aTmp = stringsplit($a10[$1],'::',3) if ubound($aTmp) < 3 then continueloop _sqlite_exec(-1,'insert into tbl1 values(' & _ _SQLite_FastEscape($aTmp[0]) & ',' & _ _SQLite_FastEscape(stringformat('%03i',$aTmp[1])) & ',' & _ _SQLite_FastEscape($aTmp[2]) & ',' & _ _SQLite_FastEscape($aTmp[3]) & ');') next _sqlite_exec(-1,'end transaction') _sqlite_exec(-1,'create table tbl2 as select user, count(*) as recs from tbl1 group by user;') local $ret,$arows,$irow,$icol $ret = _SQLite_GetTable2d(-1,'select * from tbl1 join tbl2 on tbl1.user = tbl2.user order by recs desc, user desc, cnt;',$arows,$irow,$icol) $a10 = $arows for $1 = 1 to ubound($a10) - 1 if stringlen($a10[$1][0]) = 0 then ContinueLoop if $sSaveUser = $a10[$1][0] then $sOut &= stringformat(' %-5s %-30s %-20s',$a10[$1][1], $a10[$1][2], $a10[$1][3]) & @crlf Else $sOut &= $a10[$1][0] & ' > ' & $a10[$1][5] & @CRLF $sSaveUser = $a10[$1][0] $sOut &= stringformat(' %-5s %-30s %-20s',$a10[$1][1], $a10[$1][2],$a10[$1][3]) & @crlf endif next filedelete('1.txt') FileWrite("1.txt", $sOut) ConsoleWrite(stringformat('Time to run %03i records = %2.4f',$1-1,timerdiff($st)/1000) & @lf) _SQLite_Close() _SQLite_Shutdown() shellexecute('1.txt')
    1 point
  9. $sIP4 = '192.168.30.195' MsgBox(0, '?', _IsIP4($sIP4)) Func _IsIP4($sIP4) Return StringRegExp($sIP4, '^(?:(?:2(?:[0-4]\d|5[0-5])|1?\d{1,2})\.){3}(?:(?:2(?:[0-4]\d|5[0-5])|1?\d{1,2}))$') ; Return StringRegExp($sIP4, '^(?:(?:2(?:[0-4][\d|5[0-5])|[0-1]?\d{1,2})\.){3}(?:(?:2(?:[0-4]\d|5[0-5])|[0-1]?\d{1,2}))$') EndFunc
    1 point
  10. Zedna

    Drawing Individual Pixels

    GetDC(0) gives you desktop DC so you can use SetPixel for painting on Desktop the same way as on any GUI window.
    1 point
  11. michaelslamet, Try this... #include <sqlite.au3> #include <array.au3> #include <date.au3> local $data, $st, $tdata, $sSaveUser, $sOut $data &= "user1 :: 3 :: www.abc.com :: Dec-12-2013 11:12:13" & @CRLF $data &= "user2 :: 4 :: www.abc1.com :: Nov-12-2013 11:12:18" & @CRLF $data &= "user3 :: 2 :: www.abc2.com :: Oct-12-2013 10:12:18" & @CRLF $data &= "user2 :: 3 :: www.xyz2.com :: Oct-12-2013 09:12:18" & @CRLF $data &= "user1 :: 2 :: www.rrrxxy.com :: Oct-11-2013 09:12:18" & @CRLF $data &= "user2 :: 1 :: www.abcxxy.com :: Oct-18-2013 10:11:18" & @CRLF ;~ for $1 = 1 to 5000 ;~ $data &= 'user' & stringformat('%04i',random(1,20,1)) & ' :: ' & random(1,150,1) & ' :: ' & 'www.' ;~ for $2 = 1 to random(5,16,1) ;~ $data &= chr(random(97,122,1)) ;~ Next ;~ $data &= '.com :: ' ;~ $data &= _dateadd('D',random(-365,365,1),_nowcalc()) & @crlf ;~ next $st = timerinit() _SQLite_Startup() _SQLite_Open(':memory:') _sqlite_exec(-1,'create table tbl1 (user, cnt, url, dte);') _sqlite_exec(-1,'begin transaction') local $a10 = StringSplit($data,@crlf,3), $aTmp for $1 = 0 to ubound($a10) - 1 $aTmp = stringsplit($a10[$1],'::',3) if ubound($aTmp) < 3 then continueloop _sqlite_exec(-1,'insert into tbl1 values(' & _ _SQLite_FastEscape($aTmp[0]) & ',' & _ _SQLite_FastEscape(stringformat('%03i',$aTmp[1])) & ',' & _ _SQLite_FastEscape($aTmp[2]) & ',' & _ _SQLite_FastEscape($aTmp[3]) & ');') next _sqlite_exec(-1,'end transaction') _sqlite_exec(-1,'create table tbl2 as select user, count(*) as recs from tbl1 group by user;') local $ret,$arows,$irow,$icol $ret = _SQLite_GetTable2d(-1,'select * from tbl1 join tbl2 on tbl1.user = tbl2.user order by recs desc, user desc, cnt;',$arows,$irow,$icol) $a10 = $arows for $1 = 1 to ubound($a10) - 1 if stringlen($a10[$1][0]) = 0 then ContinueLoop if $sSaveUser = $a10[$1][0] then $sOut &= stringformat(' %-5s %-30s %-20s',$a10[$1][1], $a10[$1][2], $a10[$1][3]) & @crlf Else $sOut &= $a10[$1][0] & ' > ' & $a10[$1][5] & @CRLF $sSaveUser = $a10[$1][0] $sOut &= stringformat(' %-5s %-30s %-20s',$a10[$1][1], $a10[$1][2],$a10[$1][3]) & @crlf endif next filedelete('1.txt') FileWrite("1.txt", $sOut) ConsoleWrite(stringformat('Time to run %03i records = %2.4f',$1-1,timerdiff($st)/1000) & @lf) shellexecute('1.txt') func _exit() _SQLite_Close() _SQLite_Shutdown() endfunc I'm sure the SQL is pretty bad but it works in my testing. kylomas edit: moved url count formatting to DB population
    1 point
  12. mikell, Because I am but a simple soul and cannot write SREs like that. M23
    1 point
  13. I was finding that _SQLite_Startup() was failing on Win7x64 machines. After a lot of debugging, I determined that is was the function that downloads the DLL that was having trouble. It kept trying to save the downloaded file to @SystemDir, but that is not writeable unless run as administrator. The fix is a simple one, and I am recommending it for the next release (unless a better improvement is already in the works.) First, in SQLite.au3, change line 242 from If FileExists($sDll_Filename) Or $sDll_Filename = "" Then to If FileExists($sDll_Filename) Or $sDll_Filename = "" Or Not __SQLite_DirWriteAccessible(@SystemDir)Then then add the following function ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __SQLite_DirWriteAccessible ; Description ...: Determins if a directory is write accessible ; Syntax ........: __SQLite_DirWriteAccessible($sPath) ; Parameters ....: $sPath - Directory path to check ; Return values .: True - Directory is write accessible ; False - Directory is not write accessible, or does not exist ; Author ........: KaFu ; Modified ......: Willichan ; Remarks .......: ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/128642-how-to-check-accessibility-of-a-folder/#entry892739 ; Example .......: No ; =============================================================================================================================== Func __SQLite_DirWriteAccessible($sPath) If Not StringInStr(FileGetAttrib($sPath), "D", 2) Then Return SetError(1, 0, False) Local $iEnum = 0 While FileExists($sPath & "\_test_" & $iEnum) $iEnum += 1 WEnd Local $iCreate = DirCreate($sPath & "\_test_" & $iEnum) If $iCreate = 1 Then Local $iRemove = DirRemove($sPath & "\_test_" & $iEnum) Return ($iRemove = 1) Else Return False EndIf EndFunc After these changes, the scripts work for all 32 and 64 bit versions of XP and Win7 that I have tested on.
    1 point
  14. Bowmore

    Is AutoIT perfect?

    Why is it that many people think that if there has not been a new release of any application for a few months, then it must not be any good or been abandoned. I've several applications on my PCs that have not been updated for 10 years or more some are in daily use. They still do the job they were designed to do very well so there is no need for the author to update them. One thing I have noticed with my Android apps is that many of them seem to feel the need to update themselves every other day for no discernible benefit to me. As far as AutoIt goes I've been using it since the launch of version 3 and about 50% of my full time job is as a developer of AutoIt Scripts for automated testing of data and applications and with the current stable release 3.3.8.1 I have not found anything that I could not do with AutoIt that I could reasonably expect to do with an interpreted language. I suspect that AutoIt 3.* has about reached the limit of what can be done, apart from minor bug fixes and the odd new nice to have functionality, without a complete redesign and rewrite of the core code. It's just the natural life cycle of a piece of software.
    1 point
×
×
  • Create New...