Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 43

Thread: Word Tests. Useful older stuff. Older versions. Chris stuff etc

  1. #21
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    aabaNDB
    Last edited by DocAElstein; 05-29-2023 at 11:09 AM.

  2. #22
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    ssbbd

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv
    https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg
    https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q
    https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I
    https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg
    https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M
    ttps://www.youtube.com/watch?v=LP9fz2DCMBE
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg
    https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8
    ttps://www.youtube.com/watch?v=bFxnXH4-L1A
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG
    https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg
    ttps://www.youtube.com/watch?v=GqzeFYWjTxI
    https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 11-30-2023 at 02:50 PM.

  3. #23
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    In support of this forum post
    https://excelfox.com/forum/showthrea...ll=1#post16376




    Before, as we had before


    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I
    1 S.No. Year Month Name Project Task Amount Submitted By
    2
    1
    2022
    January bbb Project2 Task2
    100
    Liviu Popescu
    3
    2
    2022
    February ccc Project5 Task1
    200
    Liviu Popescu
    4
    3
    2022
    March aaa Project3 Task2
    500
    Liviu Popescu
    5
    Worksheet: Database



    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G
    1 Name Project Task
    01-22
    02-22
    03-22
    04-22
    2 aaa Project1 Task1
    3 aaa Project1 Task2
    4 aaa Project2 Task1
    5 aaa Project2 Task2
    6 aaa Project3 Task1
    7 aaa Project3 Task2
    8 aaa Project4 Task1
    9 aaa Project4 Task2
    10 aaa Project5 Task1
    11 aaa Project5 Task2
    12 bbb Project1 Task1
    13 bbb Project1 Task2
    14 bbb Project2 Task1
    15 bbb Project2 Task2
    16 bbb Project3 Task1
    17 bbb Project3 Task2
    18 bbb Project4 Task1
    19 bbb Project4 Task2
    20 bbb Project5 Task1
    21 bbb Project5 Task2
    22 ccc Project1 Task1
    23 ccc Project1 Task2
    24 ccc Project2 Task1
    25 ccc Project2 Task2
    26 ccc Project3 Task1
    27 ccc Project3 Task2
    28 ccc Project4 Task1
    29 ccc Project4 Task2
    30 ccc Project5 Task1
    31 ccc Project5 Task2
    32 ddd Project1 Task1
    33 ddd Project1 Task2
    Worksheet: Database1

  4. #24
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    In support of this forum post
    https://excelfox.com/forum/showthrea...ll=1#post16376







    After





    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    Name Project Task
    01-22
    02-22
    03-22
    04-22
    2
    aaa Project1 Task1
    3
    aaa Project1 Task2
    4
    aaa Project2 Task1
    5
    aaa Project2 Task2
    6
    aaa Project3 Task1
    7
    aaa Project3 Task2
    500
    8
    aaa Project4 Task1
    9
    aaa Project4 Task2
    10
    aaa Project5 Task1
    11
    aaa Project5 Task2
    12
    bbb Project1 Task1
    13
    bbb Project1 Task2
    14
    bbb Project2 Task1
    15
    bbb Project2 Task2
    100
    16
    bbb Project3 Task1
    17
    bbb Project3 Task2
    18
    bbb Project4 Task1
    19
    bbb Project4 Task2
    20
    bbb Project5 Task1
    21
    bbb Project5 Task2
    22
    ccc Project1 Task1
    23
    ccc Project1 Task2
    24
    ccc Project2 Task1
    25
    ccc Project2 Task2
    26
    ccc Project3 Task1
    27
    ccc Project3 Task2
    28
    ccc Project4 Task1
    29
    ccc Project4 Task2
    30
    ccc Project5 Task1
    200
    31
    ccc Project5 Task2
    32
    ddd Project1 Task1
    Worksheet: Database1

  5. #25
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    In support of this forum post
    https://excelfox.com/forum/showthrea...ll=1#post16373





    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I
    1 S.No. Year Month Name Project Task Amount Submitted By
    2
    1
    2022
    January bbb Project2 Task2
    100
    Liviu Popescu
    3
    2
    2022
    February ccc Project5 Task1
    200
    Liviu Popescu
    4
    3
    2022
    March aaa Project3 Task2
    500
    Liviu Popescu
    5
    Worksheet: Database



    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G
    1 Name Project Task
    01-22
    02-22
    03-22
    04-22
    2 aaa Project1 Task1
    3 aaa Project1 Task2
    4 aaa Project2 Task1
    5 aaa Project2 Task2
    6 aaa Project3 Task1
    7 aaa Project3 Task2
    8 aaa Project4 Task1
    9 aaa Project4 Task2
    10 aaa Project5 Task1
    11 aaa Project5 Task2
    12 bbb Project1 Task1
    13 bbb Project1 Task2
    14 bbb Project2 Task1
    15 bbb Project2 Task2
    16 bbb Project3 Task1
    17 bbb Project3 Task2
    18 bbb Project4 Task1
    19 bbb Project4 Task2
    20 bbb Project5 Task1
    21 bbb Project5 Task2
    22 ccc Project1 Task1
    23 ccc Project1 Task2
    24 ccc Project2 Task1
    25 ccc Project2 Task2
    26 ccc Project3 Task1
    27 ccc Project3 Task2
    28 ccc Project4 Task1
    29 ccc Project4 Task2
    30 ccc Project5 Task1
    31 ccc Project5 Task2
    32 ddd Project1 Task1
    33 ddd Project1 Task2
    Worksheet: Database1

  6. #26
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    In support of this forum post
    https://excelfox.com/forum/showthrea...ll=1#post16376




    Before, as we had before


    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I
    1 S.No. Year Month Name Project Task Amount Submitted By
    2
    1
    2022
    January bbb Project2 Task2
    100
    Liviu Popescu
    3
    2
    2022
    February ccc Project5 Task1
    200
    Liviu Popescu
    4
    3
    2022
    March aaa Project3 Task2
    500
    Liviu Popescu
    5
    Worksheet: Database



    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G
    1 Name Project Task
    01-22
    02-22
    03-22
    04-22
    2 aaa Project1 Task1
    3 aaa Project1 Task2
    4 aaa Project2 Task1
    5 aaa Project2 Task2
    6 aaa Project3 Task1
    7 aaa Project3 Task2
    8 aaa Project4 Task1
    9 aaa Project4 Task2
    10 aaa Project5 Task1
    11 aaa Project5 Task2
    12 bbb Project1 Task1
    13 bbb Project1 Task2
    14 bbb Project2 Task1
    15 bbb Project2 Task2
    16 bbb Project3 Task1
    17 bbb Project3 Task2
    18 bbb Project4 Task1
    19 bbb Project4 Task2
    20 bbb Project5 Task1
    21 bbb Project5 Task2
    22 ccc Project1 Task1
    23 ccc Project1 Task2
    24 ccc Project2 Task1
    25 ccc Project2 Task2
    26 ccc Project3 Task1
    27 ccc Project3 Task2
    28 ccc Project4 Task1
    29 ccc Project4 Task2
    30 ccc Project5 Task1
    31 ccc Project5 Task2
    32 ddd Project1 Task1
    33 ddd Project1 Task2
    Worksheet: Database1

  7. #27
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    In support of this forum post
    https://excelfox.com/forum/showthrea...ll=1#post16376







    After





    _____ Workbook: Work_file.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    Name Project Task
    01-22
    02-22
    03-22
    04-22
    2
    aaa Project1 Task1
    3
    aaa Project1 Task2
    4
    aaa Project2 Task1
    5
    aaa Project2 Task2
    6
    aaa Project3 Task1
    7
    aaa Project3 Task2
    500
    8
    aaa Project4 Task1
    9
    aaa Project4 Task2
    10
    aaa Project5 Task1
    11
    aaa Project5 Task2
    12
    bbb Project1 Task1
    13
    bbb Project1 Task2
    14
    bbb Project2 Task1
    15
    bbb Project2 Task2
    100
    16
    bbb Project3 Task1
    17
    bbb Project3 Task2
    18
    bbb Project4 Task1
    19
    bbb Project4 Task2
    20
    bbb Project5 Task1
    21
    bbb Project5 Task2
    22
    ccc Project1 Task1
    23
    ccc Project1 Task2
    24
    ccc Project2 Task1
    25
    ccc Project2 Task2
    26
    ccc Project3 Task1
    27
    ccc Project3 Task2
    28
    ccc Project4 Task1
    29
    ccc Project4 Task2
    30
    ccc Project5 Task1
    200
    31
    ccc Project5 Task2
    32
    ddd Project1 Task1
    Worksheet: Database1

  8. #28
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    I hit a problem later
    I hit a problem later…. The full main file actually looked like this in a text editor:

    and it got me an 9 line array, where I was expecting one of 2102


    I don’t know how that came about since the four lines file was made and saved in the same ISE environment in which the Main file was and was saved in. But it looks like unfortunately there may be a few, 9 , vbCr & vbLfs.
    So, I took a look at a shortened vision of that file, as saved in a text editor, trying to capture some of the problem areas.
    This is what I looked at


    Here is the results:
    Code:
     
    "Function BlochIPhosts " & Chr(123) & "param" & "(" & Chr(91) & "int" & Chr(93) & "$" & "Testie" & ")" & vbCr & vbLf & " " & "$" & "Check " & "=" & " " & "$" & "Testie" & vbCr & vbLf & "Write" & "-" & "Host " & """" & "Adding telemetry domains to hosts file" & """" & " " & "#" & " Write" & "-" & "Output " & """" & "Adding telemetry domains to hosts file" & """" & vbCr & vbLf & "$" & "hosts" & "_" & "file " & "=" & " " & """" & "$" & "env" & ":" & "systemroot" & "\" & "System32" & "\" & "drivers" & "\" & "etc" & "\" & "hosts" & """"
    
    "Add" & "-" & "Type " & "-" & "AssemblyName System" & "." & "Windows" & "." & "Forms" & vbLf & Chr(91) & "System" & "." & "Windows" & "." & "Forms" & "." & "Application" & Chr(93) & ":" & ":" & "EnableVisualStyles" & "(" & ")" & " " & "#" & vbLf & "Remove" & "-" & "Variable " & Chr(42) & " " & "-" & "ErrorAction SilentlyContinue " & "#" & " is needed or else a removed variable is still there when fucking about with variables" & "." & " by default variables are persistant" & "." & vbLf & "$" & "ErrorActionPreference " & "=" & " " & "'" & "SilentlyContinue" & "'"
    
    "Add" & "-" & "Type " & "-" & "AssemblyName System" & "." & "Windows" & "." & "Forms " & "#" & " For ps1 in PowerShell running code lines in PowerShell with Admin rights of the following form are what you need to set this off Set" & "-" & "ExecutionPolicy Unrestricted cd " & "'" & "G" & ":" & "\" & "Temp Opt" & "\" & "GitHub" & "\" & "win10script" & "-" & "master" & "\" & "My ps1 file Folder" & "'" & " " & "." & "\" & "win10debloat6Dec" & "-" & "31Dec" & "." & "ps1 " & vbLf & Chr(91) & "System" & "." & "Windows" & "." & "Forms" & "." & "Application" & Chr(93) & ":" & ":" & "EnableVisualStyles" & "(" & ")" & " " & "#" & vbLf & "Remove" & "-" & "Variable " & Chr(42) & " " & "-" & "ErrorAction SilentlyContinue " & "#" & " is needed or else a removed variable is still there when fucking about with variables" & "." & " by default variables are persistant" & "." & vbLf & "$" & "ErrorActionPreference " & "=" & " " & "'" & "SilentlyContinue" & "'" & vbLf
     & "$" & "wshell " & "=" & " New" & "-" & "Object " & "-" & "ComObject Wscript" & "." & "Shell" & vbLf & "$" & "Button " & "=" & " " & Chr(91) & "System" & "." & "Windows" & "." & "MessageBoxButton" & Chr(93) & ":" & ":" & "YesNoCancel" & vbLf & "$" & "ErrorIco " & "=" & " " & Chr(91) & "System" & "." & "Windows" & "." & "MessageBoxImage" & Chr(93) & ":" & ":" & "Error" & vbLf & "If " & "(" & "!" & "(" & Chr(91) & "Security" & "." & "Principal" & "." & "WindowsPrincipal" & Chr(93) & Chr(91) & "Security" & "." & "Principal" & "." & "WindowsIdentity" & Chr(93) & ":" & ":" & "GetCurrent" & "(" & ")" & ")" & "." & "IsInRole" & "(" & Chr(91) & "Security" & "." & "Principal" & "." & "WindowsBuiltInRolpl" & vbLf & Chr(125) & ")" & vbLf & "$" & "oldcontrolpanel" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbLf & " cmd " & "/" & "c control" & vbLf & Chr(125) & ")" & vbLf & "$" & "oldsystempanel" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbLf & " cmd " & "/" & "c sysdm" & "." & "cpl" & vbLf & Chr(125
    ) & ")" & vbLf & "#" & " " & "$" & "oldpower" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbCr & vbLf & vbCr & vbLf & "#" & " " & Chr(125) & ")" & vbLf & "#" & " " & "$" & "restorepower" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbCr & vbLf & vbCr & vbLf & vbCr & vbLf & vbCr & vbLf & vbCr & vbLf & vbCr & vbLf & "#" & " " & Chr(125) & ")" & vbLf & "#" & " " & "$" & "NFS" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & "#" & " " & Chr(125) & ")" & vbLf & vbLf & "#" & " " & "$" & "Virtualization" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & vbLf & "#" & " " & Chr(125) & ")" & vbLf & vbLf & "$" & "windowsupdatefix" & "." & "Add" & "_" & "Click" & "(" & Chr(123) & vbLf & " Write" & "-" & "Host " & """" & "1" & "." & " Stopping Windows Update Services" & "." & "." & "." & """" & " " & vbLf & " Stop" & "-" & "Service "
     & "-" & "Name BITS " & vbLf & " " & " "
    From that above output we can see 11, so that’s 10 lines rather than 9. This inconsistency by 1 is somewhat worrying.
    I looked at the array produced from that shortened text file, and it is as before, 9
    One possibility is that some length restriction is long some of the line feed pairs, or a line slipped in at my making of the shortened file

    For the masochistic pleasure I tried the full main file in the first simple macro. To my surprise, it worked, after a few hours, the result came out.
    Temp7BeforeIPhostsInsertFirst4Lines_ps1WtchaGot https://app.box.com/s/12zw9id42xrwc7qy70ul87bg0wfpb4uh
    Temp7BeforeIPhostsInsertFirst4Lines_ps1WtchaGot https://app.box.com/s/771q1gzpycle7ccveu235j256n4l4xyb

    It returned 8, making 9 lines.

    So that discrepancy is perhaps sorted.
    My initial conclusions may have based on slightly careless manipulations that brought some invisible characters in.

    One possibility is that the original main coding came from GitHub: This for example talks about the line feed issue at GitHub
    http://vcloud-lab.com/entries/devops...pos=0&at_tot=1

  9. #29
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    This is post https://excelfox.com/forum/showthrea...age8#post16491
    https://excelfox.com/forum/showthrea...ll=1#post16491
    https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA/page8#post16491
    https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA?p=16491&viewfull=1#post16491




    So I will make a function, just for convenience even though I am not so keen on those things
    It will take in
    _(i) The two file names , the main one, and then the one to be inserted,
    _(ii) the line at which to insert, and optional the number of lines to insert, ( if no number is given, I assume all lines want to be inserted from the second file )
    _ an optional name for the output file, ( if none is given I will add something like the date to the name of the original main file, and call it that)

    _(iii) Based on the results from the last post, I probably will need to keep my eye on the line feed issue. For now the way to proceed could be to first replace all vbCr & vbLf with vbLf, to get them hopefully all to the same , and then after replace all vbLf with vbCr & vbLf
    _ (iv) I assume all files are in the same folder

    The techniques used to bring the files into 1 dimensional array of rows are tried and trusted, used many times before. I have the main file in a master array , arrRwsM() , and the file to be merged into it is in the array, arrRws()
    At the point of the code development, where these arrays were made, I checked the contents, and there was perfect agreement between the rows in the ps1 files, and the elements of the arrays.

    So what is new is to combine, merge, the files as required
    A simple loop will do, that tacks on the extra coding from the left in the master code array.
    We don’t need to add many spaces, since usually there is already many since the commented lines are over to the right. This is a simple coding bit to do that,
    ______ arrRwsM(LnNbr - 1) = arrRws(LnNbr - StRw) & arrRwsM(LnNbr - 1)
    Code:
        For LnNbr = StRw To Rws + StRw - 1 ' This  - 1  is the usual “getting end row from start row and count of rows” issue - its always     (the start row) + ( Rows count - 1 )
         Let arrRwsM(LnNbr - 1) = arrRws(LnNbr - StRw) & arrRwsM(LnNbr - 1) ' The  - 1  here is because the one dimensional arrays start at 0, so the lines we are intersted in are 1 element back from where we might have expected them
        Next LnNbr 
    Its extremely easy now to remake the modified text file by joining the modified array elements by a line separator,
    ____ TotalFile = Join(arrRwsM(), vbCr & vbLf)
    ( For now I will stay with the vbCr & vbLf , as my personal preference )
    Code:
    '  https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA/page8#post16491
    Sub testieIt() '   https://excelfox.com/forum/showthread.php/2559-Notes-tests-text-files-manipulation-of-text-files-in-Excel-and-with-Excel-VBA?p=16491&viewfull=1#post16491
     Call MergeScriptFiles("Temp7BeforeIPhostsInsert.ps1", "blockIPhostsRawAll250.ps1", 201, , "Temp8.ps1")
    End Sub
    '  ByVal TxtM As String, ByVal TxtInst As String, ByVal StRw As Long, Optional ByVal Rws As Long, Optional ByVal FlNmeOut As String
    Public Function MergeScriptFiles(ByVal TxtM As String, ByVal TxtInst As String, ByVal StRw As Long, Optional ByVal Rws As Long, Optional ByVal FlNmeOut As String)
    Rem 1 main file
    ' Get the text file as a long single string
    Dim FileNum As Long: Let FileNum = FreeFile(1)                                    ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
    Dim PathAndFileName As String, TotalFile As String
     Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & TxtM   '                                                               CHANGE TO SUIT                                                                                                         From vixer zyxw1234  : http://www.eileenslounge.com/viewtopic.php?f=30&t=34629     DF.txt https://app.box.com/s/gw941dh9v8sqhvzin3lo9rfc67fjsbic
    Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundamental type data input...
     Let TotalFile = Space(LOF(FileNum)) '....and wot receives it has to be a string of exactly the right length
    Get #FileNum, , TotalFile
    Close #FileNum    'Debug.Print TotalFile
     Let TotalFile = Replace(TotalFile, vbCr & vbLf, vbLf, 1, -1, vbBinaryCompare)
     Let TotalFile = Replace(TotalFile, vbLf, vbCr & vbLf, 1, -1, vbBinaryCompare)
    ' make a 1 D array of the Main text file
    Dim arrRwsM() As String: Let arrRwsM() = Split(TotalFile, vbCr & vbLf, -1, vbBinaryCompare)
    
    Rem 2 file to insert
     Let PathAndFileName = ThisWorkbook.Path & Application.PathSeparator & TxtInst   '                                                               CHANGE TO SUIT                                                                                                         From vixer zyxw1234  : http://www.eileenslounge.com/viewtopic.php?f=30&t=34629     DF.txt https://app.box.com/s/gw941dh9v8sqhvzin3lo9rfc67fjsbic
    Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundamental type data input...
     Let TotalFile = Space(LOF(FileNum)) '....and wot receives it has to be a string of exactly the right length
    Get #FileNum, , TotalFile
    Close #FileNum    'Debug.Print TotalFile
     Let TotalFile = Replace(TotalFile, vbCr & vbLf, vbLf, 1, -1, vbBinaryCompare)
     Let TotalFile = Replace(TotalFile, vbLf, vbCr & vbLf, 1, -1, vbBinaryCompare)
    ' make a 1 D array of the file to insert
    Dim arrRws() As String: Let arrRws() = Split(TotalFile, vbCr & vbLf, -1, vbBinaryCompare)
    
    Rem 3 tack on lines from file to merge
        If Rws = 0 Then Let Rws = UBound(arrRws()) + 1 ' This will cause all lines to be merged if no number of lines given
    Dim LnNbr As Long
        For LnNbr = StRw To Rws + StRw - 1 ' This  - 1  is the usual getting end row from start row and count of rows issue - its always    the start row + ( Rows count - 1 )
         Let arrRwsM(LnNbr - 1) = arrRws(LnNbr - StRw) & arrRwsM(LnNbr - 1) ' The  - 1  here is because the one dimensional arrays start at 0, so the lines we are intersted in are 1 element back from where we might have expected them
        Next LnNbr  '  LnNbr - StRw   takes us from 0 to 1 less than our maximumn row number - that is exactly the 0 to (1 less than our maximumn row number)
    ' 3b That seems to have done it, now we just need to remake the merged text file,
    ' Make text file, alll we need to do is make the single long string including the line breaks that
     Let TotalFile = Join(arrRwsM(), vbCr & vbLf)
    Rem 4  Output file
    Dim FileNum2 As Long: Let FileNum2 = FreeFile(0)                                  ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
    Dim PathAndFileName2 As String
        If FlNmeOut = "" Then Let FlNmeOut = Left(TxtM, InStrRev(TxtM, ".") - 1) & "Merge" & Format(Now(), "dd,mmmyyyy") & ".ps1"
     Let PathAndFileName2 = ThisWorkbook.Path & "\" & FlNmeOut  ' ' CHANGE TO SUIT  ' Will be made if not there
     Open PathAndFileName2 For Output As #FileNum2
     Print #FileNum2, TotalFile ' write out entire text file
     Close #FileNum2
    End Function
    

    That above coding has got me my Temp8.ps1 which is Temp7.ps1 with the merged IP hosts block function, along with a few other things done at the end of march, including a first look at a pretty coloured GUI













    ' Temp7BeforeIPhostsInsert https://app.box.com/s/fttlmwny6y4s5ub1q66kvqbrw2ppxdwz
    https://i.postimg.cc/T2K3rjbC/hosts-Before-2022-04.jpg

    ' blockIPhostsRawAll250 https://app.box.com/s/7019x59uvvxt7osvb0tojr0z4g7bfdgk


    https://i.postimg.cc/pV3Xk9Yx/hosts-After-2022-04.jpg
    ' Temp8.ps1 https://app.box.com/s/9b9li86s7dyysr7exdle30pckgp7vscz


  10. #30
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,446
    Rep Power
    10
    In support of this post https://excelfox.com/forum/showthrea...ge53#post12804
    A similar requirement to the last post, but for purposes of comparing a change in script by having the two versions side by side
    I will do the whole thing again, just to see if I still experience similar effects on a different day.

    I am interested in what seems to be a change by Chris Titus to his recent “WPF” windows utility
    This change was somehow in between others, ( (ii) inbetween (i) and (iii) ), so may have slipped past most people.
    I am taking my data from this red and green stuff , middle in Commit thing,
    Mistery Red and Green stuff https://github.com/ChrisTitusTech/wi...d6f8ac9bee5a64
    or maybe not… This is what I have
    The previous XML from god knows where and when, ( the red stuff from that last link )
    Share ‘May10-17XML.txt’ https://app.box.com/s/ykynprd9a3ra4w7kcif4h5ziubwktw2t
    The “new” green stuff from that last link
    Share ‘May17XML.txt’ https://app.box.com/s/gsqjpfmmqwpadmu8wchjrlfrqxwrrg6e



    _ (iii) This is now from the next change the next change called up XML thing


    The big mystery seems to be for now where and what that red stuff comes from or is.
    It seems that the full script from 10 May, the full script from just before the last change (ii) on 17May, and the stand alone XLM in change (iii) all have the same XML stuff


    I think I will leave it for now… It’s all a total mess. It looks like he changed something he was never using to update it to what he was using.


    ….. later









    Share ‘ChrisWPFTuesday10May2022.ps1’ https://app.box.com/s/end0t4spyl119iiixw9va922hdft4icx


    Mistery Red and Green stuff https://github.com/ChrisTitusTech/wi...d6f8ac9bee5a64
    Share ‘ChrisWPF17May2022(ii).ps1’ https://app.box.com/s/yrzoikeg9coggyt99ofin18f2cxkf849
    Share ‘May10-17XML.txt’ https://app.box.com/s/ykynprd9a3ra4w7kcif4h5ziubwktw2t
    Share ‘May17XML.txt’ https://app.box.com/s/gsqjpfmmqwpadmu8wchjrlfrqxwrrg6e



    The new thng thing (iii) , https://github.com/ChrisTitusTech/wi...89e4d5d2923b63
    https://i.postimg.cc/fR8Hhcv1/Git-Hu...Update-XML.jpg
    https://i.postimg.cc/90y83sxB/The-new-thing-iii.jpg
    https://i.postimg.cc/vHd27HB2/The-ne...-thing-iii.jpg
    https://raw.githubusercontent.com/Ch...ainWindow.xaml
    Share ‘MainWindow_xami - StandAloneXML17May.txt’ https://app.box.com/s/lrf37fuhegad3jfgjltzlmckmw33lpj2
    Share ‘MainWindow.xaml’ https://app.box.com/s/3b6v4zmgb6njamh6khyqe44zpk7cmaak

    Share ‘ChrisWPF17May2022.ps1’ https://app.box.com/s/lrzeyx55hjksedzrr649snrxfmfyvtkm
    Share ‘ChrisWPF17May2022(iii).ps1’ https://app.box.com/s/7u4lxbwrgubxgf37tduzx0e22s49alvf

Similar Threads

  1. Class Stuff: VBA Custom Classes & Objects, Class Modules
    By DocAElstein in forum Excel and VBA Tips and Tricks
    Replies: 29
    Last Post: 06-02-2024, 01:49 PM
  2. Gif Image Video stuff testies
    By DocAElstein in forum Test Area
    Replies: 13
    Last Post: 09-06-2021, 01:07 PM
  3. Test my rights , to do stuff
    By TestAccount in forum Test Area
    Replies: 0
    Last Post: 10-07-2020, 11:49 AM
  4. Replies: 25
    Last Post: 03-10-2020, 01:28 PM
  5. Replies: 1
    Last Post: 04-02-2019, 03:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •