Leaderboard
Popular Content
Showing content with the highest reputation on 04/30/2020 in all areas
-
@FrancescoDiMuro Your expression allows 5.% - which is inconsistent Please try this #Include <Array.au3> $s = "Ford Prius 1%" & @crlf & _ "DW-4 6.66% test" & @crlf & _ "DW-4 6.%" & @crlf & _ "DW-4 2.50%" & @crlf & _ "Cotton Candy Non Circus7.5%" & @crlf& _ "Francos Absolute .5%" $res = StringRegExp($s, '(?m)((?:\d*\.?\d+)%)$', 3) _ArrayDisplay($res)2 points
-
This is an update or derivative work of Beege 's Scrolling Line Graph UDF https://www.autoitscript.com/forum/topic/109599-scrolling-line-graph-udf I noticed a few issues for my use case with the UDF one being that adding a sample required updating the waveform High CPU usage went hand in hand with that requirement Another issue was just how long updating took to complete I've hopefully rectified that with this version There are a few changes (only 1 line per graph for instance) The addition of a function AddSample (uses graphics paths to speed up drawing samples on update) Gridlines are only generated once A sample finished line can be added UpdateGraph allows you to compress the discarded portion of the graph (it looks kinda cool but uses more CPU) Lower Cpu usage Uses real Control Ids - it is a label control underneath so you get click events and can display text when control is disabled Example (Waveform.au3) Example 2 (peak.au3) UDF Updated: Previous Downloads [38 / 38/ 0] SSLG.au3 waveform.au3 Peak.au31 point
-
1 point
-
LNKSubstringReplacer Link LNK Path Substring Replacer
maniootek reacted to robertcollier4 for a topic
Choose a directory of link files to replace substring paths. Also gives you a full display (text) of your LNK files. #include <Array.au3> #include <_RecFileListToArray.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #Include <GUIEdit.au3> Local $dirToSearchDefault = @ProgramsCommonDir ; Local $dirToSearchDefault = "D:\testdir" Local $dirToSearch = InputBox("Select directory", "In which directory are your LNK files?", $dirToSearchDefault, "", 520, 320) If $dirToSearch = "" Then Exit EndIf Local $listFiles = _RecFileListToArray($dirToSearchDefault, "*", 1, 1, 0, 2) If (Not IsArray($listFiles)) and (@Error=1) Then MsgBox (0,"","No files found in search path, exiting") Exit EndIf ;--------------------------------------------------------------- ;Displaying list of Link LNK in GUI Editbox Local $ThisTodisplayList = "LNK Files Found In: " & $dirToSearch & @CRLF & @CRLF $ThisTodisplayList &= "========================" & @CRLF Local $ThisTodisplayDrive = "", $ThisTodisplayDir = "", $ThisTodisplayFilename = "", $ThisTodisplayExtension = "" For $i = 1 To $listFiles[0] Local $listFilesPathSplit = _PathSplit($listFiles[$i], $ThisTodisplayDrive, $ThisTodisplayDir, $ThisTodisplayFilename, $ThisTodisplayExtension) If(StringCompare(".lnk", $ThisTodisplayExtension, 2) == 0) Then ;Local $ThisTodisplayLNK = f$listFiles[$i] Local $thisToDisplayLNKArray = FileGetShortcut($listFiles[$i]) If(NOT @error) Then If($thisToDisplayLNKArray[0] <> "") Then ;_ArrayDisplay($thisToDisplayLNKArray) ;$ThisTodisplayLNKtarget = $thisToDisplayLNKArray[0] ;$ThisTodisplayLNKargs = $thisToDisplayLNKArray[2] ;$ThisTodisplayLNKworkingdir = $thisToDisplayLNKArray[1] $ThisTodisplayList &= "LNK: " & $ThisTodisplayDrive & $ThisTodisplayDir & $ThisTodisplayFilename & $ThisTodisplayExtension & @CRLF $ThisTodisplayList &= "Target: " & $thisToDisplayLNKArray[0] & " " & $thisToDisplayLNKArray[2] & @CRLF $ThisTodisplayList &= "Workingdir:" & $thisToDisplayLNKArray[1] & @CRLF $ThisTodisplayList &= @CRLF $ThisTodisplayList &= "========================" & @CRLF EndIf EndIf EndIf Next ; _ArrayDisplay($listFiles, "$aFileList") $GuiTodisplay = GUICreate("Summary of LNK Files Found In: " & $dirToSearch, 1152, 864) ; Local $idTreeview = GUICtrlCreateTreeView(6, 6, 1152, 1046, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $hEdit = GUICtrlCreateEdit($ThisTodisplayList, 4, 4, 1144, 772, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) $hButtonContinue = GUICtrlCreateButton("Continue", 4, 776, 1144, 80) GUICtrlSetState($hButtonContinue ,$GUI_DEFBUTTON) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GuiDelete($GuiTodisplay) ExitLoop Case $hButtonContinue GuiDelete($GuiTodisplay) ExitLoop EndSwitch WEnd ;Displaying list of Link LNK in GUI Editbox ;--------------------------------------------------------------- $modalSimulMode = MsgBox (3, "Simulated mode?" ,"Would you like to perform this substring replacement of link files in simulated mode? In simulated mode you will see what would have happened in a file named" & @CRLF & "LNKSubstringReplacer Results.txt" & @CRLF & @CRLF & "but no changes will be made" & @CRLF & @CRLF & "Yes - simulated mode, no changes will be made" & @CRLF & "No - resaving mode, changes will be made") If $modalSimulMode = 2 Then Exit ElseIf $modalSimulMode = 6 Then $saveAgain = False ElseIf $modalSimulMode = 7 Then $saveAgain = True ElseIf MsgBox(0, "ERROR", "Error with asking simulated mode, exiting") EndIf Local $StrToSearch = InputBox("Specify substring to search for", "What substring would you like to be replaced for link target and link working directory?", "", "", 520, 320) ; If $StrToSearch = "" Then ; allow empty input in case just want to resave and fix all links If @error = 1 Then Exit EndIf Local $StrToReplace = InputBox("Specify substring to replace with", "All occurrences of" & @CRLF & $StrToSearch & @CRLF & @CRLF & "Contained in links in the directory " & @CRLF & $dirToSearch & @CRLF & @CRLF & "Should be replaced with what?", $StrToSearch, "", 520, 320) ; If $StrToSearch = "" Then ; allow empty input in case just want to resave and fix all links If @error = 1 Then Exit EndIf ; Processing ; Write simulated results to a text file $dateNow = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC $fileLnkPath = @ScriptDir & "\" & $dateNow & " LNKSubstringReplacer Results.txt" FileDelete($fileLnkPath) Local $fileTextList = FileOpen($fileLnkPath, $FO_APPEND) If $fileTextList = -1 Then MsgBox(0, $fileLnkPath, "FileOpen Error, exiting") Exit EndIf FileWrite($fileTextList, "---------------------------------------" & @CRLF) FileWrite($fileTextList, "Link file to scan" & @CRLF) FileWrite($fileTextList, "Link target" & @CRLF) FileWrite($fileTextList, "Link working directory" & @CRLF) Local $thisExtension = "" Local $sDrive = "", $sDir = "", $ThisTodisplayLNKFilename = "" For $i = 1 To $listFiles[0] ; Only do LNK extension Local $listFilesPathSplit = _PathSplit($listFiles[$i], $sDrive, $sDir, $ThisTodisplayLNKFilename, $thisExtension) ; MsgBox(0, $i, $listFiles[$i] & " , " & $thisExtension) If(StringCompare(".lnk", $thisExtension, 2) == 0) Then ; If(NOT StringCompare(".lnk", $thisExtension, 2)) Then Local $thislnkArray = FileGetShortcut($listFiles[$i]) If(NOT @error) Then If($thislnkArray[0] <> "") Then ; _ArrayDisplay($lnkArray) If( StringInStr($thislnkArray[0], $StrToSearch) Or StringInStr($thislnkArray[2], $StrToSearch) Or StringInStr($thislnkArray[1], $StrToSearch) ) Then FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) ; FileWrite($fileTextList, $thislnkArray[0] & @CRLF) ; FileWrite($fileTextList, $thislnkArray[2] & @CRLF) FileWrite($fileTextList, $thislnkArray[0] & $thislnkArray[2] & @CRLF) FileWrite($fileTextList, $thislnkArray[1] & @CRLF) ; Allow empty $StrToSearch or empty $strToReplace just to fix and resave all links If( ($StrToSearch = "") OR ($StrToReplace = "") ) Then $newLinkTarget = RemoveSurrQuotes($thislnkArray[0]) $newLinkTargetArgs = $thislnkArray[2] $newLinkWorkingDir = RemoveSurrQuotes($thislnkArray[1]) Else $newLinkTarget = RemoveSurrQuotes(StringReplace($thislnkArray[0], $StrToSearch, $StrToReplace)) $newLinkTargetArgs = StringReplace($thislnkArray[2], $StrToSearch, $StrToReplace) $newLinkWorkingDir = RemoveSurrQuotes(StringReplace($thislnkArray[1], $StrToSearch, $StrToReplace)) EndIf ; Remove ending backslash from working dir While (StringRight($newLinkWorkingDir, 1) = "\") $newLinkWorkingDir = StringTrimRight($newLinkWorkingDir, 1) WEnd If($saveAgain) Then FileWrite($fileTextList, @CRLF & "found " & @CRLF & "Resaved:" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, $newLinkTarget & " " & $newLinkTargetArgs & @CRLF) FileWrite($fileTextList, $newLinkWorkingDir & @CRLF) $saveResult = FileCreateShortcut( _ $newLinkTarget, _ $listFiles[$i], _ $newLinkWorkingDir, _ $newLinkTargetArgs, _ $thislnkArray[3], _ $thislnkArray[4], _ "", _ $thislnkArray[5], _ $thislnkArray[6] _ ) If(NOT $saveResult) Then FileWrite($fileTextList, "ERROR Unable to resave: " & $listFiles[$i] & @CRLF) EndIf Else FileWrite($fileTextList, @CRLF & "found " & @CRLF & "Simulated Resave:" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, $newLinkTarget & " " & $newLinkTargetArgs & @CRLF) FileWrite($fileTextList, $newLinkWorkingDir & @CRLF) EndIf EndIf Else FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, "Found empty link target, skipping " & @CRLF) EndIf Else FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) FileWrite($fileTextList, $listFiles[$i] & @CRLF) FileWrite($fileTextList, "FileGetShortcut Error, skipping " & @CRLF) Exit EndIf ;Else ; FileWrite($fileTextList, @CRLF & "---------------------------------------" & @CRLF) ; FileWrite($fileTextList, $listFiles[$i] & @CRLF) ; FileWrite($fileTextList, "Skipping not a link file" & @CRLF) EndIf Next FileClose($fileTextList) MsgBox (64,"Done - Check Log for details","Done - Check Log for details of what was done:" & @CRLF & @CRLF & $fileLnkPath) ;--------------------------------------------------------------- Func RemoveSurrQuotes($myString) Return StringReplace($myString, '"', '') EndFunc ;--------------------------------------- LNKSubstringReplacer.au3 _RecFileListToArray.au31 point -
Local $Empfehlung[4] $Empfehlung[0] = "Option A " $Empfehlung[1] = "Option B " $Empfehlung[2] = "Option C" $Empfehlung[3] = "Option D" ClipPut($Empfehlung[Random(0, 3, 1)]) Thank you for all your contributions. This is what i used and this works absolutely perfect. Thank you so much guys.1 point
-
something like this: $CMD = 'netsh interface ipv4 set address "' & $Networkname & '" static 192.168.2.5 255.255.255.0 192.168.2.254'1 point
-
Your original idea was not far from possible, thing is, when you set the array variables, you included the consolewrites, that was the problem. The idea when you set the variables is you set the actual values you want to use. Global $aCommand[6] $aCommand[0] = "Option 1" $aCommand[1] = "Option 2" $aCommand[2] = "Option 3" $aCommand[3] = "Option 4" $aCommand[4] = "Option 5" $aCommand[5] = "Option 6" $RNum = Random(0,5,1) ConsoleWrite($aCommand[$RNum]&@CRLF)1 point
-
... one of possible ways ... #include <GUIConstantsEx.au3> Example() Func Example() ; populate the array with sentences Local $aSentences[] = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5", "Option 6"] Local $hGui = GUICreate("Random sentence") ; create the gui Local $hField = GUICtrlCreateInput('', 5, 5); the input field Local $hButton = GUICtrlCreateButton("Oracle", 5, 35) ; the button GUISetState() ; show the gui ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton ; if the button was clicked to the following ; Change sentence in the input field GUICtrlSetData($hField, $aSentences[Random(0, UBound($aSentences) - 1, 1)]) EndSwitch WEnd EndFunc ;==>Example1 point
-
try to use https://www.autoitscript.com/autoit3/docs/functions/Random.htm load with https://www.autoitscript.com/autoit3/docs/functions/FileReadToArray.htm a word in page .txt , after with random , call a segment of array and insert inside of input use F1 in scite1 point
-
Hi @MrCreatoR. I think you're asking if AutoItObject Internal can be used with ObjGet? This is something that CAN work, but for me it's in the alpha stage. I have unpublished code, where this works somewhat by registering an object with the Running Object Table, but I have yet to solve an issue where the obj ref count gets messed up, due to Release being called more times than the AddRef method for some strange reason. My theory is that i somehow handle the QueryInterface method wrong in some cases, but i have yet to find the precise problem. TLDR; not currently, sorry.1 point
-
I have recently been looking into how to use the DLL functions under process management in order to create an autoit udf which acts as a wrapper around a c library. However, having little experience, I was looking for tools to help me better understand how to make calls to C library functions in a dll and found this really interesting and powerful tool called API Monitor. This tool lets you monitor and control API calls made by applications and services, allows you to see how applications and services work, and allows you to track down problems that you have in your own applications. I was able to use the tool to monitor a portable application which uses the C library I want to create a udf for, and have it display all of the api calls it made to that C library specifically after running a command. Thought maybe it might be useful to others too.1 point