Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/18/2019 in all areas

  1. $folder = FileSelectFolder("Select Folder", @ScriptDir) If $folder = "" Or @error Then Exit FileDelete($folder & "\*.txt")
    3 points
  2. I dont make scripts for people who dont properly sanitize their input, its gross
    2 points
  3. Jos

    Help me

    Seriously? I like to be taken serious so we are done with your questions here, and don't start this in a new thread again. *cick*
    2 points
  4. @iamtheky Not foolproof, see aditional blank In customer Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Customer Rec#: 123457, PHone Number#: 555-555-1212" msgbox(0, '' , StringLeft((stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1)) , (StringInStr(stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1) , ",") - 1)),2) ;~ Not foolproof, see aditional blank In customer ---------------------------------v Global $A = "Customer Name: John Smith, Address: 1234 Main Street, Chicago, IL, Cus tomer Rec#: 123457, PHone Number#: 555-555-1212" msgbox(0, '' , StringLeft((stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1)) , (StringInStr(stringmid($A , StringInStr($A , "Customer Rec#: ") + StringLen("Customer Rec#: ") - 1) , ",") - 1)))
    1 point
  5. abberration

    I need some help!

    one way is to make part of your script into a function and call that function when you push the button.
    1 point
  6. Dustbeen43

    Multi-Tasking UDF

    For people who wants to haver another example of the utility of this lib, here is my script : "GIJOE". I'am launching 2 threads and both threads has its own procedure and they are communicating with shared variables. The logic here is that the Thread 1 (Charly) is covering the back of the Thread 2 (Tango). If T1 is in combat then he changed his variable to say that he is in combat (so T2 is paused during the fight and he is resumed after the end of the combat). T1 has 6 HP ( while $loop < 7 but you can change it ) so if thread 2 has not finished before the secund fight (one fight every 3 rounds) then the thread 1 wil stopped. In that case T2 has to stopped because T1 has stopped. The Thead 2 (Tango) is the twin of the first one. He's goal is to arrive in a destination which is at a distance of 9 ( while $loop < 10 but you can change it ) so if the T2 arrives before the thread 1 then T2 stops too. With the original script, T1 will die before T2 but you can change the condition of both while to see the 2 different case. NB : each script has it's own logfile so you can see actions both thread are doing. NB2: "MultiTasking.au3" and its dependancies must be in the same directory of the file. I want to thanks Network_guy for this lib and trancexx wich provide parts of this libs too. GIJOE.au3
    1 point
  7. Marc

    Just delete the txt file?

    $file = FileSelectFolder("Select Folder", @ScriptDir) If $file = "" Or @error Then Exit $FileSearch = FileFindFirstFile($file & "\*.txt") If $FileSearch <> -1 Then While 1 $FileFind = FileFindNextFile($FileSearch) If @error Then ExitLoop FileDelete($file & "\" & $FileFind) Sleep(500) FileClose($FileSearch) WEnd EndIf
    1 point
  8. jchd

    RegExp help

    Successive empty captures in the resulting array are there because there is a difference between Perl regex and legacy PCRE1 regex (which current AutoIt implements). PCRE2 (is 4 year old already) now conforms to Perl with respect of unwanted empty captures but it isn't the version AutoIt uses. Yet you can overcome this behavior difference by using the (?| ) construct: Local $s = "artist=MyArtist&title=MySong&album=TheBestOf&year=2019&type=Music" Local $r = StringRegExp($s, "(?|(?:artist=([^&]*))|(?:title=([^&]*))|(?:album=([^&]*))|(?:year=([^&]*))|(?:type=([^&]*)))", 3) _ArrayDisplay($r) But that doesn't solve the issue of unordered, extra or missing elements. To do that you need another idea: Local $aData = [ _ "title=MySong&album=TheBestOf&year=2019&artist=MyArtist&type=Music", _ "comment=this is pure junk&title=MySong&year=2019&artist=MyArtist&album=TheBestOf&type=Music", _ "title=MySong&year=2019&comment=excellent title&artist=MyArtist&album=TheBestOf" _ ] Local Static $aKeys = ["artist", "album", "year", "title", "type", "comment"] Local $d = ObjCreate("Scripting.Dictionary"), $dummy For $s In $aData $dummy = Execute(StringRegExpReplace($s, "(\w+)=([^&]*)&?", "$d.Add(""$1"", ""$2"") & ") & '""') For $k In $aKeys ConsoleWrite($k & " -> " & $d.Item($k) & @LF) Next ConsoleWrite(@CRLF) $d.RemoveAll Next This way you can add as many potential elements and pick them in fixed order.
    1 point
  9. diepfeile

    Maps (beta)

    I wanted to create a HTML entity replacer. I solved it with a local static and an if-clause: Func HTMLDecode(ByRef $sHTML) $aEntities = StringRegExp($sHTML, '&(?>[A-z]+|#\d{2,4});', 3) ;_ArrayDisplay($aEntities,'$aEntities') ;CW('UBound($aEntities) ' & UBound($aEntities) & ' ' & IsArray($aEntities)) If IsArray($aEntities) = False Then Return ; nothing to replace... Local $mDistictEntities[] For $i = 0 To UBound($aEntities) - 1 $mDistictEntities[$aEntities[$i]] += 1 Next ;_ArrayDisplay(MapKeys($mDistictEntities),'MapKeys($mDistictEntities)') ;CW(MapToString($mDistictEntities)) ;FileWrite('HTML Entities.txt', MapToString($mDistictEntities) & @CRLF & @CRLF) Local Static $mHTMLEntities[] ; https://de.wikipedia.org/wiki/Hilfe:Sonderzeichenreferenz If UBound($mHTMLEntities) = 0 Then $mHTMLEntities['&#34;'] = '"' $mHTMLEntities['&quot;'] = '"' $mHTMLEntities['&amp;'] = '&' ; 38 $mHTMLEntities['&#39;'] = "'" $mHTMLEntities['&gt;'] = '>' ; 62 $mHTMLEntities['&#160;'] = ' ' ; 160 $mHTMLEntities['&nbsp;'] = ' ' ; 160 $mHTMLEntities['&#169;'] = '©' $mHTMLEntities['&copy;'] = '©' ; 169 $mHTMLEntities['&#171;'] = '«' ; 171 Guillemet linksweisend („französisches Anführungszeichen“) $mHTMLEntities['&laquo;'] = '«' ; 171 Guillemet linksweisend („französisches Anführungszeichen“) $mHTMLEntities['&shy;'] = '­' ; 173 Trennmöglichkeit, weiches Trennzeichen (soft hyphen) $mHTMLEntities['&#187;'] = '»' ; 187 Guillemet rechtsweisend („französisches Anführungszeichen“) $mHTMLEntities['&raquo;'] = '»' ; 187 Guillemet rechtsweisend („französisches Anführungszeichen“) $mHTMLEntities['&Aacute;'] = 'Á' ; 193 $mHTMLEntities['&Eacute;'] = 'É' ; 201 $mHTMLEntities['&#233;'] = 'é' $mHTMLEntities['&#196;'] = 'Ä' $mHTMLEntities['&Auml;'] = 'Ä' ; 196 $mHTMLEntities['&#214;'] = 'Ö' $mHTMLEntities['&Ouml;'] = 'Ö' ; 214 $mHTMLEntities['&#220;'] = 'Ü' $mHTMLEntities['&Uuml;'] = 'Ü' ; 220 $mHTMLEntities['&#223;'] = 'ß' $mHTMLEntities['&szlig;'] = 'ß' $mHTMLEntities['&#228;'] = 'ä' $mHTMLEntities['&auml;'] = 'ä' $mHTMLEntities['&#232;'] = 'è' $mHTMLEntities['&#246;'] = 'ö' $mHTMLEntities['&ouml;'] = 'ö' $mHTMLEntities['&#252;'] = 'ü' $mHTMLEntities['&uuml;'] = 'ü' $mHTMLEntities['&#305;'] = 'ı' ; Turksprachen, ähnlich 'i' $mHTMLEntities['&#351;'] = 'ş' ; Turksprachen, Deutsch: sch $mHTMLEntities['&#776;'] = '̈' ; Kombinierendes Trema: macht aus normalen Buchstaben Umlaute $mHTMLEntities['&#8201;'] = ' ' ; schmales Leerzeichen $mHTMLEntities['&thinsp;'] = ' ' ; 8201 schmales Leerzeichen $mHTMLEntities['&#8203;'] = '' ; breitenloses Leerzeichen (Trennmöglichkeit) $mHTMLEntities['&#8211;'] = '–' ; 8211 Halbgeviertstrich (Gedankenstrich) $mHTMLEntities['&ndash;'] = '–' ; 8211 Halbgeviertstrich (Gedankenstrich) $mHTMLEntities['&#8216;'] = '‘' ; einfaches Anführungszeichen (englisch: öffnend, deutsch: schließend) $mHTMLEntities['&#8217;'] = '’' ; einfaches Anführungszeichen schließend (englisch); typographisch korrekter Apostroph $mHTMLEntities['&#8218;'] = '‚' ; einfaches Anführungszeichen unten (deutsch öffnend) $mHTMLEntities['&ldquo;'] = '“' ; 8220 $mHTMLEntities['&bdquo;'] = '„' ; 8222 ;&#8232; ??? $mHTMLEntities['&#8364;'] = '€' ; 8364 $mHTMLEntities['&euro;'] = '€' ; 8364 $mHTMLEntities['&#9733;'] = '★' ; Schwarzer Stern EndIf For $vKey In MapKeys($mDistictEntities) If MapExists($mHTMLEntities, $vKey) = False Then ClipPut($vKey) MsgBox(0, 'HTML Entity Decode missing!', $vKey) EndIf ;CW($vKey& ' - ' & $mHTMLEntities[$vKey]) $sHTML = StringReplace($sHTML, $vKey, $mHTMLEntities[$vKey], 0, 1) Next EndFunc ;==>HTMLDecode
    1 point
  10. TheDcoder

    Maps (beta)

    If anyone has difficulties visualizing maps, my Map UDF has a handy _Map_Display function which displays the contents of a map in a neat GUI
    1 point
  11. #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cLabel = GUICtrlCreateLabel("", 9, 9, 202, 22) GUICtrlSetState($cLabel, $GUI_DISABLE) GUICtrlSetBkColor($cLabel, 0xFF0000) $cInput = GUICtrlCreateInput("", 10, 10, 200, 20, -1, 0) ; <------ GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit EndSwitch WEnd
    1 point
  12. guinness

    AutoIt Snippets

    ConsoleWrite('CPU Name: ' & _GetCPUName() & @CRLF) ; Version: 1.00. AutoIt: V3.3.8.1 ; Retrieve the name of the CPU. Func _GetCPUName() Local $oWMIService = ObjGet('winmgmts:{impersonationLevel = impersonate}!.rootcimv2') Local $oColFiles = $oWMIService.ExecQuery('Select * From Win32_Processor') If IsObj($oColFiles) Then For $oObjectFile In $oColFiles Return StringStripWS($oObjectFile.Name, 7) Next EndIf Return SetError(1, 0, '') EndFunc ;==>_GetCPUName
    1 point
×
×
  • Create New...