
iCode
Active Members-
Posts
194 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by iCode
-
Sentence Case - Capitalize first letter of sentences
iCode replied to iCode's topic in AutoIt Example Scripts
whoops! yes, that was obvious. thanks first post updated.- 2 replies
-
- case
- sentence case
-
(and 1 more)
Tagged with:
-
This is a spin-off of >Seeker's function which i rewrote and tried to optimize for doing only sentence casing and for better Unicode handling. Haven't done a lot of testing with it, but it seems to work well so far. #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SentenceCase ; Description ...: Capitalize the first letter of sentences. ; Syntax ........: _SentenceCase(Byref $sString) ; Parameters ....: $sString: [in/out] A string value. ; Return values .: Success: A string is returned. ; Failure: Sets @error = 1 and returns 0. ; Author ........: iCode ; Modified ......: 30-MAR-2015 ; Remarks .......: ; Related .......: http://www.autoitscript.com/forum/topic/147086-udf-for-title-case-initial-caps-and-sentence-case/ ; Link ..........: http://www.autoitscript.com/forum/topic/169290-sentence-case-capitalize-first-letter-of-sentences/ ; Example .......: No ; =============================================================================================================================== Func _SentenceCase(ByRef $sString) Local $aStr = StringRegExp($sString, "(*UCP)(?s)[[:alpha:]].+?(?:[.?!:;]|\z)\s*|[^[:alpha:]]+", 3) If @error Then Return SetError(1, 0, 0) Local $sChar, $sRet = "" For $i = 0 To UBound($aStr) - 1 If StringRegExp($aStr[$i], "(*UCP)(?s)^[[:alpha:]]+.*?[.?!:;]") Then $sChar = StringLeft($aStr[$i], 1) If StringIsLower($sChar) Then $aStr[$i] = StringUpper($sChar) & StringTrimLeft($aStr[$i], 1) EndIf EndIf $sRet &= $aStr[$i] Next Return $sRet EndFunc CHANGE LOG: 28-MAR-2015 - initial version 30-MAR-2015 - added more sentence terminition characters ( ; : ) - should probably get these from a variable?
- 2 replies
-
- case
- sentence case
-
(and 1 more)
Tagged with:
-
i read that too, but it did say "by default" -- i don't know what that means, but i would wonder if PCRE would support these escapes simply by compiling with a different switch perhaps???
-
done: https://www.autoitscript.com/trac/autoit/ticket/2987 thanks
-
AHK supports this and it sure would make case changes easier... \l lowercase next char (think vi) \u uppercase next char (think vi) \L lowercase until \E (think vi) \U uppercase until \E (think vi) example: StringRegExpReplace("this. that", "\. ([a-z])", ". \u1") ; returns: this. That ref: http://perldoc.perl.org/perlre.html
-
very sorry - i read your post wrong it works fine
-
@Melba23 - are you sure you replaced the attachment in the first post? dragging below the list (but within the LV) does not move the bottom item to the top for me - i just quickly tried it using the first LV in example 5 other than that it works great thanks!
-
hi Melba - works fine for me also! there's still an issue with flickering of the dragged item when you drag it off of the list, or outside of list content, but that's a rather minor visual thing
-
little bug... drag the last item (tom 4) down, but keep it inside the LV control, then release it - you'll see what i mean you can test this example, or any of the examples included with the function package #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" $hGUI = GUICreate("Test", 400, 400) ; Create ListViews $cLV_Tom = GUICtrlCreateListView("Tom",10, 30, 300, 300) _GUICtrlListView_SetColumnWidth($cLV_Tom, 0, 140) ; Create arrays and fill ListViews Global $aTom[5] For $i = 0 To 4 $aTom[$i] = "Tom " & $i GUICtrlCreateListViewItem($aTom[$i], $cLV_Tom) Next ; Initiate ListViews and set differing external drag/drop states GUICtrlCreateLabel("Normal", 10, 10, 180, 20) $iLV_Tom = _GUIListViewEx_Init($cLV_Tom, $aTom, 0, 0, True) ; External drag & drop - items deleted on drag GUISetState() _GUIListViewEx_MsgRegister() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd also, i might suggest adding a return value after a successful call to _GUIListViewEx_WM_LBUTTONUP_Handler() if you think it might be worth while in my case, i need to re-order items in a file after the LV is re-ordered
-
SendEx - yet another alternative to the built-in Send function
iCode replied to iCode's topic in AutoIt Example Scripts
the format is the same as Send() -
RegEx help: StringRegExpReplace and Conditional Patterns
iCode replied to iCode's topic in AutoIt General Help and Support
it's just an assumption if you run across text like example.com within an article or whatever, http will likely work -
RegEx help: StringRegExpReplace and Conditional Patterns
iCode replied to iCode's topic in AutoIt General Help and Support
that doesn't prefix the string with "http" if it's missing, so it is not a valid hyperlink in order to do this with only StringRegExpReplace, i am pretty sure the "Conditional patterns" for StrinRegExp needs to be utilized -
RegEx help: StringRegExpReplace and Conditional Patterns
iCode replied to iCode's topic in AutoIt General Help and Support
Sorry, the "1" could be anything and the "A" could be anything. I just made the example as simple as i could. What i'm actually trying to do is find text links in a string and wrap them in HTML to make hyperlinks. So the string could be something like: go to ex.com but don't go to http://ex2.de or https://ex3.eu The result needs to be: go to <a href="ex.com">ex.com</a> but don't go to <a href="http://ex2.de">http://ex2.de</a> or <a href="https://ex3.eu">https://ex3.eu</a> The problem i'm having with StringRegExpReplace is that, if the https? is present, then the it gets doubled. I need to add it only if it is not present using only StringRegExpReplace. If this can't be done i can do it another way, but i'd like to see if it can. -
Don't know if this is possible, but given the example strings: 1A A I want to find the string: (d)?([A-Z]) and if the digit is not present, then i want to add it using StringRegExpReplace. So given the example strings, the result in both cases should be: 1A This is trivial to do using a method other than StringRegExpReplace, but i want to see if this can be done this way... just because. It seems like the "Conditional patterns" section of the help doc for StringRegExp might hold the key, but i have not been able to get it to work. Here are a couple match patterns i tried: (d)?(?(1)|1)([A-Z]) (d)?(?(1)$1|1)([A-Z]) (d)?(?(1)g1|1)([A-Z]) And replace pattern is a generic $1$2$3
-
if your concern is one of space on the users drive, and if you are open to using an installer, Inno Setup can handle that for you and you can get rid of the FileInstall function there may be other ways, but that is all that comes to mind at the moment
-
look at Run() / RunWait() and FileFindFirstFile() / FileFindNextFile() in the help file, which you might find useful if all your scrips are in the same directory or maybe create a little GUI for your script and use it to list and run the scripts you choose to run - you can use koda for that if you wanted, which is in the AutoIt Script Editor package
-
_Clipboard_GetAll / _Clipboard_PutAll / _Clipboard_Wait
iCode replied to wraithdu's topic in AutoIt Example Scripts
yes, i apparently did i have had trouble with both the original and my version. -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
done - thanks Jos https://sourceforge.net/p/scintilla/bugs/1617/ -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
Regarding the bookmark bug i mentioned earlier, here's how to reproduce: Bookmark 2 sequential lines (line 1 and line 2) (Ctrl+F2) Delete the first line - there will be 1 bookmark remaining Press Ctrl+F2 to remove the remaining bookmark - you have to press it twice It's as though the 2 bookmarks are being merged into one, so you have to Ctrl+F2 twice to remove it -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
that's different than what i was experiencing - for me it happened anywhere i just tested inside a Case and i couldn't reproduce it probably going way out on a limb here, but did you try Jos's solution in post 105? for whatever reason, i haven't had any problems after toggling that setting to true, then running a test, that back to false again -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
the indent worked as it is supposed to, regardless of whether i backspace before entering 'Else' or not ... and ... after changing it back to 'false' i can no longer reproduce the problem sorry, i'm lost JScript? Debug: *** Enter detected => Start Indent checking Debug: +### processing line:0 Curr_firstword:: Next_firstword:: Debug: Curr_foldLvl:1024 Curr_lev:67109888 Curr_IsFoldHeader :false Parent_line:-1 Parent_foldLvl: -1 Debug: Prev_foldLvl:1024 Prev_lev:1024 Prev_IsFoldHeader :false Prev_Parent_line:-1 Prev_Parent_foldLvl: -2 Debug: Next_foldLvl:1024 Next_lev:1024 Next_IsFoldHeader :false Next_Parent_line:-1 Next_Parent_foldLvl: 0 Debug: *** Enter detected => Start Indent checking Debug: +### processing line:1 Curr_firstword:if: Next_firstword:: Debug: Curr_foldLvl:1024 Curr_lev:67183616 Curr_IsFoldHeader :true Parent_line:-1 Parent_foldLvl: -1 Debug: Prev_foldLvl:1024 Prev_lev:67109888 Prev_IsFoldHeader :false Prev_Parent_line:-1 Prev_Parent_foldLvl: -2 Debug: Next_foldLvl:1025 Next_lev:67175425 Next_IsFoldHeader :false Next_Parent_line:1 Next_Parent_foldLvl: 0 Debug: *** Enter detected => Start Indent checking Debug: +### processing line:2 Curr_firstword:'that: Next_firstword:: Debug: Curr_foldLvl:1025 Curr_lev:67175425 Curr_IsFoldHeader :false Parent_line:1 Parent_foldLvl: 1 Debug: Prev_foldLvl:1024 Prev_lev:67183616 Prev_IsFoldHeader :true Prev_Parent_line:-1 Prev_Parent_foldLvl: 0 Debug: Next_foldLvl:1025 Next_lev:67175425 Next_IsFoldHeader :false Next_Parent_line:1 Next_Parent_foldLvl: 2 Debug: *** Enter detected => Start Indent checking Debug: +### processing line:3 Curr_firstword:else: Next_firstword:: Debug: Curr_foldLvl:1024 Curr_lev:67183616 Curr_IsFoldHeader :true Parent_line:-1 Parent_foldLvl: -1 Debug: Prev_foldLvl:1025 Prev_lev:67175425 Prev_IsFoldHeader :false Prev_Parent_line:1 Prev_Parent_foldLvl: -2 Debug: Next_foldLvl:1025 Next_lev:67175425 Next_IsFoldHeader :false Next_Parent_line:3 Next_Parent_foldLvl: 0 Debug: ! Current line:Found Case/End*/Else/Next/Until statement ... update Indent. Debug: ! Current line:Found Else/elseif statement ... update Indent. -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
one thing i'm seeing in the 'au3abbrev.properties' file is that all of the sections are repeated twice -- example: #; -- Directives -- include=#include <GUIConstants.au3>\n| includeonce=#include-once\n| reg=#region - |\n ereg=#endregion\n| nti=#NoTrayIcon\n| the above, as with other blocks, are repeated twice i'm guessing it's supposed to be that way, but just wanted to mention it just in case -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
spoke too soon just did a clean install again and the issue is still present S4A 14.06.03.20 -- MD5: 99B5B11853D11C7BFBBD8FA91F9710C9 autoit 3.3.12.0 sorry guys so... tell me what file is responsible for code indenting and we'll compare files -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
@Jos SciTE4AutoIt3-5-31-2014.exe holy crap - sorry Jos i downloaded the newest version and saved it to the wrong directory, so when i installed, i installed the older version and never checked it -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
did you guys delete all the scite files in %appdata% before you installed? if you install and any of your preferences are still in effect from the previous S4A package, then you need to seek and destroy i suspect the issue isn't occurring for you because there are some leftovers somewhere, be they in the AutoIt program folder, appdata programdata, or maybe the registry - i'm not the only one experiencing this issue, so it isn't an isolated incident