
iCode
Active Members-
Posts
194 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by iCode
-
proposed change to UDF '_StringTitleCase()'
iCode replied to iCode's topic in AutoIt Technical Discussion
@DatMCEyeBall - i think you started an avalanche my script is ANSI and i added the apostrophe without encoding it and it works perfectly i agree that UCP doesn't need to be enabled for the EN language, but i thought that since the expression has a group with "a-zA-Z" in it, and UCP affects that, that it may be the safer thing to do? i'm really not sure however since i'm no expert with RegEx and certainly no expert with Unicode! -
i would suggest posting an example and letting other critique it
-
looking through the forums and example scripts, i have not come across any examples or real clues on this... i would like to create a "private" clipboard if possible - a clipboard that does not interfere with the standard windows clipboard or normal methods of adding/extracting data from it (^c, ^v) i know i can backup/restore the contents of the clipboard as a work-a-round, but i want to avoid that i think the real core of the problem is not so much having an independent clipboard, but how to put and extract data from it without interfering with the windows clipboard - i want to automatically copy content from whatever program i have content selected in and store it, but how can i grab the selection without interfering with the regular clipboard, which ^c would do? essentially i'm wanting to reproduce xcopy (i think it is) in linux, where text is auto-copied, but without overwriting ^c/^v operations
-
currently it looks like this... ; #FUNCTION# ==================================================================================================================== ; Author ........: BrewManNH ; Modified ......: ; =============================================================================================================================== Func _StringTitleCase($sString) Local $fCapNext = True, $sChr = "", $sReturn = "" For $i = 1 To StringLen($sString) $sChr = StringMid($sString, $i, 1) Select Case $fCapNext = True If StringRegExp($sChr, "[a-zA-Z\xC0-\xFF0-9]") Then $sChr = StringUpper($sChr) $fCapNext = False EndIf Case Not StringRegExp($sChr, "[a-zA-Z\xC0-\xFF'0-9]") $fCapNext = True Case Else $sChr = StringLower($sChr) EndSelect $sReturn &= $sChr Next Return $sReturn EndFunc ;==>_StringTitleCase i am NO expert on RegEx, but there is a problem with the above line... Case Not StringRegExp($sChr, "[a-zA-Z\xC0-\xFF'0-9]") that will cause: 's (as in: that's) to become: 'S when the apostrophe is hex 2019: ’ suggested change is to simply add the missing char to the group, and possibly (*UCP)?: Case Not StringRegExp($sChr, "(*UCP)[a-zA-Z\xC0-\xFF0-9'’]")
-
unicode .au3 files question - script and includes
iCode replied to iCode's topic in AutoIt General Help and Support
thanks for the answers that explains why the include files are ANSI and also, i think, why my script size did not change substantially when i converted one to UTF-8 -
anyone else having problems running tidy on their script? prior to .21 i think it worked fine in .21 it would run and format the script, then crash every time in .22 it crashes on startup every time without formatting the script running it with no extra parms i can supply a dump file for tidy.exe if it helps win 7 x64, autoit 3.3.9.2.2 - 32 bit tools mode
-
that's for folder names, but why does a colon need to be escaped in the exp? he has 3 backslashes, so he is escaping 1 backslash and the colon ( :)
-
might be worng, but an issue i'm seeing is ":" - i understand escaping the backslash, but you don't need to escape a colon AFAIK, at least not in this case
-
Help File/Documentation Issues. (Discussion Only)
iCode replied to guinness's topic in AutoIt Technical Discussion
StringRegExp() - broken link link: http://www.autoitscript.com/autoit3/pcrepattern v8.33.html i think it should be: http://www.autoitscript.com/autoit3/pcrepattern.html by the way, kudos to all who rebuilt this section of the help file -
Help File/Documentation Issues. (Discussion Only)
iCode replied to guinness's topic in AutoIt Technical Discussion
suggested addition to "Func...Return...EndFunc" considering adding something along the lines of... Event functions do not initialize the parameter variables when called through an Event. source: edit: ok, maybe that was a bit cryptic... i was calling a function with an optional variable (Func _ToggleState($iParam = 0)) from an event function (TrayItemSetOnEvent(-1, "_ToggleState")) and wondering why i was getting "undeclared variable" when i found that post by Jos -
SQLite - general db manipulation questions
iCode replied to iCode's topic in AutoIt General Help and Support
FINALLY!!! after cobbling together parts of the code you were all kind enough to provide, and after allot of searching (stackoverflow) and looking at lots more code, i finally have what want again, thanks to all who helped this not-so-sharp old man #include <SQLite.au3> #include <SQLite.dll.au3> #Include <Array.au3> Local $sqlDbFile = @ScriptDir & "\db.sqlite" Local $aRows, $nRows, $nCols FileDelete($sqlDbFile) _SQLite_Startup() _SQLite_Open(@ScriptDir & "\db.sqlite") _SQLite_Exec(-1, "CREATE TABLE dynamic (" & _ "id, " & _ "short, " & _ "long);") For $i = 1 To 10 _SQLite_Exec(-1, "INSERT INTO dynamic VALUES ('" & $i & "','short descrip #" & $i & "','long descrip');") Next _SQLite_GetTable2d(-1, "select * from dynamic;", $aRows, $nRows, $nCols) _ArrayDisplay($aRows) _SQLite_Exec(-1, "CREATE TRIGGER t_insert " & _ "AFTER INSERT ON dynamic " & _ "BEGIN " & _ "DELETE FROM dynamic WHERE id <= (SELECT id FROM dynamic ORDER BY id DESC LIMIT 10, 1); " & _ "UPDATE dynamic SET id=id-1; " & _ "END;") For $i = 1 To 3 _SQLite_Exec(-1, "INSERT INTO dynamic VALUES ('11','new #" & $i & "','long descrip');") _SQLite_GetTable2d(-1, "select * from dynamic;", $aRows, $nRows, $nCols) _ArrayDisplay($aRows) Next _SQLite_Close() _SQLite_Shutdown() -
SQLite - general db manipulation questions
iCode replied to iCode's topic in AutoIt General Help and Support
no appology necessary - i was lucky to have an SQL wizard reply to my post Yes, that works exactly like i want it to, but if i can do the same without the rank column, then i should probably do that. If i understood you right, you seem to be applying that the numbering column is not needed. I just couldn'tfigure out the syntax to delete a row without it. This is my [broken] example... "BEGIN " & _ "delete from dynamic short, long limit 1; " & _ "END;") -
SQLite - general db manipulation questions
iCode replied to iCode's topic in AutoIt General Help and Support
i'm still stuck - i'm looking at the docs and what you have provided and i can't find any examples that show how to delete a row without referring to a row id column or data in a cell since i only ever want a max of 10 rows, i need to delete the oldest row (first row) when a new one is added, so, using your query example (select short, long from dyn limit 1;) i tried this a few different ways in the trigger and i haven't gotten it to work... "BEGIN " & _ "delete from dynamic short, long limit 1; " & _ "END;") --> Query: CREATE TABLE [dynamic] ([short] CHAR,[long] CHAR); CREATE TRIGGER [t_inc_id] AFTER INSERT ON [dynamic] BEGIN delete from dynamic short, long limit 1; END; --> Error: near "short": syntax error so i tried (short,long) and 'short,long' and a couple others and failed -
SQLite - general db manipulation questions
iCode replied to iCode's topic in AutoIt General Help and Support
i'm not insisting on anything, i think i am simply under the wrong impression that i need that id col and i guess i don't i will give it a shot with the method of querying you suggested and see how that goes thanks allot for your help -
SQLite - general db manipulation questions
iCode replied to iCode's topic in AutoIt General Help and Support
"In" confused me - i think you meant "If" -- i understand now -- i think i'll stick with the id col since it seems easier to me, i think so this is what i have, but AUTOINCRIMENT isn't incrimenting as i expect - instead it's working exactly as it should, which isn't what i need i want the nums in the id col to always range from 1 to 10, and this is giving me 2 to 11 (see 3rd line up from the end)... #include <SQLite.au3> #include <SQLite.dll.au3> Local $hSqlQuery, $aRow, $sMsg Local $sqlDbFile = @ScriptDir & "\db.sqlite" FileDelete($sqlDbFile) _SQLite_Startup() _SQLite_Open(@ScriptDir & "\db.sqlite") _SQLite_Exec(-1, "CREATE TABLE [dynamic] (" & _ "[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," & _ "[short] CHAR," & _ "[long] CHAR); " & _ "CREATE TRIGGER [t_inc_id] " & _ "AFTER INSERT " & _ "ON [dynamic] " & _ "BEGIN " & _ "delete from dynamic where id not in (select id from dynamic order by id desc limit 10); " & _ "END;") _SQLite_Exec(-1, "INSERT INTO dynamic (short,long) VALUES ('sart','first');") For $i = 1 To 9 _SQLite_Exec(-1, "INSERT INTO dynamic (short,long) VALUES ('hi','hiya');") Next ; so far we have 1 to 10 in the id column, but then when we insert again the range becomes 2 to 11 - i need 1 to 10 _SQLite_Exec(-1, "INSERT INTO dynamic (short,long) VALUES ('10','should be row 10 but it is 11');") _SQLite_Close() _SQLite_Shutdown() -
SQLite - general db manipulation questions
iCode replied to iCode's topic in AutoIt General Help and Support
shows you how much i know about SQL yes, autoincrementing the id colums is what i want ... i think -- if i understand you right, you're saying i don't need the id column to query data? far as i know there is no numbering scheme in SQL, so how would i know what row to pull from? in my case i need a row number (i don't care what the data is) thanks to you others also -
i want a db with 10 rows and 3 colums; id, short, long when a new row is inserted, i automatically want to delete the oldest row, then re-order the id column - so it's sort of like a cascading list, if you will i just started playing with SQLite and i'm having trouble figuring out how to 1) delete the oldest row using a TRIGGER and 2) re-order the numbers in the id column ex... id short long ----------------------------------------- 1 some... some text here 2 3 ... this is where i'm at so far... #include <SQLite.au3> #include <SQLite.dll.au3> Local $hSqlQuery, $aRow, $sMsg Local $sStrLong = "hello world, it sure is a nice damn day outside, eh?" Local $sStrShort = StringLeft($sStrLong, 20) Local $sqlDbFile = @ScriptDir & "\db.sqlite" FileDelete($sqlDbFile) _SQLite_Startup() _SQLite_Open(@ScriptDir & "\db.sqlite") ; Open/create a permanent disk database _SQLite_Exec(-1, "CREATE TABLE dynamic (id, short, long);") For $i = 1 To 10 _SQLite_Exec(-1, "INSERT INTO dynamic VALUES ('" & $i & "','','');") ; INSERT Data Next _SQLite_Exec(-1, "CREATE TRIGGER t_del AFTER INSERT ON dynamic BEGIN DELETE FROM dynamic WHERE id = '1'; END") _SQLite_Exec(-1, "INSERT INTO dynamic VALUES ('10','" & $sStrShort & "','" & $sStrLong & "');") ; INSERT Data _SQLite_Close() ; DB is a regular file that could be reopened later _SQLite_Shutdown() so the above leaves me with rows in the id colum from 2 to 10, then another 10 which is the last INSERT what i need to do is change 2 to 1, 3 to 2, 4 to 3, etc. i think i need something like "UPDATE SET column-name = 'id'" in the TRIGGER, or maybe a For-Next loop, but that's where i'm stuck
-
compare mouse cursor position - code efficiency
iCode replied to iCode's topic in AutoIt General Help and Support
Took me awhile to figure out how to write it, but i think this is what you meant??? If Abs($a_mPos2[0] - $a_mPos1[0]) > $XPixelThreshold Or Abs($a_mPos2[1] - $a_mPos1[1]) > $YPixelThreshold Then Testing tells me the time is the same, which i guess isn't bad considering another function is added, but at least it looks a little prettier AND i learnd something thanks! -
copy and paste with Send() and variable
iCode replied to iCode's topic in AutoIt General Help and Support
Well, i surely missed that variation! Thanks -
compare mouse cursor position - code efficiency
iCode replied to iCode's topic in AutoIt General Help and Support
For some assa-9 reason i disabled auto-notification to topics. Sorry 'bout that. Some might well find it frustrating to spend the time to help someone, only to have them go AWOL I'm not looking to trap the mouse or reduce polling, i'm just wondering if there isn't a better way of writing this so it runs faster... If $a_mPos2[0] > $a_mPos1[0] + $XPixelThreshold Or $a_mPos2[0] < $a_mPos1[0] - $XPixelThreshold Or $a_mPos2[1] > $a_mPos1[1] + $YPixelThreshold Or $a_mPos2[1] < $a_mPos1[1] - $YPixelThreshold Then ; stuff to do EndIf What i am doing is detecting the cursor position when the primary is clicked ($mPos1), then waiting until it is clicked again ($mPos2), then checking if the cursor has been moved beyond a specified distance in pixels ($XPixelThreshold) So i am checking in all 4 directions - N, S, E, W - so there are 4 of these... $a_mPos2[0] > $a_mPos1[0] + $XPixelThreshold ...where IF position-2 is > than position-1, etc., etc., etc., THEN i know what to do next It just seems that the way i wrote it is clumsy and slower than it could be. So i'm not looking for pretty, just fast -
instead of this... Send("^{INS}") Send("+{INS}") can a variable be used in place of "^" and "+"? i tried this and it doesn't work because it toggles the Insert key... $var = "^" Send('"' & $var & '"'{INS}")
-
is there a better way of writing this code? i am interested in speed/efficiency more than readability i want to get the cursor position at 2 different times, then compare them to see if it was moved beyond the threshold values the code i have works fine, but i have a suspession there is a better way to write it so maybe it runs faster??? $XPixelThreshold = 10 $YPixelThreshold = 10 $a_mPos1 = MouseGetPos() ; wait on user to do stuff $a_mPos2 = MouseGetPos() ; check to see if cursor was moved at least the number of pixels as specified by threshold values If $a_mPos2[0] > $a_mPos1[0] + $XPixelThreshold Or $a_mPos2[0] < $a_mPos1[0] - $XPixelThreshold Or $a_mPos2[1] > $a_mPos1[1] + $YPixelThreshold Or $a_mPos2[1] < $a_mPos1[1] - $YPixelThreshold Then ; stuff to do EndIf
-
MattyD - wow, this may be just what i'm looking for! seems like a really ambitious project i know very little about networking so my initial question is, could these WiFi functions work for communicating with the WiRC radio? not sure what information you might need to determine that, but here are some specs... here's the full communication protocol doc (PDF)