topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday April 9, 2026, 8:33 pm
  • Proudly celebrating 15+ 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

Recent Posts

Pages: prev1 ... 12 13 14 15 16 [17] 18 19 20 21 22 ... 225next
401
Hi 4wd,
Wow. Many thanks. This is fantastic. ;)

You're welcome  :)

I did some tests and the only small things that are not working are :
- it doesn't delete empty folders of folder1 (if some subfolders are empty or not with other kind of files).

It just needs to call the Delete-SmallPDF function again after doing the Check-PDF function.

Not sure whether you mean folder1 should be completely empty at the end or not since files that aren't PDF will be remaining - ie. delete everything in folder1 after running the Check-PDF function.

In which case, what happens to the non-PDF files that were in the folders?
Delete or move with PDF?

Testing for text PDFs ...
Move-Item : Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard character pattern is not valid: [Lac_ven_Drnyvn,_Sr_ehajoe_Uduizn,_Giles_Suilo-Sm(e-kjd.org).pdf
At C:\Users\E\Documents\test\jityPDFt3v5_7zip.ps1:82 char:7
+       Move-Item "$($files[$i])" -Destination "$($outfile)"
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Move-Item], ParameterBindingException
    + FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.PowerShell.Commands.MoveItemCommand

Then, the test "for text PDFs" stops and the other same kind of files are not processed.

Also if the pdf file has "[" in its filename, it ignores it (but creates an empty folder in folder2 if the pdf is located into a subfolder).

The replace strange characters in the filename was going to be part of the too long filename function, just haven't got there yet.

Can you zip up some of the PDFs it stops on, (strange characters, etc - 3 or 4 would be good) ?

Unfortunately, going to be a bit busy this week so might not get back to this until next week, I'll see how I go.

EDIT: OK, besides having a full path less than 260 characters, you can apparently only have a full directory path of 247 characters maximum.

ie.

C:\plus 243 characters\                            (max 247 chars)
C:\plus 243 characters\16characters.pdf    (max 259 chars)

Otherwise you get this:
New-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than
260 characters, and the directory name must be less than 248 characters.

ADDENDUM: Give the update a try, it should remove any special characters from file names and in theory it'll shorten filenames if it's the length of the filename that pushes the total path length over the 259 character limit.

If, however, it's the path that exceeds the 247 character limit then the file won't be touched, it'll remain in the initial folder ... so goes the theory :-\

ie.
- If the filename has diacritics and various other strange characters, they'll be removed. (At this point no rename happens.)
  An example: This: François-Xavier!!#@$%^&()_+}{ €$¥£¢ ^$.+()[{ 0123456789.pdf will turn into this: FrancoisXavier()_ Yc () 0123456789.pdf
- If the folder path is less than 248 characters and the full path is less than 259 characters, the file will be renamed.
- If the folder path is less than 248 characters and the full path is greater than 259 characters, the new filename will be truncated and then the file is renamed.
- If the folder path is greater than 247 characters, nothing happens - the file isn't renamed, it will remain in the initial folder.

I might have to tweak the Get-ChildItem statement in the Check-PDF routine to ignore file paths greater than 259 characters, see how you go.

