Jump to content

Leaderboard

Popular Content

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

  1. 3 points
  2. I tried once to make it recursive, that was a 2B-buster...Brain and Balls
    2 points
  3. THANK YOU!!!! I got code working for variable length bits (specifically for BitNOT) up to 48 bits but this will work!
    1 point
  4. roeselpi, As the substitution algorithm for the value to insert into $workarray03 based on the values in $workarray01/02 is extremely simple you can shorten the code quite a lot - just look for my comments in the <<<<<<<<<<< lines: #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <String.au3> Global $maxsize = 8 ; Declare this here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; ---------------------------------------------------------------- ; PART A: GUI ; ---------------------------------------------------------------- ; not needed here for demonstration (is not built yet anyway) ; ---------------------------------------------------------------- ; PART B: declare all variables that are for the basic functioning ; ---------------------------------------------------------------- ; Covert these individual values to arrays <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; ---------- for testing: $a will be alphabetical chars Global $arrayletter[$maxsize] = ["A", "B", "C", "D", "E", "F", "G", "H"] ; ---------- for testing: $n will be numerical chars Global $arraynumber[$maxsize] = [11, 12, 13, 14, 21, 22, 23, 24] ; ------------------------------------------------------------------ ; Forum-Information: ; For Simplification: A=11, B=12, C=13, D=14, E=21, F=22, G=23, H=24 ; ------------------------------------------------------------------ ; ---------------------------------------------------------------- ; PART C: create work-arrays and fill with replacable data ; ---------------------------------------------------------------- #cs ; The following would be defined as a Function ... so: begin function here Global $workarray01[4] = ["#", "#", "#", "#"] Global $workarray02[4] = ["#", "#", "#", "#"] Global $workarray03[4] = ["#", "#", "#", "#"] Global $workarray04[4] = ["#", "#", "#", "#"] For $i = 0 To 4 _ArrayConcatenate ($workarray01, $workarray01) Next For $i = 0 To 4 _ArrayConcatenate ($workarray02, $workarray02) Next For $i = 0 To 4 _ArrayConcatenate ($workarray03, $workarray03) Next For $i = 0 To 4 _ArrayConcatenate ($workarray04, $workarray04) Next ReDim $workarray01[$maxsize] ReDim $workarray02[$maxsize] ReDim $workarray03[$maxsize] ReDim $workarray04[$maxsize] #ce ; Just declare these arrays at full size, no need to fill them <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Global $workarray01[$maxsize] Global $workarray02[$maxsize] Global $workarray03[$maxsize] Global $workarray04[$maxsize] ; ............................................end function here ; ---------------------------------------------------------------- ; PART D: here comes the userdata ... the data the user has typed ; ---------------------------------------------------------------- Local $userdatastring01 = "abefh" $userdataupcasestring01 = StringUpper($userdatastring01) $userdataarray01 = StringSplit($userdataupcasestring01, "", $STR_NOCOUNT) ; Only concatenate enough times to get just a little over $maxsize... <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 1 To Ceiling($maxsize / StringLen($userdatastring01)) _ArrayConcatenate ($userdataarray01, $userdataarray01) Next ; ...and then trim as required ReDim $userdataarray01[$maxsize] _ArrayDisplay($userdataarray01, "userdata 1") Local $userdatastring02 = "cdg" $userdataupcasestring02 = StringUpper($userdatastring02) $userdataarray02 = StringSplit($userdataupcasestring02, "", $STR_NOCOUNT) ; Same here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 1 To Ceiling($maxsize / StringLen($userdatastring02)) _ArrayConcatenate ($userdataarray02, $userdataarray02) Next ReDim $userdataarray02[$maxsize] _ArrayDisplay($userdataarray02, "userdata 2") ; --------- ALL Arrays are now exactly the same size. each 8 digits long ; ---------------------------------------------------------------- ; PART E: filling the workarrays with the correct numeric values ; ---------------------------------------------------------------- #cs ; The following would be defined as a Function ... so: begin function here For $i = 0 To UBound($userdataarray01) - 1 If $userdataarray01[$i] = $a11 Then $workarray01[$i] = $n11 If $userdataarray01[$i] = $a12 Then $workarray01[$i] = $n12 If $userdataarray01[$i] = $a13 Then $workarray01[$i] = $n13 If $userdataarray01[$i] = $a14 Then $workarray01[$i] = $n14 If $userdataarray01[$i] = $a21 Then $workarray01[$i] = $n21 If $userdataarray01[$i] = $a22 Then $workarray01[$i] = $n22 If $userdataarray01[$i] = $a23 Then $workarray01[$i] = $n23 If $userdataarray01[$i] = $a24 Then $workarray01[$i] = $n24 Next ; .......................................................end function here #ce ; As you have the values in arrays, you can easily loop through them <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 0 To $maxsize - 1 For $j = 0 To $maxsize - 1 If $userdataarray01[$i] = $arrayletter[$j] Then $workarray01[$i] = $arraynumber[$j] ExitLoop EndIf Next Next ; .......................................................end function here _ArrayDisplay($workarray01, "Transform 1") ; And again here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 0 To $maxsize - 1 For $j = 0 To $maxsize - 1 If $userdataarray02[$i] = $arrayletter[$j] Then $workarray02[$i] = $arraynumber[$j] ExitLoop EndIf Next Next ; ......................................................end function here _ArrayDisplay($workarray02, "Transform 2") ; ---------------------------------------------------------------- ; Forum Information: This is the Part Where I am stuck at the moment: ; ; PART F: combining and resetting the values ; ; ---------------------------------------------------------------- ; And here is the sexy bit!!!! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ; Work through $workarray01 For $i = 0 To UBound($workarray01) - 1 ; And then look at the possible $workarray01 values <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $j = 0 To $maxsize - 1 ; Until we find the correct one <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< If $workarray01[$i] = $arraynumber[$j] Then ; Now we look for the corresponding $workarray02 value <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $k = 0 To $maxsize ; And when we find it... If $workarray02[$i] = $arraynumber[$k] Then ; ...we calculate the correct value to insert into $workarray03 $workarray03[$i] = $arraynumber[Mod($k + $j + 1, $maxsize)] ; And as we have finished with this element of $workarray01 we can move onto the next <<<<<<<<<< ExitLoop 2 EndIf Next EndIf Next Next #cs If $workarray01[$i] = $n11 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n11 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n11 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n11 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n11 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n11 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n11 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n11 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n12 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n12 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n12 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n12 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n12 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n12 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n12 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n12 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n13 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n13 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n13 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n13 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n13 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n13 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n13 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n13 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n14 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n14 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n14 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n14 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n14 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n14 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n14 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n14 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n21 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n21 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n21 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n21 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n21 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n21 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n21 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n21 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n22 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n22 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n22 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n22 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n22 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n22 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n22 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n22 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n23 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n24 If $workarray01[$i] = $n23 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n23 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n23 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n23 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n23 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n23 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n23 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n24 And $workarray02[$i] = $n11 Then $workarray03[$i] = $n11 If $workarray01[$i] = $n24 And $workarray02[$i] = $n12 Then $workarray03[$i] = $n12 If $workarray01[$i] = $n24 And $workarray02[$i] = $n13 Then $workarray03[$i] = $n13 If $workarray01[$i] = $n24 And $workarray02[$i] = $n14 Then $workarray03[$i] = $n14 If $workarray01[$i] = $n24 And $workarray02[$i] = $n21 Then $workarray03[$i] = $n21 If $workarray01[$i] = $n24 And $workarray02[$i] = $n22 Then $workarray03[$i] = $n22 If $workarray01[$i] = $n24 And $workarray02[$i] = $n23 Then $workarray03[$i] = $n23 If $workarray01[$i] = $n24 And $workarray02[$i] = $n24 Then $workarray03[$i] = $n24 Next #ce ; ------------------------------------------------------------------ ; Forum-Information: ; Result Should Be ;14=D ;22=F ;14=D ;11=A ;14=D ;24=H ;21=E ;11=A ; ------------------------------------------------------------------ _ArrayDisplay($workarray03, "Combined") ; ---------------------------------------------------------------- ; PART F: convert the numerals back to alphabetical values ; ---------------------------------------------------------------- ; Again work through the elements of $workarray03 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 0 To $maxsize - 1 ; And look at each possibility for its content <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $j = 0 To $maxsize - 1 ; And then change it if necessary <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< If $workarray03[$i] = $arraynumber[$j] Then $workarray04[$i] = $arrayletter[$j] ExitLoop EndIf Next Next #cs ; The following would be defined as a Function ... so: begin function here For $i = 0 To UBound($workarray03) - 1 If $workarray03[$i] = $n11 Then $workarray04[$i] = $a11 If $workarray03[$i] = $n12 Then $workarray04[$i] = $a12 If $workarray03[$i] = $n13 Then $workarray04[$i] = $a13 If $workarray03[$i] = $n14 Then $workarray04[$i] = $a14 If $workarray03[$i] = $n21 Then $workarray04[$i] = $a21 If $workarray03[$i] = $n22 Then $workarray04[$i] = $a22 If $workarray03[$i] = $n23 Then $workarray04[$i] = $a23 If $workarray03[$i] = $n24 Then $workarray04[$i] = $a24 Next ; ......................................................end function here ; -------------- now let us look at our reslut (convert array back to string) #ce $result = _ArrayToString($workarray04, "") MsgBox(0, "Result", $result) ; ------------------------------------------------------------------ ; Forum-Information: ; Result Should Be ; ;DFDADHEA ; ; ------------------------------------------------------------------ I have no idea what you are doing with this script, but my version gives you the same result as your rather less elegant code - and in my opinion is scalable to deal with a very much bigger $maxsize value without changing a line. And if $maxsize is very large, you can get rid of $workarray04 and just directly replace the numeric values in $workarray03 with the letters - that would save a fair bit of memory. Please ask if you have any questions. M23
    1 point
  5. Here to start you up : #include <Array.au3> HotKeySet("{ESC}", _Exit) Global $inifile = IniReadSection(@ScriptDir & "\Test.ini", "MONDAY") _ArrayColInsert($inifile,2) While 1 For $i = 1 to $inifile[0][0] If Not $inifile[$i][2] And $inifile[$i][0] = @HOUR & ":" & @MIN Then $inifile[$i][2] = True ShellExecute($inifile[$i][1]) EndIf Next Sleep (1000) WEnd Func _Exit() Exit EndFunc
    1 point
  6. GokAy

    $CmdLine parameters

    Maybe these will help then? https://stackoverflow.com/questions/8635845/passing-multiple-parameters-through-registry https://stackoverflow.com/questions/1826791/how-to-pass-in-multiple-file-folder-paths-via-a-right-click-event-verb-to-an-e Same problem as yours, and only workaround seems like SubZ provided (32767 character command line limit). The real answer is writing a Shell Extension.
    1 point
  7. Get rid of the selects you don't need to select in most cases in Excel VBA. It will slow you down too depending on how much computation you are doing. ' All These Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select ' Can be achieved with (see what is being selected when you click cell A1 and press (CTRL + *)) Dim rRange as Range Set rRange = ActiveSheet.Range("A1").CurrentRegion ' Then play with .Offset(), and .Resize() for ranges you need ' i.e., rRange.resize(1,rRange.Columns.Count) ' All Column Headers Set rRange = Nothing ' When you are done with it. Not necessary in most cases, but good coding practice An example from the file I am working on atm: "Import" is the sheet codename. Don't mind all the variables. With Import.Sort .SortFields.Clear .SortFields.Add2 key:=Import.Range("M1").Offset(1, i - CalcColumn).resize(SectionEnd - SectionStart + 1, 1), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal .SetRange Import.Range("M1").Offset(1, i - CalcColumn).resize(SectionEnd - SectionStart + 1, 1) .Header = xlNo .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With
    1 point
  8. Shift is always the ballbuster, eh?
    1 point
  9. Hi jugador If it's gonna be permanent, just add a line in the script (quickly tested) : Case $Id_ButtonA If $g_iItem >= 0 And $g_iItem < 5 And $g_iSubItem >= 0 And $g_iSubItem < 3 Then ContinueLoop
    1 point
  10. matwachich, If you create the parent than you already know the font used, so just use _ExtMsgBoxSet to set that font for an ExtMsgBox which is generated. M23
    1 point
  11. this in a batch file fixes that problem. no reboot necessary on a pc anyway. just need to rebuild the icon cache taskkill /f /im explorer.exe cd /d %userprofile%\AppData\Local del IconCache.db /a start explorer.exe this happens on almost every ms os, you install updates, icons don't show until reboot, or you do the above in a bat or on an admin cmdline i see the cache problem all the time in testing
    1 point
×
×
  • Create New...