Jump to content

iamtheky

Active Members
  • Posts

    4,646
  • Joined

  • Last visited

  • Days Won

    46

iamtheky last won the day on July 1 2019

iamtheky had the most liked content!

About iamtheky

  • Birthday 11/14/1979

Profile Information

  • Member Title
    þヨⓡᅷ∈℃⊥
  • Location
    Tx

Recent Profile Visitors

3,563 profile views

iamtheky's Achievements

  1. calling them back the way trancexx suggested in the above thread is the only way dictionary in dictionary ever really played nice for me (the add keyvaluepair function is just a wrapped add).
  2. Your line looks for everything between "BOOK<colon><space>" and the next <space>" Your example does not contain the string BOOK, but if it followed that pattern would be "BOOK<space><colon><space>" You probably just want everything between your target and the carriage return Local $aFileRead = _StringBetween($sFileRead, "BOOK: ", @CRLF)
  3. while "remove any character if preceded by 4 characters" is solid Is this task also: "remove any letter that is followed by whitespace"... maybe room to speed it up there? $txt = "g1f1 h3h2 f1e2 h2h1q a1h1 h8h1 f2f3n h1h4" & @crlf & _ "g1f3 h3h2 f1e2 h2h1n a1h1 h8h1 f4f1 h1h3" & @crlf & _ "f2f8 e7f8 e4f2 h3h2 e3e4 d5e4 f2e4 h2h1q d4g1 h1e4 g1f2 g7g5" msgbox (0, '' , StringRegExpReplace($txt , "\D\s" , " "))
  4. you know i dont know what any of those characters mean. if i cant .*? it, i use yours.
  5. it seems to do the thing. However, if you just want two groups "date / everything else" and if all of your titles have a parenthetical 4 digit year at the end of the string, then i would be specific about the number of digits and end of the string. Scoops up a bunch of edge cases with a small modification. $s = "Movie (0000) (part1000) (2002)" ;~ $a = stringregexp($s , "([^\\]*?)\h*\((\d+)\)" , 3) ;~ _ArrayDisplay($a) $a = stringregexp($s , "(.*?)(\(\d{4}\)\z)" , 3) _ArrayDisplay($a)
  6. working backwards, looks like you just need to replace the dividers. Can probably run them all through the same func. #include<array.au3> local $aTest[6]=["C:\test1\test2\test3" , "C:\\test1\\test2\\test3" , "C:\\\test1\\\\test2\\\\test3" , "C:/test1/test2/test3" , "C:///test1///test2///test3" , "C:////test1////test2/////test3" ] $aScriptDir = stringsplit(@ScriptDir , "\" , 2) For $i = 0 to ubound($aTest) - 1 $sDiv = stringregexp($aTest[$i] , "\w:(.*?)\w" , 3)[0] $aTest[$i] = "" For $j = 0 to ubound($aScriptDir) - 1 $aTest[$i] &= $aScriptDir[$j] & $sDiv Next Next _ArrayDisplay($aTest) try 2, same result (hopefully) but a little more portable. probably still needs cleaning to verify the drive letter and catch edge cases, but definitely doable. #include<array.au3> local $aTest[6]=["C:\test1\test2\test3" , "C:\\test1\\test2\\test3" , "C:\\\test1\\\\test2\\\\test3" , "C:/test1/test2/test3" , "C:///test1///test2///test3" , "C:////test1////test2/////test3" ] For $i = 0 to ubound($aTest) - 1 $aTest[$i] = StringReplace(@ScriptDir , "\" , stringregexp($aTest[$i] , "\w:(.*?)\w" , 3)[0]) Next _ArrayDisplay($aTest)
  7. key = 0-1 And the map UDFs that move beyond the handful of core functions could definitely stand a revisit (at least once every 4 years). I think my https://www.autoitscript.com/forum/topic/174758-scriptingdictionary-in-the-role-of-map/ may suffer from bloat more than the others, but things like the _Map_Append function wrap a one liner that takes less characters to write than the function call. But going down those trails allow you to pull off tricks that I would like to see incorporated more, like this mapappend fun:
  8. Teams is Sharepoint. (the calls are coming from inside the house!!) - open your https://delve.office[.]com (or if govcloud https://delve-gcc.office[.]com/) From there you can hit the ellipses and copy the ugly link. Use one of those as the template. Also, switching to the UNC path... edit: just had a thought about cloud shell but i need to go try it rather than yolo it into your thead
  9. the helpfile also states so: local $aArray[6] = [1,2,3,2,5,2] $aDel = _ArrayFindAll($aArray , 2) _ArrayDelete($aArray , _ArrayToString($aDel , ";")) _ArrayDisplay($aArray) or reduced local $aArray[6] = [1,2,3,2,5,2] _ArrayDelete($aArray , _ArrayToString(_ArrayFindAll($aArray , 2) , ";")) _ArrayDisplay($aArray)
  10. In addition to all of the optimization suggestions, you have fundamental issues, the return from the run command is the PID not the STDOUT. You can then use the PID to read the output of the command. But WMI is already slow without asking powershell to ask WMI. ;#RequireAdmin #include <Constants.au3> #include <Array.au3> $pidPrintlist = Run("powershell.exe get-printer" , @SystemDir , @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($pidPrintlist) $out = StdoutRead($pidPrintlist) _ArrayDisplay(stringsplit($out , @CR , 2)) yeah, pretty much what @Deye said at the same time he said it
  11. #include<array.au3> msgbox(0, '' , _ArrayToString(FileReadToArray("test.txt") , @LF , @extended - 10)) this one only pulls the last 10 $fTest = fileopen("test.txt") $i = 10 $sOut = "" $total = ubound(filereadtoarray($ftest)) ;_filecountlines($ftest) do $sOut &= FileReadLine($fTest , $total - $i) & @LF $i -= 1 until $i = 0 fileclose($ftest) msgbox(0, '' , $sOut)
  12. Based off CheckEE creates a custom exe that fileinstalls only the payload assigned to the variable 'filename'. Some of it unnecessary, Rube Goldberg style. ;~ ;----------------------------------------------------- ;#Local Variables Local $Check_EE ;~ ;----------------------------------------------------- ;~ ;----------------------------------------------------- $Check_EE = "A" ;--- IF $Check_EE == "A" Then assign("filename" , "A.exe") ElseIF $Check_EE == "B" Then assign("filename" , "B.exe") ElseIF $Check_EE == "C" Then assign("filename" , "B.exe") EndIF ;--- $tgtfile = "testfileinstall_writeonfly_" & $Check_EE ; file name based off result of If FileWrite($tgtfile & ".au3" , 'FileInstall("' & @ScriptDir & '\' & eval("filename") & '", "' & @ScriptDir & '\test\' & eval("filename") & '")') ; Write the au3 that does the thing you want runwait("cmd /c " & FileGetShortName(@ProgramFilesDir) & "\AutoIt3\Aut2Exe\Aut2exe.exe /in " & @ScriptDir & "\" & $tgtfile & ".au3") ; compiles that au3 to an exe of the same name in the same dir ;~ run(@ScriptDir & "\" & $tgtfile & ".exe") ; runs that exe
  13. - If you can F5 it you can make it happen on the target. Boredom made me give the question a plausible backstory like a server building custom deploys. Asking if that's the optimal way to gather/stage files is what I would do if I wasnt stuck in quarantine, instead I am going to spend a couple of days to relearn all the fun ways to write droppers. - At worst, you have all the information at the end of that function to have the script write the line into a separate au3 on the fly and fire it. And you find 1 or both of those to be Sisyphean? I don’t see this ending with “you can’t” so much as in a sea of workarounds.
  14. wrapping shit in execute like this doesnt work either, it gets past the compiler but the resulting script fails. This might entertain while we find a fun way to pull it off without too much maneuvering. *Also, i feel that there is a long thread on this topic somewhere on the forum, but i cant find it yet. ftr, gets past compiler, does not work once compiled: ;----------------------------------------------------- ;#Local Variables Local $Check_EE ;----------------------------------------------------- ;----------------------------------------------------- $Check_EE = "A" ;--- IF $Check_EE == "A" Then assign("filename" , "A.exe") ElseIF $Check_EE == "B" Then assign("filename" , "B.exe") ElseIF $Check_EE == "C" Then assign("filename" , "B.exe") EndIF ;--- execute('FileInstall (@ScriptDir & "\" & eval("filename"), @ScriptDir & "\test\" & eval("filename"), 1)')
  15. you can, but not like that ;----------------------------------------------------- ;#Local Variables Local $Check_EE ;----------------------------------------------------- ;----------------------------------------------------- $Check_EE = "A" ;--- IF $Check_EE == "A" Then assign("filename" , "A.exe") ElseIF $Check_EE == "B" Then assign("filename" , "B.exe") ElseIF $Check_EE == "C" Then assign("filename" , "B.exe") EndIF ;--- FileInstall (@ScriptDir & "\" & eval("filename"), @ScriptDir & "\test\" & eval("filename"), 1)
×
×
  • Create New...