Currently doesn't check for the existence of a file with the same name before renaming.
402
Okey dokey, most of the way there now ...

  • Deletes duplicate archives
  • Extracts archives, (including in sub-folders)
  • Deletes small PDFs and empty folders
  • Checks for text/image based PDFs and moves them into different folders, (recreating folder tree) - all it does is count the number of text lines in the first 5 pages, (or less if there's less than 5 total), and if the number is greater than a set threshold regards it as a text based PDF

Only thing left is the long names bit I think.

Updated
403
In fact I think the last big change for WinRAR was the new Version 5 in 2017 (https://www.ghacks.n...h-important-changes/). And alas 7Zip4Powershell won't be updated soon (see https://github.com/t...98f1e274d20675cc2e57 and https://github.com/t...f03ed9e4d0aa226a635f).
edit: "7-Zip v15.06 and later support extraction of files in the RAR5 format" https://en.wikipedia.org/wiki/7-Zip
I did a test with an old rar file and it worked.

I think the problem is with the intermediate DLL it uses, SevenZipSharp, which is actively maintained and did get updated for RAR5: SevenZipSharp

If I can get an updated DLL then it should work OK - might have to reinstall Visual Studio and compile it.

In the meantime I'll get it to use unrar instead.

Changed my mind and just made it use 7z.exe, see the updated script.  Just copy the latest versions of 7z.exe and 7z.dll into the same folder as the script.

Still doesn't do extracted archives ... still thinking about it  :P

You can uninstall the 7Zip4Powershell module by opening an Admin Powershell console and entering:
Code: PowerShell [Select]
  1. uninstall-module -name 7Zip4Powershell
404
Living Room / Re: Migrating from Ymail to Gmail
« Last post by 4wd on November 16, 2019, 06:38 PM »
Is there a way to migrate from yahoo to gmail without losing any data? I need to maintain records of all my emails, more than a decade ago.

1. Install email client with IMAP support
2. Add your GMail account to it using IMAP
3. Add your Yahoo account to it using IMAP
4. Drag all the messages in the Yahoo account to the GMail account
5. Go make coffee

Which is basically what sphere said above since it's the easiest way to do it.

I didn't know this was so easy!

Would this work from IMAP to POP? i.e., so I can archive my Gmail (IMAP) to a private account (POP) which I control and have a local copy of?

Sorry, I've only done IMAP to IMAP but there's nothing to stop you creating both IMAP and POP settings for the same account in the email client.
I suffix IMAP accounts with [IMAP] so I can tell them apart from POP, (using Thunderbird).

BTW, another email client based on Thunderbird: Interlink
405
Living Room / Re: Migrating from Ymail to Gmail
« Last post by 4wd on November 16, 2019, 02:34 AM »
Is there a way to migrate from yahoo to gmail without losing any data? I need to maintain records of all my emails, more than a decade ago.

1. Install email client with IMAP support
2. Add your GMail account to it using IMAP
3. Add your Yahoo account to it using IMAP
4. Drag all the messages in the Yahoo account to the GMail account
5. Go make coffee

Which is basically what sphere said above since it's the easiest way to do it.
406
What happens if the path is longer than 260 characters?
Some old softwares can't open the file later on (also it adds complexity to some of my hard drives and can cause various errors https://www.donation....msg373167#msg373167).

I meant if the path section of the full path to the file is longer than 260 characters, eg. "R:\a path\that is really\really long, like\over 260 characters\file.pdf"

Here is a simple rar file created by "WinRAR 5.71 64bits" for your tests : https://www.cjoint.com/c/IKprhRLGMRD

Well there you go - 7zip can't open that archive, was it created using some strange options?

First one I've come across that it can't handle, (admittedly I stopped using anything but 7z archives a long long time ago though).

Guess I'll have to do a workaround for rar archives and use unrar instead.

I am not sure that I understand but I would like to keep all the kind of files that could be inside the zip files even if there are not pdf files.

OK, just wondering since small PDFs were deleted and it didn't look like anything other than PDFs were being worked on.

Have updated the script above so it doesn't delete the archive if it gets an error.
407
Truncate is fine as long as it keeps the file extension. ;)
For instance : If a filename is longer than 200 characters (let's say that basically my folder subfolder paths are always less than 60 characters), truncate the last part of the filename to less than 200 characters and keep the extension.

OK, see what I can do.

What happens if the path is longer than 260 characters?

- It doesn't 'unzip' rar files (it is working fine for zip files).

Strange, works fine with zip and rar files here.
Maybe a later version of the 7z libraries are required for them or just switch to calling 7zsa.exe instead.

Do you have a rar file you can let me play with?

- If possible do not delete the original zip or rar file if there is an error unzipping.

OK, have to see if there is an error code returned.

- It does not find zip files inside zip files (even if Run it twice). It is maybe because it doesn't look for zip and rar files inside subfolders ?

That's because I missed the word 'recursively' in your OP.  :-[

Guess it'd have to keep looping until there were no archives left or something ... have to think about it.

>PDFTextChecker.exe.  This version uses the pdftotext.exe to extract any text from the PDF and then checks the resulting text file for any alphanumeric characters.  If any are found, it considers that searchable.

Yeah, I created an image PDF for a test.  After running pdftotext.exe on it there was a much smaller text file with 'Page 1/1' in it.  So might end up thinking image PDFs are text PDFs due to headers/footers in the PDF.

If there's not likely to be headers/footers then it'd be easy enough to check and act on the result.

I realize that I also remove some strange characters in the pdf filenames like accents, °, !, +, & , ..etc.. with the freeware "Bulk Rename Utility" as PDFTextChecker can't do a check on them. I don't know if it is possible this in Powershell ?

Should be easy enough by removing any characters not in the old ASCII table.

BTW, just as a matter of interest, are any files other than PDFs required?

ie. Extract archives then delete anything that's too small or not a PDF.
408
Requires (in the same folder):
7z.exe
7z.dll
itextsharp.dll

Attached the versions I'm using, (for x64 only).

Set the variables at the start as required.

jityPDFt3.ps1

Code: PowerShell [Select]
  1. <#
  2.   Copy 7z.exe and 7z.dll into the same folder as this script.
  3.  
  4.   Requires iTextSharp.dll in the same folder as this script - can be extracted from
  5.   itextsharp.5.5.13.1.nupkg by changing extension to .zip - package can be downloaded from
  6.   https://github.com/itext/itextsharp/releases
  7. #>
  8.  
  9. # Initial folder with archives
  10. $folder1 = 'G:\test\folder1'
  11. # Folder for text based PDFs
  12. $folder2 = 'G:\test\Text'
  13. # Folder for non-text PDFs
  14. $folder3 = 'G:\test\Image'
  15. # Threshold to determine whether PDF is text or image based, equals minimum number of
  16. # lines of text to be detected before PDF is considered text based.
  17. # The threshold applies to the number of lines detected across first 5 pages, (or all
  18. # if less than 5 pages).
  19. $TextPDFThreshold = 20
  20. # Delete extracted archives: $true or $false
  21. # Archives that fail extraction won't be deleted regardless of this setting.
  22. $delArc = $false
  23. <# ------------------- #>
  24.  
  25. Add-Type -Path ".\itextsharp.dll"
  26.  
  27. Function Delete-Dupes {
  28. Get-ChildItem "$($folder1)\*" -File -Include *.zip,*.rar,*.7z,*.pdf | Get-FileHash | Group -Property Hash | Where { $_.count -gt 1 } `
  29.   | % { $_.group | Select -Skip 1 } | Remove-Item -Force
  30. }
  31.  
  32. Function Extract-Items {
  33.   for ($j = 0; $j -lt 2; $j++) {
  34.     if ($j -ne 1) {
  35.       $files = Get-ChildItem "$($folder1)\*" -File -Include *.zip,*.rar,*.7z
  36.     } else {
  37.       $files = Get-ChildItem "$($folder1)" -Include *.zip,*.rar,*.7z -Recurse
  38.     }
  39.     for ($i = 0; $i -lt $files.Count; $i++) {
  40.       $tempdest = "$(([io.path]::GetDirectoryName($files[$i])))\$(([io.path]::GetFileNameWithoutExtension($files[$i])))"
  41.       & ".\7z.exe" "x" "-y" "$($files[$i])" "-o$tempdest" | Out-Null
  42.       if ($? -and $delArc) {
  43.         Remove-Item "$($files[$i])" -Force
  44.       }
  45.     }
  46.   }
  47. }
  48.  
  49. Function Delete-SmallPDF {
  50.   param (
  51.     [bool]$delSmall
  52.   )
  53.   if ($delSmall) {
  54.     Get-ChildItem "$($folder1)\*" -Include *.pdf -Recurse | ? {$_.length -lt 2048} | % {Remove-Item $_.fullname -Force}
  55.   }
  56.   Get-ChildItem "$($folder1)" -recurse | Where {$_.PSIsContainer -and `
  57.     @(Get-ChildItem -Lit $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse
  58.   Get-ChildItem "$($folder2)" -recurse | Where {$_.PSIsContainer -and `
  59.     @(Get-ChildItem -Lit $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse
  60.   Get-ChildItem "$($folder3)" -recurse | Where {$_.PSIsContainer -and `
  61.     @(Get-ChildItem -Lit $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse
  62. }
  63.  
  64. Function Fix-FileNames {
  65.   $files = Get-ChildItem "$($folder1)\*" -Include *.pdf -Recurse
  66.   for ($i = 0; $i -lt $files.Count; $i++) {
  67.     $j = 0
  68.     $noSpecialChars = (Convert-ToLatinCharacters "$([io.path]::GetFileNameWithoutExtension($files[$i]))") -replace '[\[\]]', '_'
  69.     $tempName = "$(([io.path]::GetDirectoryName($files[$i])))\$($noSpecialChars)"
  70.     $pathLength = ([io.path]::GetDirectoryName($files[$i])).Length
  71.     $totalLength = $tempName.Length + 4
  72.     if ($pathLength -lt 248) {
  73.       if ($totalLength -gt 251) {
  74.         $fn1 = "$($noSpecialChars.Substring(0, (251 - $pathLength)))"
  75.       } else {
  76.         $fn1 = "$($noSpecialChars)"
  77.       }
  78.     } else {
  79.       $fn1 = $null
  80.       break
  81.     }
  82.     if (($fn1 -ne $null) -and ($fn1 -ne "$([io.path]::GetFileNameWithoutExtension($files[$i]))")) {
  83.       $newName = "$([io.path]::GetDirectoryName($files[$i]))\$($fn1).pdf"
  84.       if (Test-Path $newName) {
  85.         do {
  86.           $j++
  87.           $k = "{0:0000}" -f $j
  88.           $newName = "$([io.path]::GetDirectoryName($files[$i]))\$($fn1)_$($k).pdf"
  89.         } while (Test-Path $newName)
  90.       }
  91.       Rename-Item -LiteralPath "$($files[$i])" "$($newName)"
  92.     }
  93.   }
  94. }
  95.  
  96. Function Convert-ToLatinCharacters {
  97. # https://lazywinadmin.com/2015/05/powershell-remove-diacritics-accents.html
  98. # https://lazywinadmin.com/2015/08/powershell-remove-special-characters.html
  99.   param (
  100.     [string]$inputString
  101.   )
  102.   return ([Text.Encoding]::ASCII.GetString([Text.Encoding]::GetEncoding("Cyrillic").GetBytes($inputString)) -replace '[/;]|[^\p{L}\p{Nd}/(/)/_/ \[\]]', '')
  103. }
  104.  
  105. Function Check-PDF {
  106. # https://superuser.com/questions/1278479/search-pdf-contents-with-powershell-and-output-a-file-list/1278521#1278521
  107.   $files = (Get-ChildItem "$($folder1)\*" -Include *.pdf -Recurse)
  108.   for ($i = 0; $i -lt $files.Count; $i++) {
  109.     if ($files[$i].FullName.Length -lt 260) {
  110.       Write-Host "Processing - $($files[$i]) ..."
  111.       $reader = New-Object iTextSharp.text.pdf.pdfreader -ArgumentList $files[$i].FullName
  112.       if ($?) {
  113.         $linesOfText = 0
  114.         for ($page = 1; $page -le $reader.NumberOfPages; $page++) {
  115.           $pageText = [iTextSharp.text.pdf.parser.PdfTextExtractor]::GetTextFromPage($reader, $page).Split([char]0x000A)
  116.           $linesOfText += $pageText.Count
  117.           if ($page -gt 4) {
  118.             break
  119.           }
  120.         }
  121.         $reader.Close()
  122.         if ($linesOfText -ge $TextPDFThreshold) {
  123.           $outfile = "$($folder2)\$(($files[$i].FullName).Substring($folder1.Length))"
  124.           If(-Not (Test-Path (Split-Path -Path $outfile))) {
  125.             New-Item (Split-Path -Path $outfile) -Type Directory | Out-Null
  126.           }
  127.           Move-Item "$($files[$i])" -Destination "$($outfile)"
  128.         } else {
  129.           $outfile = "$($folder3)\$(($files[$i].FullName).Substring($folder1.Length))"
  130.           If(-Not (Test-Path (Split-Path -Path $outfile))) {
  131.             New-Item (Split-Path -Path $outfile) -Type Directory | Out-Null
  132.           }
  133.           Move-Item "$($files[$i])" -Destination "$($outfile)"
  134.         }
  135.       }
  136.     }
  137.   }
  138. }
  139.  
  140.  
  141. Write-Host 'Removing duplicate archives ...'
  142. Delete-Dupes
  143. Write-Host 'Extracting archives ...'
  144. Extract-Items
  145. Write-Host 'Deleting small PDFs and empty folders ...'
  146. Delete-SmallPDF $true
  147. Write-Host 'Removing diacritics, etc, and fix long paths ...'
  148. Fix-FileNames
  149. Write-Host 'Testing for text PDFs ...'
  150. Check-PDF
  151. Write-Host 'Deleting empty folders ...'
  152. Delete-SmallPDF $false
  153. Write-Host 'Finished ...'

No longer requires PDFTextChecker, uses the itextsharp library.
409
The main.bat file (or powershell?) should do the following :

1) delete duplicate files (MD5 checksum?)
(maybe using this powershell script https://n3wjack.net/...ith-just-powershell/ ?)

Looks good

2) unzip+unrar zip and rar files recursively (and once done delete the originals) of "folder1"
I thought using this old coding snack in ahk (RecurUnZip https://www.donation....msg192366#msg192366) but I need something automatic as my "folder1" path doesn't change.
(I have tried to adapt this powershell code with its comments alas unsucessfully https://superuser.co...-the-archives/620077 !)

Code: PowerShell [Select]
  1. <#
  2.   Uses 7Zip4Powershell module: https://www.powershellgallery.com/packages/7Zip4Powershell/1.9.0
  3.  
  4.   NOTE: You need to use a Admin Powershell Console to install the module.
  5.  
  6. .\Extract.ps1 <archive>
  7.  
  8. <archive> = full path to archive with quotes if necessary
  9. #>
  10.  
  11.  
  12. Param (
  13.   [string]$archive
  14. )
  15.  
  16. # Below, change the R:\folder1 to point to your particular location
  17. $tempdest = "R:\folder1\$(([io.path]::GetFileNameWithoutExtension($archive)))"
  18. Expand-7Zip -ArchiveFileName $archive -TargetPath $tempdest
  19.  
  20. Remove-Item "$($archive)" -Force

3) Reduce filepath to less than 260 characters (because some old programs can't open filepath that are long than 260 characters them later on). I manually use "Path Scanner" (http://www.parhelia-...canner/Download.aspx)

How would you determine what the shortened name should be?
Truncate, remove every second character, etc, etc.

You can't use extended-length paths ?

4) Delete pdf files that are less than 2ko (because they are garbage) (I manually do this by using the freeware Everything and rank by size pdf files)

Same as you're using here for files <3kb.

Code: PowerShell [Select]
  1. Get-ChildItem $path -Filter *.pdf -recurse -file | ? {$_.length -lt 2048} | % {Remove-Item $_.fullname -Force}

5) Run PDFTextChecker (https://www.donation....msg255322#msg255322) on "folder1" by itself (it creates 2 files "!Not_Searchable.txt" and "!Searchable.txt"). Move the Not_Searchable pdf files in "folder2" and Searchable files in "folder3" (maybe using this old coding snack https://www.donation....msg330784#msg330784 ?).

Would be a simple matter of parsing the output files and issuing the appropriate Move-Item sub-command - I'm assuming you also want to keep the existing folder structure?

Then I use ABBYY Finereader 12 Corporate (not the last version which limits the number of page you can OCR per month !) which does an OCR automatically every day of "folder2" (be careful if you follow this process as it sometimes delete pdf files without warnings! So use the options to keep original files in a separated folder!

Probably be easier to just clone folder2 to folder2-orig and then let it run on folder2 letting it delete the originals.


I'll look at patching something together, might be a few days though.  Also, I don't have ABBYY Finereader so can you give me the various commandline options, (both to keep original or not).
410
General Software Discussion / Re: Hosting photos on your own site
« Last post by 4wd on November 01, 2019, 12:31 AM »
jAlbum - was free, now looks to be paid - did have a link to the last free version here, looks like it's gone.

v9.6.1 looks to have been the last free version.

Untested download link (Software Informer), (VT analysis).
411
Coding Snacks / Re: Killing app the way Alfred can in OSX
« Last post by 4wd on October 31, 2019, 10:36 PM »
A search for equivalent of alfred for windows threw up this Reddit which led to this: Wox

An effective launcher for windows
A full-featured launcher, access programs and web contents as you type. Be more productive ever since.

Wox is free for use and open-sourced at Github, Try it now!

It has a load of plugins available including for process killing.

preview-c9e52ccf-7406-469f-9213-ad5f0fa80ec9.png

Actually, it looks pretty good ... might have to move FARR aside for a little testing  ;)

There's a couple of others mentioned also: Hain; Zazu
412
Found Deals and Discounts / Re: Finally: PORTABLE Revo Uninstaller on sale!
« Last post by 4wd on October 31, 2019, 07:03 PM »
Are these still a favorite here?

Just upgraded my v3 portable to v4 because it's a better deal than the installer version, (you get a slightly better deal than BdJ if you already have a licensed copy).

The online database of installed program tracelogs, (although program versions are usually different), and inclusion of Windows Apps are a couple of good improvements in v4.

I've got licensed v3 installed version but on machines that run OS that won't be upgraded, (WHS2011).
413
Coding Snacks / Re: Killing app the way Alfred can in OSX
« Last post by 4wd on October 28, 2019, 09:59 PM »
Perhaps a FARR plugin would be the easiest way to do it?

FARR's ProcessKill Plugin here:  http://www.dcmembers...om/taichi/downloads/

I use the last version (0.0.7) and it works well.

:-[ ... well there you go ... I should pay more attention ;D
414
Coding Snacks / Re: Killing app the way Alfred can in OSX
« Last post by 4wd on October 28, 2019, 07:09 AM »
I think he's after something like, for example, a FARR plugin for killing processes.

You'd type in kill xyz and a list of processes containing the string xyz, (the list updating as more characters were entered), would be listed which then can be terminated by selecting.

Perhaps a FARR plugin would be the easiest way to do it?
415
General Software Discussion / Re: download online video
« Last post by 4wd on October 27, 2019, 05:25 PM »
FWIW, VideoProc downloaded the video, (1280x720), without a problem - it's just another frontend to youtube-dl.
416
General Software Discussion / Re: download online video
« Last post by 4wd on October 26, 2019, 06:54 PM »
You could install SlimJet, (as a portable app), and use it's tab recorder - it'll record anything in the current tab even if it's behind other program windows or you switch to another tab, (let it run in the background and use another tab for browsing).

2019-10-27 10_43_06-DonationCoder.com Forum - Index - Slimjet.png

It'll save it as a WEBM container with VP9/OPUS codecs in your default download folder - can be easily converted to something else using FFMPEG.

Otherwise, send me the link and I'll have a go.
417
VideoProc 3.4 is up as a give away: https://www.videopro...to-mp4-converter.htm

Activate before November 18

In case no-one realises, you can then uninstall and reinstall, (this version), at any time provided you have saved the activation file.

FWIW, you can also extract the installer and copy/rename the {app} folder somewhere - no need to install it, (that I've noticed 'til now).
418
Cheap and nasty PowerShell alternative :D

2019-10-14 17_58_15-Refile.png

Run it from the shortcut or a PowerShell console.

Entering a value for Separator overrides Use first x characters.

Disclaimer: Works here ;)

Code: PowerShell [Select]
  1. <# This form was created using POSHGUI.com  a free online gui designer for PowerShell
  2. .NAME
  3.     Refile.ps1
  4. #>
  5.  
  6. Function FileBrowser {
  7.   $objForm = New-Object System.Windows.Forms.FolderBrowserDialog
  8.   $objForm.Description = "Select folder containing files"
  9.   $objForm.SelectedPath = [System.Environment+SpecialFolder]'MyComputer'
  10.   $objForm.ShowNewFolderButton = $false
  11.   $result = $objForm.ShowDialog()
  12.   if ($result -eq "OK") {
  13.     return $objForm.SelectedPath
  14.   } else {
  15.     return ""
  16.   }
  17. }
  18.  
  19. #region begin GUI{
  20.  
  21. Add-Type -AssemblyName System.Windows.Forms
  22. [System.Windows.Forms.Application]::EnableVisualStyles()
  23.  
  24. $Form                            = New-Object system.Windows.Forms.Form
  25. $Form.ClientSize                 = '400,350'
  26. $Form.text                       = "Refile"
  27. $Form.TopMost                    = $false
  28.  
  29. $TextBox1                        = New-Object system.Windows.Forms.TextBox
  30. $TextBox1.multiline              = $false
  31. $TextBox1.width                  = 225
  32. $TextBox1.height                 = 21
  33. $TextBox1.location               = New-Object System.Drawing.Point(85,19)
  34. $TextBox1.Font                   = 'Microsoft Sans Serif,12'
  35.  
  36. $TextBox2                        = New-Object system.Windows.Forms.TextBox
  37. $TextBox2.multiline              = $false
  38. $TextBox2.width                  = 225
  39. $TextBox2.height                 = 21
  40. $TextBox2.location               = New-Object System.Drawing.Point(85,60)
  41. $TextBox2.Font                   = 'Microsoft Sans Serif,12'
  42.  
  43. $Button1                         = New-Object system.Windows.Forms.Button
  44. $Button1.text                    = "..."
  45. $Button1.width                   = 40
  46. $Button1.height                  = 30
  47. $Button1.location                = New-Object System.Drawing.Point(323,17)
  48. $Button1.Font                    = 'Microsoft Sans Serif,12'
  49.  
  50. $Button2                         = New-Object system.Windows.Forms.Button
  51. $Button2.text                    = "..."
  52. $Button2.width                   = 40
  53. $Button2.height                  = 30
  54. $Button2.location                = New-Object System.Drawing.Point(323,58)
  55. $Button2.Font                    = 'Microsoft Sans Serif,12'
  56.  
  57. $Label1                          = New-Object system.Windows.Forms.Label
  58. $Label1.text                     = "Source:"
  59. $Label1.AutoSize                 = $true
  60. $Label1.width                    = 25
  61. $Label1.height                   = 10
  62. $Label1.location                 = New-Object System.Drawing.Point(20,19)
  63. $Label1.Font                     = 'Microsoft Sans Serif,12'
  64.  
  65. $Label2                          = New-Object system.Windows.Forms.Label
  66. $Label2.text                     = "Dest:"
  67. $Label2.AutoSize                 = $true
  68. $Label2.width                    = 25
  69. $Label2.height                   = 10
  70. $Label2.location                 = New-Object System.Drawing.Point(20,59)
  71. $Label2.Font                     = 'Microsoft Sans Serif,12'
  72.  
  73. $ComboBox1                       = New-Object system.Windows.Forms.ComboBox
  74. $ComboBox1.width                 = 80
  75. $ComboBox1.height                = 20
  76. @('1','2','3','4','5') | ForEach-Object {[void] $ComboBox1.Items.Add($_)}
  77. $ComboBox1.location              = New-Object System.Drawing.Point(230,190)
  78. $ComboBox1.Font                  = 'Microsoft Sans Serif,12'
  79.  
  80. $Label3                          = New-Object system.Windows.Forms.Label
  81. $Label3.text                     = "Use first x characters:"
  82. $Label3.AutoSize                 = $true
  83. $Label3.width                    = 25
  84. $Label3.height                   = 10
  85. $Label3.location                 = New-Object System.Drawing.Point(60,193)
  86. $Label3.Font                     = 'Microsoft Sans Serif,12'
  87.  
  88. $Label4                          = New-Object system.Windows.Forms.Label
  89. $Label4.text                     = "or"
  90. $Label4.AutoSize                 = $true
  91. $Label4.width                    = 25
  92. $Label4.height                   = 10
  93. $Label4.location                 = New-Object System.Drawing.Point(188,160)
  94. $Label4.Font                     = 'Microsoft Sans Serif,12'
  95.  
  96. $TextBox3                        = New-Object system.Windows.Forms.TextBox
  97. $TextBox3.multiline              = $false
  98. $TextBox3.width                  = 80
  99. $TextBox3.height                 = 20
  100. $TextBox3.Text                   = ''
  101. $TextBox3.location               = New-Object System.Drawing.Point(230,130)
  102. $TextBox3.Font                   = 'Microsoft Sans Serif,12'
  103.  
  104. $TextBox4                        = New-Object system.Windows.Forms.TextBox
  105. $TextBox4.multiline              = $false
  106. $TextBox4.width                  = 80
  107. $TextBox4.height                 = 20
  108. $TextBox4.Text                   = 'txt'
  109. $TextBox4.location               = New-Object System.Drawing.Point(230,95)
  110. $TextBox4.Font                   = 'Microsoft Sans Serif,12'
  111.  
  112. $Label5                          = New-Object system.Windows.Forms.Label
  113. $Label5.text                     = "Separator (eg. -):"
  114. $Label5.AutoSize                 = $true
  115. $Label5.width                    = 25
  116. $Label5.height                   = 10
  117. $Label5.location                 = New-Object System.Drawing.Point(60,130)
  118. $Label5.Font                     = 'Microsoft Sans Serif,12'
  119.  
  120. $Label6                          = New-Object system.Windows.Forms.Label
  121. $Label6.text                     = "Extension (eg. pdf):"
  122. $Label6.AutoSize                 = $true
  123. $Label6.width                    = 25
  124. $Label6.height                   = 10
  125. $Label6.location                 = New-Object System.Drawing.Point(60,95)
  126. $Label6.Font                     = 'Microsoft Sans Serif,12'
  127.  
  128. $Button3                         = New-Object system.Windows.Forms.Button
  129. $Button3.text                    = "Go"
  130. $Button3.width                   = 60
  131. $Button3.height                  = 30
  132. $Button3.location                = New-Object System.Drawing.Point(165,240)
  133. $Button3.Font                    = 'Microsoft Sans Serif,12'
  134.  
  135. $Button4                         = New-Object system.Windows.Forms.Button
  136. $Button4.text                    = "Create 50 test files in Source"
  137. $Button4.width                   = 140
  138. $Button4.height                  = 50
  139. $Button4.location                = New-Object System.Drawing.Point(120,285)
  140. $Button4.Font                    = 'Microsoft Sans Serif,10'
  141. $Form.controls.AddRange(@($TextBox1,$TextBox2,$Button1,$Button2,$Label1,$Label2,$ComboBox1,$Label3,$Label4,$TextBox3,$Label5,$Button3,$Button4,$TextBox4,$Label6))
  142.  
  143. $Button1.Add_Click({
  144.   $TextBox1.Text = (FileBrowser)
  145. })
  146.  
  147. $Button2.Add_Click({
  148.   $TextBox2.Text = (FileBrowser)
  149. })
  150.  
  151. $Button3.Add_Click({
  152.   if (!(($TextBox1.Text -eq '') -and ($TextBox2.Text -eq ''))) {
  153.     $dest = $TextBox2.Text
  154.     $files = Get-ChildItem "$($TextBox1.Text)\*.$($TextBox4.Text)" -File
  155.  
  156.     for ($i = 0; $i -lt $files.Count; $i++) {
  157.       $folder = $null
  158.       if ($TextBox3.Text -eq '') {
  159.         $folder = (Split-Path -Leaf $files[$i]).Substring(0, $ComboBox1.SelectedItem).Trim()
  160.       } else {
  161.         $sep = (Split-Path -Leaf $files[$i]).IndexOf($TextBox3.Text)
  162.           switch ($sep) {
  163.             -1 {continue}
  164.             0  {$folder = (Split-Path -Leaf $files[$i]).Substring(0, 1).Trim()
  165.               break
  166.              }
  167.           default {$folder = (Split-Path -Leaf $files[$i]).Substring(0, $sep).Trim()}
  168.         }
  169.       }
  170.       if ($folder -ne $null) {
  171.         if (!(Test-Path "$($dest)\$($folder)")) {
  172.           New-Item -ItemType Directory "$($dest)\$($folder)"
  173.         }
  174.         Move-Item $files[$i] "$($dest)\$($folder)\$((Split-Path -Leaf $files[$i]))"
  175.       }
  176.     }
  177.   }
  178. })
  179.  
  180. $Button4.Add_Click({
  181.   if (!($TextBox1.Text -eq '')) {
  182. # Set the initial value to control the do loop
  183.     $seed = 0
  184. # How many files should be generated
  185.     $random = 50
  186. # File size in bytes
  187.     $ranSize = 4096
  188. # Path where the file will be created
  189.     $ranPath = "$($TextBox1.Text)\"
  190.     do {
  191.       $netFn = [System.IO.Path]::GetRandomFileName()
  192.       $netfn = [System.IO.Path]::ChangeExtension($netFn, $TextBox4.Text)
  193.       fsutil file createnew $ranPath$netFn $ranSize
  194.       $seed++
  195.     } until ($seed -eq $random)
  196.   }
  197. })
  198.  
  199. #endregion events }
  200.  
  201. #endregion GUI }
  202.  
  203. #Write your logic code here
  204.  
  205. [void]$Form.ShowDialog()
419
Living Room / Re: Android annoyances
« Last post by 4wd on October 11, 2019, 02:16 AM »
1) I very often accidentally switch on the Google Assistant, how do I completely disable or uninstall it? I don't find any value in using it and it has some very basic shortcuts that interfere too often.

Given that there are numerous phones with possibly multiple ways of invoking Assistant perhaps it might not have occurred to you that you telling us how you accidentally keep invoking it might help us to have relevant suggestions on how not to do it.

Like not holding your finger on the fingerprint sensor too long ...

hmmmm ...
420
Living Room / Re: Free call recorder for Android
« Last post by 4wd on September 17, 2019, 03:11 PM »
@Iainb: There's a few links on the web about it, Google apparently removed it as of Android 6 but manufacturers found ways around it.
With Android 9 they really locked it down to the point where if you want to do call recording then you're probably going to need root, (or alternative firmware, eg. Lineage, etc).

The problem was that different countries have different laws regarding call recording, (eg. UK only requires one of participating parties, Germany requires both parties to give permission), so they took the only reasonable option and disabled it.

NOTE: This is all w.r.t. stock Android.
421
Living Room / Re: Free call recorder for Android
« Last post by 4wd on September 15, 2019, 06:50 PM »
He's got a Moto G7 Power, they run, (for all intents), stock Android - in his case, v9.

I run an automatic call recorder on my Moto G5+, works fine however it's reviews are full of "doesn't record anything" because they're using it on phones running Android 9, (usually a Samsung 9 or 10 in the reviews).

Nothing stopping him from trying any and all of them ... just thought I'd mention that the underlying OS interface to do it no longer exists.
422
Living Room / Re: Free call recorder for Android
« Last post by 4wd on September 13, 2019, 09:36 PM »
The API required was completely removed in Android 9 and as Motorola is pretty much stock Android you're probably out of luck.
423
General Software Discussion / Re: What Android Apps Do You Use?
« Last post by 4wd on September 06, 2019, 06:35 AM »
NewPipe - free lightweight YouTube client.

NewPipe has been created with the purpose of getting the original YouTube experience on your smartphone without annoying ads and questionable permissions.

Aurora Droid

An alternative to the default F-Droid app with an intuitive UI and multiple great features, such as

  • Many repos listed and can be enabled
  • Beautiful design - Follows latest Material Design guidelines
  • Powerful download manager - Pause, resume and retry downloading apps
  • Previous releases - Enables downloading old releases
  • Lists architectures (arm, arm64 ...) and minimal Android versions
424
General Software Discussion / Re: Music player that can play 60 second previews
« Last post by 4wd on September 02, 2019, 02:46 AM »
Strange about MPlayer, I literally just downloaded, extracted, used the command on both video and audio files, and it worked.
425
Living Room / Re: Interesting "stuff"
« Last post by 4wd on August 30, 2019, 05:57 AM »
Can this grill-cleaning robot save you stress this summer?

Leave the grill in the Weber, let the bits get carbonised next time, run a wire brush over the grill, cook.

No stress, costs less than $2 every few years (for a new brush, use it for cleaning up welds too) ... all I've done for the last 30 years.
Pages: prev1 ... 12 13 14 15 16 [17] 18 19 20 21 22 ... 225next