Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/08/2020 in all areas

  1. jchd

    Regex on array

    Something like this: #include <Array.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $sText = FileRead("C:\Users\User\Desktop\autoit\test2.txt") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) Local $aWords = StringRegExp($sText, '[a-z]{7,}' ,$STR_REGEXPARRAYFULLMATCH) _ArrayDisplay($aWords) EndFunc
    1 point
  2. Local $iMove = -4 $old = "G1 X45.036 Y6.934 F7800.000 G1 Z0.600 F7800.000 G1 F900 G1 X48.036 Y1.076 E0.58925" $new = Execute("'" & StringRegExpReplace($old, "(?<=X)\d+.\d+", "' & Execute('$0+' & $iMove) & '") & "'") Msgbox(0,"", $old & @crlf & $new)
    1 point
  3. Hello everyone, Just a small but important update, as of today I have officially started work on the project, and I have chosen to name it EasyCodeIt There are a handful of reasons why I chose that name: It reflects one of the important goals, keeping it easy to code It somewhat makes sense and rhymes with AutoIt By far, it is the only name which hasn't been used by others (DuckDuckGo shows that no results contain that word) It is shorter than other potential names while still being meaningful ...there might be other reasons which I cannot recall right now If I come across a better name, I might change it still, so nothing is set in concrete. I am licensing the code under GPL (v3), a newer version of the same license under which AutoIt3 used to be under. I don't really have a problem with others forking my code, but I sure do not want the forks to be closed source, that is the reason why I did not choose a 100% free license. Eventually we would need exceptions down the road to allow binary distribution of executable without having to require disclosing their own source code. My current aim is to build a bare-minimum cross-platform interpreter which can act as a proof-of-concept, and we can build from there I will release the code publicly once I actually finish something presentable, right now my code is not very different than a simple imitation of command-line tools like cat or type
    1 point
  4. jchd

    Regex on array

    So why split the file line by line? Read the whole file and apply the regex on it.
    1 point
  5. @mucitbey, in this forum we do not encourage resurrecting old topics, even if your issue does have some similarity to the original topic. in the future, unless you have something to contribute to a recently-active topic, please start a new topic. now, how about you try "shutdown.exe -i" and see how that works for you?
    1 point
  6. Melba23

    Regex on array

    doggy, Welcome to the AutoIt forums. StrinRegExp only works on strings, not whole arrays, so you will have to loop through the array and test each element. M23
    1 point
  7. Jos

    Regex on array

    Regex doesn't work on an Array but rather a String, so you need to loop through the array and test the one at the time. Jos
    1 point
  8. Not sure... since I can't access the site. You could try something like this -- _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='rollback_bodi']/optgroup[1]/option[1]") P.S. Take a look at the ChroPath add-in.
    1 point
  9. Add case else then add a for ... next loop Opt ( 'TrayMenuMode', 3 ) Local $iNumber = InputBox ( 'Test', 'Enter the number of tray icon menu items:' ) ; Request number of tray icon menu items from User Local $aItemLabels[$iNumber + 1] ; Create array to hold tray icon menu item labels Local $idMenuItem[$iNumber + 1] ; Create array to hold menu item handles For $iFoo = 1 to $iNumber ; Assign a label to each menu item $aItemLabels[$iFoo] = 'Item #' & String ( $iFoo ) ; Create label $idMenuItem[$iFoo] = TrayCreateItem ( $aItemLabels[$iFoo] ) ; Create handle Next ; End loop $idTrayExit = TrayCreateItem ( 'Exit' ) ; Create a way to gracefully exit While 1 ; Create loop to monitor actions taken on tray menu $iMsg = TrayGetMsg() ; Store actions taken on tray menu Switch $iMsg ; Do one of the following depending on actions taken Case $idTrayExit ; User clicked 'Exit'. Exit ; Exit ;Case $idMenuItem[x] ; How do I handle an unknown number of tray items? ; MsgBox ( 4096, 'Response', 'You clicked on ' & $aItemLabels[x] ) ; case Else for $tmp=1 to $iNumber if $iMsg=$IdMenuItem[$tmp] then MsgBox (0,"Trayitem",$tmp) Next EndSwitch ; WEnd
    1 point
  10. Jos

    ResourcesEx UDF.

    Just use the FileInstall() function for that. Jos
    1 point
  11. Non regex version: #include <StringConstants.au3> $data = '2020-06-08 09:23:33 : abcdefghifjklm' ConsoleWrite(StringStripWS(StringMid($data, 1 + StringInStr($data, ":", 0, -1)), BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) & @CRLF)
    1 point
  12. Something like this?: $data = '2020-06-08 09:23:33 : abcdefghifjklm' $RightPart = StringRegExpReplace($data,".*:(.*?)","$1") ConsoleWrite(' $RightPart = ' & $RightPart & @CRLF) Jos
    1 point
  13. have to think there is a regex solution to be had...something heading down the path of #Include <Array.au3> Local $a[2][2] = [[0,1],[10,20]] $s = StringRegExpReplace(_ArrayToString($a) , "(\d+)" , "\1 + 5") local $aNew[0][2] _ArrayAdd($aNew , $s) _ArrayDisplay($aNew)
    1 point
×
×
  • Create New...