topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • October 15, 2018, 08:03 PM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - 4wd [ switch to compact view ]

Pages: [1] 2 3 4 5 6 ... 198next
1
General Software Discussion / Re: Anyone using Blackbird?
« on: October 14, 2018, 07:18 PM »
This did not give access to the Win10 "Blackbird"  PC.

More information:
  • Do you mean that the Win10 PC is not seen in the workgroup it's associated with or on the network?
  • Or, do you mean it can not be accessed, (any shares on it), from another PC?

If it's (1), there are settings that can prevent a PC from showing up on the network/workgroup but will still allow direct access via it's IP.

If it's (2), what method are you using to try and access it, just from File Explorer on another PC or do you type in it's host or IP address?

eg.
\\x.x.x.x        - fill in the appropriate IP
\\win10pc      - change as appropriate (this can also be blocked via some settings)

Which method:
2018-10-15 10_59_02-This PC.png

Or did you mean you can access the Win10 PC but not access any shared folders, (ie. you get a list of folders when you connect to it but can not enter any)?

It can also be a firewall problem, it's blocking LAN related addresses/ports needed for access, you can look in the Event Log for anything like this.

IMHO, you may be better off reverting the Win10 PC to pre-Blackbird and using OOSU (it's free) instead, it will also nullify the telemetry but it gives you fine-grain control over what can be blocked, (it also has a description for each option).

2018-10-15 11_23_22-O&O ShutUp10 (Administrator).png

It has a couple of pre-defined settings under the Actions menu, Apply only recommended settings and Recommended and somewhat recommended settings.

And then if you want to remove Win10 apps, use the appropriate section of Blackbird to remove unwanted ones.

2
General Software Discussion / Re: Anyone using Blackbird?
« on: October 13, 2018, 11:06 PM »
In other words, does changing any elements in the path from blackbird version number and all that in the path (where it exists) to simply something like blackbird.ext affect the execution of the command?

What exactly do you mean here?

Are you renaming the executable to cater for multiple versions within the same folder?

If so, why?

Also in this process what is the 'repeat line command'  at cmd system?

Cursor up/down to cycle through command history.

My bad.  The error cited occurs during the initial Backup request which then says
completed successfully.

Blackbird is nothing more than a very complicated command/batch file, (~461kB, 8344 lines), the FindStr errors you're seeing likely come the backup section which starts at around line 5559 and contains quite a number of FindStr commands.  Without knowing precisely which lines are failing you have no way of knowing what is not being included in the backup so it's likely that you do not have a successful backup.

Unless the developers of the program respond and fix it, then the only real backup you can do is an image of the OS before you apply Blackbird, (at the very least a System Restore Point).

It also might pay to apply, (individually through command parameters), only those measures which pertain to Windows 7, (it's a good idea to mention your OS at the start, saves assumptions being made).

Something that may be more user-friendly is: Spybot Anti-Beacon

Download the portable version and run it to install it on a flash drive, then run the program (AntiBeaconLoaderPortable.exe).

It will scan the system and report exactly what it's found when you click on Blocked telemetry options or Customize:

2018-10-14 14_50_43-Spybot AntiBeacon.png

Click on the *** areas to enable/disable what you want/don't want:

2018-10-14 14_51_57-Spybot AntiBeacon.png

You don't need to buy it to use the Standard Immunizers but you do if there's something in the Plus Immunizers you want to block.

I'm running Win 10, things that show blocked blocked were done by OOSU (Win10 only):

2018-10-14 14_55_46-Spybot AntiBeacon.png

However, since it will tell you what choices you have, you can then search the internet for relevant info to block them if you want to keep to a free solution, (or pay €7.99 and use it to setup all your computers).

As I said, it may be a more user-friendly option than Blackbird's scattergun approach.

3
Post New Requests Here / Re: IDEA: copy my wallpaper's full title
« on: October 12, 2018, 05:33 PM »
, maybe i'll include the idea of 4wd as well,
.... let me suprise you :)

no, NO!  :o   :(   
I swear, I already have plenty of screen-savers and wallpaper-changers. Please at least keep keep such projects apart from "IDEA: copy my wallpaper's full title"!

Curt, calm down, he's talking about having it overlay the picture name/path on the backdrop as an option not implemented as a screen-saver/wallpaper changer.

Like DisplayFusion does:

2018-10-13 09_29_35-Greenshot.png

After all, if it's going to be loaded all the time as either a SysTray program or COM object why not add options - you don't have to enable/use them.

4
Post New Requests Here / Re: IDEA: copy my wallpaper's full title
« on: October 12, 2018, 05:44 AM »
... maybe i'll include the idea of 4wd as well, somehow i like it..

Some Powershell source that does the overlaying and updating: Set-Wallpaper.ps1

Function New-Wallpaper (line 360) and Update-Wallpaper (line 579), might help ... or not.

5
Post New Requests Here / Re: IDEA: copy my wallpaper's full title
« on: October 12, 2018, 01:39 AM »
Sorry, 4wd, I missed to see your post.  :-[
Of course you had the proper solution. Thank you!  :up:


Ah... I didn't see he had posted that before either.

Got to watch out for the quiet ones  ;)

Another alternative for displaying the name would be to have the text overlayed onto the current wallpaper and then set that as the background, a.l.a. DisplayFusion, which is what I do.

eg.
Monitor the modification time on the transcoded image.
Grab the original file/path
Overlay onto the transcoded image
Set that as the new wallpaper
Start over

6
Post New Requests Here / Re: copy my wallpaper's full title
« on: October 10, 2018, 09:46 PM »
Does this help?

How to Find the Current Wallpaper File Name and Path in Windows 8 and 10

There's PoSh and VBa scripts in a zip file, don't know how good they'll be for Bing downloaded images.

If the PoSh script does what you want then I can try and make it more like you originally wanted.

Or @KodeZwerg may be able to use it to work up an executable.

7
Living Room / Re: My first excel macro
« on: October 10, 2018, 09:29 PM »
... and a question that might not yield a quick easy solution with a google search..

And yet if a complete Excel agnostic, (ie. me), can find information within minutes using words from the OP, what should someone who uses Excel be able to do?

SearX

SearX

The Boy Who Cried Wolf comes to mind.

I don't think that's the problem, I don't mind how many times he asks for something because there are times when I learn something, (eg. the recent RegEx thread).

The main problem is the low quality questions and the almost complete lack of feedback/response to any suggestions/questions which are posed in order to get a clearer picture of what he's trying to achieve, ie. he's not interested enough to help us help him.

Have you ever looked at Excel's built-in help?
-cranioscopical (October 09, 2018, 10:02 PM)

Sounds suspiciously like RTM  :P

8
Living Room / Re: Problem for very strong brains
« on: October 06, 2018, 03:31 AM »
Is it only me, or does anyone else at DC think that we are asked to do the homework for the Excel course he is taking (only he didn't mention Excel in this specific request)...  :P

Yep, he's trying to subcontract out his homework.

Any opinions?
I have some ideas but would like some input first.

Wrong way round, you give us your ideas and someone may respond with suggestions/opinions otherwise we end up possibly duplicating effort which is not efficient, (not to mention the likelihood of no response to any suggestion/opinion is rather high given previous interactions).

Main problem stays the same, unable to open and read a book.


9
General Software Discussion / Re: Anyone using Blackbird?
« on: October 06, 2018, 03:21 AM »
Blackbird comes in 32 and 64 bit versions, they should be using the one appropriate for their architecture.

10
That site is so cool!  Thanks for it!

You're welcome, can't get my GUIs to save, (after creating an account), using Save never seems to work ... maybe I'm just running too much anti-tracking/ad stuff in the browser, haven't spent the time to work it out yet.

I just end up using copy/paste to get the rough raw code into PoSh ISE and then fiddle around with the values to add/remove/move things.

11
Plus you can add simple GUI's to Powershell scripts, (so much easier than AutoIt):

2018-10-06 09_09_07-Concat.png

For the last few Powershell GUIs I've been using PoshGUI to create them rather than screw around in Visual Studio.

Concat-GUI.ps1
Code: PowerShell [Select]
  1. <#
  2. .NAME
  3.     Concat-GUI.ps1
  4. #>
  5.  
  6. Add-Type -AssemblyName System.Windows.Forms
  7. [System.Windows.Forms.Application]::EnableVisualStyles()
  8.  
  9. #region begin GUI{
  10.  
  11. $Form                            = New-Object system.Windows.Forms.Form
  12. $Form.ClientSize                 = '386,237'
  13. $Form.text                       = "Concat"
  14. $Form.TopMost                    = $false
  15.  
  16. $TextBox1                        = New-Object system.Windows.Forms.TextBox
  17. $TextBox1.multiline              = $false
  18. $TextBox1.width                  = 230
  19. $TextBox1.height                 = 20
  20. $TextBox1.location               = New-Object System.Drawing.Point(83,25)
  21. $TextBox1.Font                   = 'Microsoft Sans Serif,10'
  22.  
  23. $Label1                          = New-Object system.Windows.Forms.Label
  24. $Label1.text                     = "Folder:"
  25. $Label1.AutoSize                 = $true
  26. $Label1.width                    = 25
  27. $Label1.height                   = 10
  28. $Label1.location                 = New-Object System.Drawing.Point(22,29)
  29. $Label1.Font                     = 'Microsoft Sans Serif,10'
  30.  
  31. $Button1                         = New-Object system.Windows.Forms.Button
  32. $Button1.text                    = "..."
  33. $Button1.width                   = 34
  34. $Button1.height                  = 25
  35. $Button1.location                = New-Object System.Drawing.Point(328,24)
  36. $Button1.Font                    = 'Microsoft Sans Serif,10'
  37.  
  38. $TextBox2                        = New-Object system.Windows.Forms.TextBox
  39. $TextBox2.multiline              = $false
  40. $TextBox2.width                  = 100
  41. $TextBox2.height                 = 20
  42. $TextBox2.location               = New-Object System.Drawing.Point(83,65)
  43. $TextBox2.Font                   = 'Microsoft Sans Serif,10'
  44.  
  45. $Label2                          = New-Object system.Windows.Forms.Label
  46. $Label2.text                     = "Filter:"
  47. $Label2.AutoSize                 = $true
  48. $Label2.width                    = 25
  49. $Label2.height                   = 10
  50. $Label2.location                 = New-Object System.Drawing.Point(22,69)
  51. $Label2.Font                     = 'Microsoft Sans Serif,10'
  52.  
  53. $TextBox3                        = New-Object system.Windows.Forms.TextBox
  54. $TextBox3.multiline              = $false
  55. $TextBox3.width                  = 230
  56. $TextBox3.height                 = 20
  57. $TextBox3.location               = New-Object System.Drawing.Point(83,104)
  58. $TextBox3.Font                   = 'Microsoft Sans Serif,10'
  59.  
  60. $Button2                         = New-Object system.Windows.Forms.Button
  61. $Button2.text                    = "..."
  62. $Button2.width                   = 34
  63. $Button2.height                  = 25
  64. $Button2.location                = New-Object System.Drawing.Point(328,103)
  65. $Button2.Font                    = 'Microsoft Sans Serif,10'
  66.  
  67. $Label3                          = New-Object system.Windows.Forms.Label
  68. $Label3.text                     = "Output:"
  69. $Label3.AutoSize                 = $true
  70. $Label3.width                    = 25
  71. $Label3.height                   = 10
  72. $Label3.location                 = New-Object System.Drawing.Point(22,110)
  73. $Label3.Font                     = 'Microsoft Sans Serif,10'
  74.  
  75. $CheckBox1                       = New-Object system.Windows.Forms.CheckBox
  76. $CheckBox1.text                  = "Reverse Sort"
  77. $CheckBox1.AutoSize              = $false
  78. $CheckBox1.width                 = 113
  79. $CheckBox1.height                = 20
  80. $CheckBox1.location              = New-Object System.Drawing.Point(234,149)
  81. $CheckBox1.Font                  = 'Microsoft Sans Serif,10'
  82.  
  83. $Button3                         = New-Object system.Windows.Forms.Button
  84. $Button3.text                    = "Start"
  85. $Button3.width                   = 60
  86. $Button3.height                  = 30
  87. $Button3.location                = New-Object System.Drawing.Point(170,185)
  88. $Button3.Font                    = 'Microsoft Sans Serif,10'
  89.  
  90. $Label4                          = New-Object system.Windows.Forms.Label
  91. $Label4.text                     = "Sort by:"
  92. $Label4.AutoSize                 = $true
  93. $Label4.width                    = 25
  94. $Label4.height                   = 10
  95. $Label4.location                 = New-Object System.Drawing.Point(22,146)
  96. $Label4.Font                     = 'Microsoft Sans Serif,10'
  97.  
  98. $ComboBox1                       = New-Object system.Windows.Forms.ComboBox
  99. $ComboBox1.text                  = ""
  100. $ComboBox1.width                 = 100
  101. $ComboBox1.height                = 20
  102. @('Name','Size','Creation','Modification','Accessed') | ForEach-Object {[void] $ComboBox1.Items.Add($_)}
  103. $ComboBox1.location              = New-Object System.Drawing.Point(83,144)
  104. $ComboBox1.Font                  = 'Microsoft Sans Serif,10'
  105. $ComboBox1.SelectedIndex         = 0
  106.  
  107. $Form.controls.AddRange(@($TextBox1,$Label1,$Button1,$TextBox2,$Label2,$TextBox3,$Button2,$Label3,$CheckBox1,$Button3,$Label4,$ComboBox1))
  108.  
  109. #region gui events {
  110. $Button1.Add_Click({
  111.   $objForm = New-Object System.Windows.Forms.FolderBrowserDialog
  112.   $objForm.Description = "Select folder containing files"
  113.   $objForm.SelectedPath = [System.Environment+SpecialFolder]'MyComputer'
  114.   $objForm.ShowNewFolderButton = $false
  115.   $result = $objForm.ShowDialog()
  116.   if ($result -eq "OK") {
  117.     $TextBox1.Text = $objForm.SelectedPath
  118.   } else {
  119.     $TextBox1.Text = ""
  120.   }
  121. })
  122.  
  123. $Button2.Add_Click({
  124. $SaveChooser = New-Object -TypeName System.Windows.Forms.SaveFileDialog
  125. $SaveChooser.ShowDialog()
  126. $TextBox3.Text = $SaveChooser.FileName
  127. })
  128.  
  129. $Button3.Add_Click({
  130.   if ($TextBox2.Text -eq "") { $TextBox2.Text = '*.txt'}
  131.   if (($TextBox1.Text -ne "") -and ($TextBox3.Text -ne "")) {
  132.     Sort-Files
  133.   }
  134. })
  135.  
  136. #endregion events }
  137.  
  138. #endregion GUI }
  139.  
  140. #Write your logic code here
  141.  
  142. Function Sort-Files {
  143.   $files = Get-ChildItem ($TextBox1.Text + '\' + $TextBox2.Text)
  144.   if ($CheckBox1.Checked) {
  145.     switch ($ComboBox1.SelectedItem) {
  146.       'Name' { $sorted = $files | Sort-Object -Property Name -Descending }
  147.       'Size' { $sorted = $files | Sort-Object -Property Length -Descending }
  148.       'Creation' { $sorted = $files | Sort-Object -Property CreationTime -Descending }
  149.       'Modification' { $sorted = $files | Sort-Object -Property LastWriteTime -Descending }
  150.       'Accessed' { $sorted = $files | Sort-Object -Property LastAccessTime -Descending }
  151.     }
  152.   } else {
  153.     switch ($ComboBox1.SelectedItem) {
  154.       'Name' { $sorted = $files | Sort-Object -Property Name }
  155.       'Size' { $sorted = $files | Sort-Object -Property Length }
  156.       'Creation' { $sorted = $files | Sort-Object -Property CreationTime }
  157.       'Modification' { $sorted = $files | Sort-Object -Property LastWriteTime }
  158.       'Accessed' { $sorted = $files | Sort-Object -Property LastAccessTime }
  159.     }
  160.   }
  161.   Merge-Files $sorted
  162. }
  163.  
  164. Function Merge-Files {
  165.   param (
  166.     $objects
  167.   )
  168.   for ($I = 0; $i -lt $objects.Count; $i++) {
  169.     Add-Content -Path $TextBox3.Text "`r`n----------`r`n$($objects[$i].Fullname)`r`n----------"
  170.     Add-Content -Path $TextBox3.Text -Value (Get-Content $objects[$i])
  171.   }
  172. }
  173.  
  174. [void]$Form.ShowDialog()

Filter defaults to *.txt if it's empty when Start is pressed.

Create a shortcut to run it from with the Target as: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -File "Concat-GUI.ps1"

Guess that’s a no on mine. Well I tried  ;)

I’ll delete the download.

No need to, the more the merrier ... I only do this for some mental exercise and I use little to no error checking in my scripts, (because I'm lazy :D ), so something someone else writes is more likely to be PEBKAC proof.

12
General Software Discussion / Re: Anyone using Blackbird?
« on: October 05, 2018, 05:14 PM »
After you've run Blackbird to stop all the Windows 10 telemetry, etc, open a Command Line Interface:

  • Win + r
  • Type 'cmd.exe' then hit Enter

Type the following command into the Command Line Interface window when it opens:

C:\full path to\Blackbird.exe -l

Replace 'C:\full path to' with the actual path where you have Blackbird installed.

The option is a lower case L, (not 1 or I).

I did this yesterday on my machine, it should revert changes made to fix LAN working.

2018-10-06 08_55_31-Run.png 2018-10-06 08_56_07-C__WINDOWS_system32_cmd.exe.png

Alternatively, enter the full path to Blackbird after pressing Win + r:

2018-10-06 08_59_47-Run.png

According to OOSU, Blackbird still leaves a lot of things enabled that could be disabled - of course, it may take care of them at a deeper level, (eg. block access to the host server), however it still allows app access to things like: call history, messages, calendar, etc.

13
Only to look up the Add-Content command, otherwise was just a mashup of other small scripts I've done.

Was trying to get Add-Content to work instead of Out-File since it takes care of character encoding depending on the input files without having to specify it like Out-File.

Couldn't seem to get the pipes right though.

I like PowerShell because it reminds me a lot of ARexx on  Amiga, you can write off the cuff small bits of code that leverage the system and other programs, run them instantly, and get reasonably non-cryptic error messages back when you screw up.
Plus it's part of the system, I don't need to install IDE, compiler, etc, etc.

Edit: DUH! Just found how it's done using Add-Content  :-[
Wonderful what happens when you have a good sleep ...
Code: PowerShell [Select]
  1. Add-Content -Path 'output.txt' -Value (Get-Content $_.Fullname)

Modified my original post

Can also throw a Sort in the pipe if a particular order is wanted, eg.

Get-ChildItem ..\*.ps1 | Sort CreationTime | ...
Get-ChildItem ..\*.ps1 | Sort -Descending Length | ...

etc etc

14
Code: PowerShell [Select]
  1. Get-ChildItem ..\*.ps1 | ForEach-Object { Add-Content -Path 'output.txt' "`r`n----------`r`n$($_.FullName)`r`n----------"; Add-Content -Path 'output.txt' -Value (Get-Content $_.Fullname) }

Output:
Code: Text [Select]
  1. ----------
  2. Z:\test\Base64Encode.ps1
  3. ----------
  4. $Content = Get-Content -Path K:\favicon.ico -Encoding Byte
  5. $Base64 = [System.Convert]::ToBase64String($Content)
  6. $Base64 | Out-File K:\encoded.txt
  7.  
  8. ----------
  9. Z:\test\concat.ps1
  10. ----------
  11. Get-ChildItem ..\*.ps1 | ForEach-Object { Add-Content -Path 'output.txt' "`r`n----------`r`n$($_.FullName)`r`n----------"; Get-Content $_ | Out-File 'output.txt' -Append -Encoding utf8 }
  12.  
  13. ----------
  14. Z:\test\Detect-Computers.ps1
  15. ----------
  16. Ping 192.168.0.255
  17. arp -a | select-string 'dynamic' | foreach  {$_.line.trim().split(" ") | select -first 1 } | foreach {(Resolve-DnsName -Name $_ -ea 0).namehost}
  18. (Test-Connection SABnzbd -Quiet -Count 1)

15
Living Room / Re: Any maths genius?
« on: October 02, 2018, 08:43 AM »
From a purely informational point of view, what happens when there are less than 250 files to be processed?

Does the process stop?
Does it continue, thereby processing less than the stipulated 250 files per day?

The only way to win, is not to play the game  ;D :Thmbsup: :huh:

I don't do Excel so I'm safe  ;)

I just thought I'd point out an informational shortfall, something that will be of assistance when asking on Stack Exchange/Super User.

16
Living Room / Re: Any maths genius?
« on: October 02, 2018, 01:24 AM »
From a purely informational point of view, what happens when there are less than 250 files to be processed?

Does the process stop?
Does it continue, thereby processing less than the stipulated 250 files per day?

17
General Software Discussion / Re: Et Tu, CCleaner!
« on: October 01, 2018, 02:07 AM »
Now CCleaner's price model is ridiculous, 25 bucks plus VAT p.a. if you want it to delete the cookies automatically, after your closing the browser;

Wouldn't it be a lot less complicated, (and cheaper), to have the browser delete cookies when it's closed, (ie. they all become session cookies) ?

18
Living Room / Re: Backup Power for USB device -- does it exist?
« on: September 26, 2018, 05:18 AM »
Are you sure that power is disconnected during boot of the RPi?

It shuts off power to the USB ports according to my USB V/A meter, for about 2 seconds ... of course that doesn't exclude a USB initialisation from also being sent.

19
Living Room / Re: Backup Power for USB device -- does it exist?
« on: September 25, 2018, 10:03 PM »
The Y-cable would have also done the trick, plug the power-only lead into another USB charger/outlet or a power bank.

I know the RPi is already plugged into an UPS but if the power bank has two USB outlets and pass-through charging, could have plugged the RPi into the power bank also for a "mini UPS".

USB Host ports are usually protected against input voltage.

eg.

IMG_20180926_125038442.jpg

But yes, a powered USB hub is cheaper/simpler, nice one mwb1100  :up:

20
General Software Discussion / Re: Vivaldi and Multiple User Profiles
« on: September 24, 2018, 05:14 PM »
Not the same thing, I know, but I run multiple instances of Vivaldi concurrently, (which I just saw you mentioned  :-[ ... I blame it on the small phone screen).

eg. Stable release x64 installed (system default), beta x32 as portable, and beta x64 as Incognito portable.

They each have their own configs and haven't yet screwed up any of the other configs.

Most likely chews through more RAM but with 24GB it hasn't been a problem and multiple profiles isn't a feature I've ever used in a browser.

21
Finished Programs / Re: DONE: Tally folder contents by file date
« on: September 24, 2018, 07:19 AM »
From here: Powershell version ...
Ohh...nice find.   :Thmbsup:

The power of Google ;)

This'll do every sub-folder of the given folder with matching output names:
Code: PowerShell [Select]
  1. $folders = Get-ChildItem $args -Directory
  2. for ($i = 0; $i -lt $folders.Count; $i++) {
  3.   $file = $folders[$i].BaseName + ".txt"
  4.   Get-ChildItem $folders[$i].Fullname -File |
  5.     Group {$_.CreationTime.ToString("yyyy-MM-dd")} |
  6.     Sort Name |
  7.     Format-Table Name,Count -Auto |
  8.     Out-File -FilePath $file
  9. }

22
Finished Programs / Re: DONE: Tally folder contents by file date
« on: September 24, 2018, 06:50 AM »
From here: Powershell version

TallyCreateDate.ps1
Code: PowerShell [Select]
  1. Get-ChildItem $args -File | Group {$_.CreationTime.ToString("yyyy-MM-dd")} | Sort Name | Format-Table Name,Count -auto

eg.

.\TallyCreateDate.ps1 "Z:\test folder" >"test folder.txt"

Output:

Code: Text [Select]
  1. Name       Count
  2. ----       -----
  3. 2015-02-02     1
  4. 2015-06-09     1
  5. 2015-06-28     1
  6. 2015-07-21     1
  7. 2015-08-29     1
  8. 2015-10-24     1
  9. 2015-12-16     1
  10. 2016-01-15     1
  11. 2016-05-27     1
  12. 2016-06-20     1
  13. 2016-07-10     4
  14. 2016-07-12     2
  15. 2017-11-01     1
  16. 2018-04-05     1
  17. 2018-04-14     4
  18. 2018-07-14     2
  19. 2018-08-03     1
  20. 2018-08-08     1
  21. 2018-08-10     1
  22. 2018-08-13     4
  23. 2018-08-14     1
  24. 2018-08-17     3
  25. 2018-09-19     1
  26. 2018-09-24     1

23
Input
File 1: xml-test.xml
<?xml version="1.0" encoding="ISO8859-1" ?>
<html:products>
    <html:prod id="prod1">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD</html:classificationType>
          <html:productType>PRD_XE</html:productType>
          <html:productId>10004</html:productId>
          <html:assignedDate>2018-07-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REPAIRS</html:name>
          <html:Entity>REP_XE</html:legalEntity>
          <html:location>ED</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod2">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD2</html:classificationType>
          <html:productType>PRD_XE2</html:productType>
          <html:productId>10005</html:productId>
          <html:assignedDate>2018-12-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REPAIRS2</html:name>
          <html:Entity>REP_XE2</html:legalEntity>
          <html:location>ED2</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod3">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD</html:classificationType>
          <html:productType>PRD_XE</html:productType>
          <html:productId>10004</html:productId>
          <html:assignedDate>2013-07-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REPAIRS3</html:name>
          <html:Entity>REP_XE3</html:legalEntity>
          <html:location>ED3</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod1">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD4</html:classificationType>
          <html:productType>PRD_XE4</html:productType>
          <html:productId>10567</html:productId>
          <html:assignedDate>2010-07-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REPAIRS4</html:name>
          <html:Entity>REP_XE4</html:legalEntity>
          <html:location>ED4</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod5">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD5</html:classificationType>
          <html:productType>PRD_XE5</html:productType>
          <html:productId>10004890</html:productId>
          <html:assignedDate>2015-05-15</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REPAIRS5</html:name>
          <html:Entity>REP_XE5</html:legalEntity>
          <html:location>ED5</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
</html:products>

File2: xml test2.xml
<?xml version="1.0" encoding="ISO8859-1" ?>
<html:products>
    <html:prod id="prod1">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD</html:classificationType>
          <html:productType>PRD_XE</html:productType>
          <html:productId>10004</html:productId>
          <html:assignedDate>2018-03-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REFUNDS</html:name>
          <html:Entity>REP_XE</html:legalEntity>
          <html:location>ED</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod2">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD2</html:classificationType>
          <html:productType>PRD_XE2</html:productType>
          <html:productId>10005</html:productId>
          <html:assignedDate>2015-12-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>REPAIRS2k12</html:name>
          <html:Entity>REP_XE2</html:legalEntity>
          <html:location>ED57</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod3">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD4</html:classificationType>
          <html:productType>PRD_XER3</html:productType>
          <html:productId>10014</html:productId>
          <html:assignedDate>2010-07-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>DESTRUCTION</html:name>
          <html:Entity>REP_XE3</html:legalEntity>
          <html:location>ED43</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod4">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD4</html:classificationType>
          <html:productType>PRD_XE4</html:productType>
          <html:productId>10567</html:productId>
          <html:assignedDate>1999-07-23</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>WHORU</html:name>
          <html:Entity>REP_XS4</html:legalEntity>
          <html:location>ED4</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
    <html:prod id="prod5">
      <html:referenceData>
        <html:product>
          <html:classificationType>PRD5</html:classificationType>
          <html:productType>PRD_XE5</html:productType>
          <html:productId>10004890</html:productId>
          <html:assignedDate>2115-12-15</html:assignedDate>
        </html:product>
        <html:book>
          <html:name>SCREW_THIS</html:name>
          <html:Entity>REP_XE5</html:legalEntity>
          <html:location>ED5</html:location>
        </html:book>
      </html:referenceData>
   </html:prod>
</html:products>


2018-09-22 12_44_50-XML Mulcher.png

2018-09-22 12_46_07-K__.png

Output
10004890.csv
Code: Text [Select]
  1. prod5,PRD5,PRD_XE5,10004890,2115-12-15,SCREW_THIS,REP_XE5,ED5
  2. prod5,PRD5,PRD_XE5,10004890,2015-05-15,REPAIRS5,REP_XE5,ED5

10004890.xml
Code: Text [Select]
  1. <html:prod id="prod5">
  2.       <html:referenceData>
  3.         <html:product>
  4.           <html:classificationType>PRD5</html:classificationType>
  5.           <html:productType>PRD_XE5</html:productType>
  6.           <html:productId>10004890</html:productId>
  7.           <html:assignedDate>2115-12-15</html:assignedDate>
  8.         </html:product>
  9.         <html:book>
  10.           <html:name>SCREW_THIS</html:name>
  11.           <html:Entity>REP_XE5</html:legalEntity>
  12.           <html:location>ED5</html:location>
  13.         </html:book>
  14.       </html:referenceData>
  15.    </html:prod>
  16. <html:prod id="prod5">
  17.       <html:referenceData>
  18.         <html:product>
  19.           <html:classificationType>PRD5</html:classificationType>
  20.           <html:productType>PRD_XE5</html:productType>
  21.           <html:productId>10004890</html:productId>
  22.           <html:assignedDate>2015-05-15</html:assignedDate>
  23.         </html:product>
  24.         <html:book>
  25.           <html:name>REPAIRS5</html:name>
  26.           <html:Entity>REP_XE5</html:legalEntity>
  27.           <html:location>ED5</html:location>
  28.         </html:book>
  29.       </html:referenceData>
  30.    </html:prod>


Code: PowerShell [Select]
  1. <#
  2. .NAME
  3.     XML-GUI.ps1
  4. #>
  5.  
  6. Add-Type -AssemblyName System.Windows.Forms
  7. [System.Windows.Forms.Application]::EnableVisualStyles()
  8.  
  9. #region begin GUI{
  10.  
  11. $Form                            = New-Object system.Windows.Forms.Form
  12. $Form.ClientSize                 = '246,178'
  13. $Form.text                       = "XML Mulcher"
  14. $Form.BackColor                  = "#cccccc"
  15. $Form.TopMost                    = $false
  16. $Form.FormBorderStyle            = 'Fixed3D'
  17. $Form.MaximizeBox                = $false
  18.  
  19. $TextBox1                        = New-Object system.Windows.Forms.TextBox
  20. $TextBox1.Text                   = ""
  21. $TextBox1.multiline              = $false
  22. $TextBox1.ReadOnly               = $true
  23. $TextBox1.Width                  = 185
  24. $TextBox1.height                 = 20
  25. $TextBox1.Location               = New-Object System.Drawing.Point(16,20)
  26. $TextBox1.Font                   = 'Microsoft Sans Serif,10'
  27.  
  28. $ListBox1                        = New-Object system.Windows.Forms.ListBox
  29. $ListBox1.text                   = ""
  30. $ListBox1.width                  = 100
  31. $ListBox1.height                 = 56
  32. @('Classification','ProductType','ProductID') | ForEach-Object {[void] $ListBox1.Items.Add($_)}
  33. $ListBox1.location               = New-Object System.Drawing.Point(16,50)
  34.  
  35. $Label1                          = New-Object system.Windows.Forms.Label
  36. $Label1.Text                     = "Processing:"
  37. $Label1.width                    = 68
  38. $Label1.height                   = 16
  39. $Label1.location                 = New-Object System.Drawing.Point(16,146)
  40. $Label1.Font                     = 'Microsoft Sans Serif,8'
  41.  
  42. $TextBox2                        = New-Object system.Windows.Forms.TextBox
  43. $TextBox2.multiline              = $false
  44. $TextBox2.ReadOnly               = $true
  45. $TextBox2.Width                  = 140
  46. $TextBox2.height                 = 16
  47. $TextBox2.Location               = New-Object System.Drawing.Point(88,144)
  48. $TextBox2.Font                   = 'Microsoft Sans Serif,8'
  49.  
  50. $Button1                         = New-Object system.Windows.Forms.Button
  51. $Button1.text                    = "Go"
  52. $Button1.width                   = 60
  53. $Button1.height                  = 30
  54. $Button1.location                = New-Object System.Drawing.Point(171,65)
  55. $Button1.Font                    = 'Microsoft Sans Serif,10'
  56.  
  57. $Button2                         = New-Object system.Windows.Forms.Button
  58. $Button2.text                    = "..."
  59. $Button2.width                   = 25
  60. $Button2.height                  = 25
  61. $Button2.location                = New-Object System.Drawing.Point(206,19)
  62. $Button2.Font                    = 'Microsoft Sans Serif,10'
  63.  
  64. $Label2                          = New-Object system.Windows.Forms.Label
  65. $Label2.Text                     = "Output:"
  66. $Label2.width                    = 60
  67. $Label2.height                   = 16
  68. $Label2.location                 = New-Object System.Drawing.Point(16,120)
  69. $Label2.Font                     = 'Microsoft Sans Serif,8'
  70.  
  71. $RadioButton1                    = New-Object system.Windows.Forms.RadioButton
  72. $RadioButton1.text               = "XML"
  73. $RadioButton1.AutoSize           = $true
  74. $RadioButton1.width              = 40
  75. $RadioButton1.height             = 16
  76. $RadioButton1.location           = New-Object System.Drawing.Point(88,118)
  77. $RadioButton1.Font               = 'Microsoft Sans Serif,8'
  78.  
  79. $RadioButton2                    = New-Object system.Windows.Forms.RadioButton
  80. $RadioButton2.text               = "CSV"
  81. $RadioButton2.Checked            = $true
  82. $RadioButton2.AutoSize           = $true
  83. $RadioButton2.width              = 40
  84. $RadioButton2.height             = 16
  85. $RadioButton2.location           = New-Object System.Drawing.Point(148,118)
  86. $RadioButton2.Font               = 'Microsoft Sans Serif,8'
  87.  
  88. $Form.controls.AddRange(@($ListBox1,$TextBox1,$Button1,$Button2,$Label1,$TextBox2,$Label2,$RadioButton1,$RadioButton2))
  89.  
  90. #region gui events {
  91. $Button1.Add_Click({
  92.   if ($TextBox1.Text -ne "") {
  93.     if ($ListBox1.SelectedItem -ne $null) {
  94.       Clear-Host
  95.       Set-Regex ($ListBox1.SelectedItem)
  96.     }
  97.   }
  98. })
  99.  
  100. $Button2.Add_Click({
  101.   $objForm = New-Object System.Windows.Forms.FolderBrowserDialog
  102.   $objForm.Description = "Select folder containing XML"
  103.   $objForm.SelectedPath = [System.Environment+SpecialFolder]'MyComputer'
  104.   $objForm.ShowNewFolderButton = $false
  105.   $result = $objForm.ShowDialog()
  106.   if ($result -eq "OK") {
  107.     $TextBox1.Text = $objForm.SelectedPath
  108.   } else {
  109.     $TextBox1.Text = ""
  110.   }
  111. })
  112.  
  113. #endregion events }
  114. #endregion GUI }
  115.  
  116.  
  117. #Write your logic code here
  118. Function Set-Regex {
  119.   param (
  120.     [string]$selItem
  121.   )
  122.   switch ($selItem) {
  123.     "Classification" { $regex = '(____________________________)(.+?)(___)' }
  124.     "ProductType" { $regex = '(_____________________)(.+?)(___)' }
  125.     "ProductID" { $regex = '(___________________)(.+?)(___)' }
  126.   }
  127.   Mulch-Files $regex
  128. }
  129.  
  130. Function Mulch-Files {
  131.   param (
  132.     [string]$pattern
  133.   )
  134.   $files = Get-ChildItem -Path ($TextBox1.Text + "\*.xml")
  135.   for ($h = 0; $h -lt $files.Count; $h++) {
  136.     $TextBox2.Text = $files[$h].Name
  137.     $products = (Get-Content $files[$h] -Raw) -_____ '(____)^.*?(____________________________)'
  138.     for ($i = 1; $i -lt $products.Count; $i += 2) {
  139.       $products[$i] -_____ '(_________)(.+?)(___)'
  140.       $prod = $Matches[0]
  141.       $temp = $products[$i] -_____ $pattern
  142.       for ($j = 0; $j -lt $temp.Count; $j++) {
  143.         if ($RadioButton2.Checked) {
  144.           $outFile = $Matches[0] + ".csv"
  145.           $outText = ($prod + (((($products[$i] -replace '(<[^>]+>|\s)', ',' ) -replace '`r', '') -replace '`n', '') -replace '(,)(,)+', '$1').TrimEnd(','))
  146.         } else {
  147.           $outFile = $Matches[0] + ".xml"
  148.           $outText = $products[$i]
  149.         }
  150.         Out-File -FilePath $outFile -InputObject $outText -Append
  151.       }
  152.     }
  153.   }
  154.   $TextBox2.Text = "Finished"
  155. }
  156.  
  157. [void]$Form.ShowDialog()

24
You expected anything more?

@kalos: Paste your complete PS script here as it is currently, not as a single line but as a correctly formatted script with no PS shortcuts.

FYI: 80% of what you seemingly want now is covered by this script: http://www.donationc....msg422784#msg422784

Only thing missing is output to separate files which would be trivial to add ...

25
What's the difference?

You either have 3 lines that say:

3  Product1
1  Product2
1  Product3

Or three files that contain lines that say:

File "Product1.txt"
Product1
Product1
Product1

File "Product2.txt"
Product2

File "Product3.txt"
Product3

Either way all you're getting is a count of how many times a match appears.

Pages: [1] 2 3 4 5 6 ... 198next