topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Saturday June 21, 2025, 10:14 am
  • 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 ... 22 23 24 25 26 [27] 28 29 30 31 32 ... 225next
651
Post New Requests Here / Re: IDEA: Drag Drop renamer
« Last post by 4wd on November 05, 2018, 05:32 AM »
A couple of issues I have identified,, which I suspect is a function of how windows now seems to work.

On processing large numbers of files 100+ (each 10-20mb). I am unable to add further files till they are processed, as windows will not allow them to be selected.

Now you know it works, try this and see if it improves the time:

Code: Text [Select]
  1. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File "E:\Renamer\DnD-Rename.ps1" _Kingfisher

BTW, was this having it Copy or Move?
I find Move to be very quick since it's essentially just renaming the file, something like 3-4 seconds for ~200 files (~500MB) - it did it before I could select another load to drop on an icon, (and this is on my slow computer).

Having to create an icon... :)

 ;D

I just grab an image off Google, view in XNView, crop to 128x128, then save as an .ico - probably something that could be done using XNView's batch processing.
652
Post New Requests Here / Re: IDEA: Drag Drop renamer
« Last post by 4wd on November 04, 2018, 06:36 PM »
As best I can tell, I have done as stated but nothing appears to happen. Console window opens and closes, but that seems it. There does seem to be red writing at thee top of the console window, but not possible to read. Is there a way to make it persist?

Default ExecutionPolicy of Powershell is very restrictive and you'll get the following in red:

Code: Text [Select]
  1. .\DND-Rename.ps1 : File X:\DND-Rename.ps1 cannot be loaded. The file X:\DND-Rename.ps1 is not digitally signed. You
  2. cannot run this script on the current system. For more information about running scripts and setting execution policy,
  3. see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
  4. At line:1 char:1
  5. + .\DND-Rename.ps1
  6. + ~~~~~~~~~~~~~~~~
  7.     + CategoryInfo          : SecurityError: (:) [], PSSecurityException
  8.     + FullyQualifiedErrorId : UnauthorizedAccess

Usually if the script isn't written on the target machine or digitally signed then you'll get the above.

Try changing the shortcut Target to the following:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -NoExit -File "E:\Renamer\DnD-Rename.ps1" _Kingfisher

-ExecutionPolicy Bypass will tell Powershell to ignore all security settings and just run the script, (since it's rather simple this should be OK).
-NoExit will keep the console window open so you can read any errors.

If you use Powershell quite a bit and have profile scripts to customise the environment then you might want to add the -NoProfile switch to stop them affecting the above script, (not likely but who knows).

Addendum: I've added the -ExecutionPolicy Bypass parameter to the shortcuts - some people don't like running scripts with this, just remove it and then change your local machine ExecutionPolicy or digitally sign the script.
653
Post New Requests Here / Re: IDEA: Drag Drop renamer
« Last post by 4wd on November 03, 2018, 09:57 PM »
Not an All-in-One solution but just something simple in the meantime.

NOTE: I've attached the script, icons, and shortcuts in the archive - they will not work due to ExecutionPolicy and the paths I used unless they are edited.
They are there as an example.

--> Read post below about ExecutionPolicy <--

DND-Rename.ps1
Code: PowerShell [Select]
  1. # DND-Rename.ps1
  2. for ($i = 1; $i -lt $args.Count; $i++) {
  3.   Copy-Item $args[$i] ($args[$i] -replace "(\.[^.]+$)", "$($args[0])`$1")
  4. #  Move-Item $args[$i] ($args[$i] -replace "(\.[^.]+$)", "$($args[0])`$1")
  5. }

Tested on two Win 10 systems with Powershell 5 but there's nothing version specific.

Copy/Paste the above into a new Powershell file called DND-Rename.ps1 - when you've tested it works OK you can comment out the Copy-Item line and remove the comment (#) from the beginning of the Move-Item line.

Create a shortcut with a Target as follows:

Code: Text [Select]
  1. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\PoSh\DnD-Rename.ps1" _Kingfisher

Change the path to the Powershell script to wherever you've copied it.
The first argument after the script in the Target field is the text to append to the filename base, (eg. above it is _Kingfisher).

Change the icon for the shortcut to the image you want, see the images below.
Save the shortcut.
Rename it as you like, see the images.

Then just Drag'n'Drop some files onto your new shortcut.

eg.

Directory Opus Screenshot 2018-11-04.jpg

Directory Opus Screenshot 2018-11-04 (1).jpg

Keep a folder full of icons somewhere, create a folder full of shortcuts, and you have something that's reasonably equivalent until something better comes along ;)

If you don't want the console window that remains opens add -WindowStyle Hidden to the shortcut Target, eg.

Code: Text [Select]
  1. C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -File "C:\PoSh\DnD-Rename.ps1" _Kingfisher

PS: It doesn't matter what type of files you drop on the shortcuts as long as they have an extension.  All Drag'n'Drops are launched in separate threads, one for each DnD action, so if you do more than one they'll run concurrently.
654
Living Room / Re: Help with VPN Recommendation
« Last post by 4wd on November 01, 2018, 09:00 PM »
Windscribe have dedicated USA/UK Netflix exit gateways and you can usually pick up a Lifetime deal on StackSocial - $59 currently, has been better in the past, ($39).

I use Windscribe, they have been very good but I don't use the Netflix nodes so can't comment on them.

Another alternative if you only require a single VPN exit solution for the USA is to get a cheap VPS in the USA and run a VPN on it, (as low as $7 or $8 per year with current Halloween specials), single user from a single IP is unlikely to get blocked - it's how I've accessed UK stuff for the last few years.
655
Living Room / Re: Samsung SSD 860 EVO woes - workaround
« Last post by 4wd on October 30, 2018, 07:27 AM »
Same thing here a couple of months ago when I installed an 860 EVO 500GB.

Dropping back to Microsoft generic AHCI drivers is about the only solution.
656
Post New Requests Here / Re: IDEA: Automagic Digital Photo Manager
« Last post by 4wd on October 28, 2018, 07:34 PM »
Well, I took it over tonight; put it and the shortcuts in c:\utilities\dcimover, modified the relevant line with the absolute path, set up the relevant bits to autorun the shortcut on insertion, and I just got a Powershell window with nothing in it.

Forgot to mention, the shortcut needs to be in the same place as the script otherwise you need to add the full path to it in the shortcut Target field.

What OS are we looking at?

Some more experimentation later and I managed to start the GUI -- by running the script directly, I think -- but it threw some scary-looking errors when I hit the Move button.

Did you run it with ExecutionPolicy set to Bypass?

Because it was downloaded it will be marked by Windows as coming from another computer which can block it from running or lower it's access to a folder.

Run it with the following command from a PowerShell console:

Code: Text [Select]
  1. %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -sta -noprofile -executionpolicy bypass -File "DCIMover-GUI.ps1"

You can then copy/paste the error messages in the console.

Also, what version of PowerShell, do you know?
Next time you're there type $PSVersionTable in the PowerShell console which will give the version number, I don't think there's anything version specific in the script.

It did something -- the test pictures I'd put on the card disappeared -- but I couldn't work out what.

Well, it moved them somewhere otherwise they'd still be there ;)

The error messages will help a lot.

Now I'm away from it, it occurs to me to wonder if I'd just left a terminating backslash off the path, or included one when I shouldn't have, or something else obvious, but I probably won't be able to look for another week...

No terminating backslash required on the path.

You can't try it on your computer?

Thanks for giving it a go.
657
Post New Requests Here / Re: IDEA: Automagic Digital Photo Manager
« Last post by 4wd on October 27, 2018, 11:02 PM »
Just one quick question: if I wanted to modify this bit to a specific root destination folder (eg c:\users\fred\pictures\photos) would I just change this line

$objForm.SelectedPath = [System.Environment+SpecialFolder]'MyComputer'

or is it more complicated than that? (I really want to make it as simple as I can for him!)

If you want an absolute location change it to:
$objForm.SelectedPath = 'c:\users\fred\pictures\photos'

The [System.Environment+SpecialFolder] is due to My Computer being classed as a special folder, (like 'Documents', 'Pictures', etc).

I've just updated it using a different file properties function and added the ability to handle the following filetypes:
.jpg, .dng (Canon Raw), .mov, .mp4, .avi

For JPEG and DNG it'll use the Date Taken value, for the video files it'll use Date Created.

Easy enough to add other filetypes if you want something specific to a camera.

Also changed the month folder names to xx_ABC, eg. 05_May, so it lists the months in calendar order rather than alphabetical.

Added a progress bar, still can't interrupt it as it works but at least it shows it's doing something ... maybe.

Now to work out how runspaces work.

Updated
658
LaunchBar Commander / Re: One config for x86 and x64
« Last post by 4wd on October 26, 2018, 03:27 PM »
That's correct, be more versatile if that wasn't necessary though.

ie. No need to segregate x86 and x64 apps, one config will cover all cases.
659
Finished Programs / Re: DONE: Create Folder, Give It Name: Current Date and Time
« Last post by 4wd on October 25, 2018, 07:09 PM »
64 bit, Windows 10, PC:

"This file does not have an app associated with it for performing this action. (...etc)."
-Error Message

#metoo



Windows 10 is the problem, it happens across different configurations, different programs.
660
Finished Programs / Re: DONE: Create Folder, Give It Name: Current Date and Time
« Last post by 4wd on October 25, 2018, 04:34 PM »
You need to pass through the parameter given to the batch file when it's called.

On my phone atm but the batch receives the current folder in parameter %1, you need to pass it through to PowerShell.

At the start of the PoSh script you need:

Param (
  [string]$folder
)

$folder now contains the current path so you can put it after the -Path parameter in the New-Item cmdlet.
661
Finished Programs / Re: DONE: Create Folder, Give It Name: Current Date and Time
« Last post by 4wd on October 24, 2018, 07:34 PM »
I found it just stopped doing it for some reason, whether it was an update or something I installed who knows.
662
Tried re-enabling it through Windows Features, had a few reboots since, still doesn't work.

Tried re-enabling through PowerShell also.

Tbh, don't miss it that much for that device since it connects faster through FTP and I can use multiple credentials concurrently, (always had to clear them under Windows to access another account share on the device).
663
Finished Programs / Re: DONE: Create Folder, Give It Name: Current Date and Time
« Last post by 4wd on October 24, 2018, 04:01 AM »
More info, Desktop background or the background of a folder in File Explorer?

The image in my original post shows what I mean for the second.

Fwiw, I get that using the context menu for MediaInfo, sometimes it does it, most of the time it works.
664
LaunchBar Commander / Re: One config for x86 and x64
« Last post by 4wd on October 23, 2018, 07:07 PM »
@4wd Yes, you made it sound so simple. I assume you're looking at a solution internal to LBC, whereas I thought perhaps I'd missed some clever OS function. Either ways fine with me.

So expand %FunctionFiles% into C:\Program Files, check for presence of exe, if found execute, else expand to C:\Program Files (x86), check for presence of exe, if found execute, else quit.

It'd be simpler, (for the end user), to have mouser implement it in LBC, another alternative is to run an intermediate command/script that checks for the existence of an executable.

eg. .\TestX64.cmd \notepad++\notepad++.exe

TestX64.cmd would check Program Files and then Program Files (x86) prepending whichever was valid to the given parameter, eg. so for x64 system/app you'd end up with something like: %SYSTEMDRIVE%\Program Files\notepad++\notepad++.exe

I think whispering in mouser' ear is a nicer solution ;)
665
I can't think of anything that has been broken by Windows 10 updates on my machine.

I can, SAMBA v1 has been disabled by default after Windows 10 updates. 

Now I have to access my 4TB NAS, (no updates available), via FTP because re-enabling it didn't work on my computer.

Only reason I found out why it no longer worked was because DOpus opened a window telling me why along with a link to Microsoft Knowledge Base ... File Explorer just failed silently, (or spun its wheels), after a few minutes twiddling its thumbs ... nice.
666
LaunchBar Commander / Re: One config for x86 and x64
« Last post by 4wd on October 23, 2018, 06:20 PM »
A truth table of my atempt to unify LBC configs on both 32 bit and 64 bit OS using the %ProgramFiles% replacment

32bit OS      x86 app     OK       
32bit OS      x64 app      -
64bit OS      x86 app     OK
64bit OS      x64 app     fails

So basically test for an executable under \Program Files first with fallback to an executable under \Program Files (x86) if not found in \Program Files.
667
Post New Requests Here / Re: IDEA: Automagic Digital Photo Manager
« Last post by 4wd on October 23, 2018, 05:36 PM »
Something simple in PowerShell while skwire whips up a masterpiece :P : DCIMover.ps1

Updated version:
  • Lists all removable drives that have a DCIM folder,
  • Saves the destination folder when you click Start,
  • Defaults to Copy,
  • Creates destination folders as per Year\Month, eg. 2017\03_Mar,
  • Will not overwrite any existing file,
  • Works on JPEG, DNG, AVI, MOV, MP4 files, (uses Date Created for video formats),
  • Can easily add more image/video formats, (just edit the .ini file),
  • Will open your default file manager at the last folder created, (works for DOpus, File Explorer), for both images and videos (if it's the same folder then normally the already open file manager window is brought to the front),
  • Multi-threaded so the GUI doesn't become unresponsive,
  • Progressbar updates as it goes and a window shows the current operation and any errors,
  • Can cancel the operation by just closing the GUI, (might implement a Stop button later),
  • Sets the creation date of the destination file to the Date Taken of the image, (or Date Created if it's video),
  • You can set the initial folder to select a destination folder in the .ini file,
  • Interface controls are disabled while it's running, (so you don't go swapping between Copy/Move),
  • If any errors occurred the log file will be opened at the end of the operation.

There's a small video, (1:16), in the archive that shows it working, (original files shown on the left, folder tree being created with files on the right).

It requires Powershell v3+, (TBH I'm not sure what minimum version is required for some cmdlets - I can only test against v5).

Installation:

Extract the archive and copy the contents somewhere.
If you need to move the shortcut somewhere else, open the properties of the shortcut and edit the Target field to include the path to the script.

Edit the DCIMover.ini file for some basic preferences.

DCIMover.ini
Code: Text [Select]
  1. [General]
  2. dest=K:\a_folder\test place
  3. initfolder=c:\users\fred\pictures\photos
  4. images=.dng,.jpg
  5. videos=.3gp,.avi,.mov,.mp4

  • dest - The last destination folder used, saved whenever the Start button is pressed.
  • initfolder - The "top level" folder used for the folder browser when selecting a destination, if it doesn't exist the folder browser will default to My Computer.
  • images - The extensions of image files, comma separated.  These are files that contain Date Taken metadata so can include any other file type that has that data, (eg. maybe some video formats)
  • videos - The extensions of video files, comma separated.  The Date Created metadata will be used for these file types.

Running:

  • Run it from the shortcut, a Powershell console will open for a second then close, the script GUI will then open.
  • Select your source drive from the drop-down list, (any removable drive with a folder named DCIM in the root will be in the list).
  • Select your destination folder, the files will be copied here in the appropriate year\month sub-folders.
  • Select Copy or Move, (I suggest Copy until you're are sure it's working correctly).
  • Hit Start.

DCIMover.png

Code: PowerShell [Select]
  1. $Global:SyncHash = [hashtable]::Synchronized(@{})
  2. $newRunspace =[runspacefactory]::CreateRunspace()
  3. $newRunspace.ApartmentState = "STA"
  4. $newRunspace.ThreadOptions = "ReuseThread"
  5. $newRunspace.Open()
  6. $newRunspace.SessionStateProxy.SetVariable("SyncHash",$SyncHash)
  7.  
  8. # Load WPF assembly if necessary
  9. [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
  10.  
  11. $psCmd = [PowerShell]::Create().AddScript({
  12.   [xml]$xaml = @"
  13. <Window x:Class="DCIMover.MainWindow"
  14.        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  15.        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  16.        Title="DCIMover" Height="350" Width="522" ResizeMode="CanMinimize">
  17.    <Grid>
  18.        <TextBox x:Name="TextBox1" HorizontalAlignment="Left" Height="23" Margin="102,72,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="325" ToolTip="Destination folder for photos/videos"/>
  19.        <Label x:Name="Label1" Content="Destination" HorizontalAlignment="Left" Margin="25,66,0,0" VerticalAlignment="Top" Width="72"/>
  20.        <Button x:Name="Button1" Content="..." HorizontalAlignment="Left" Margin="460,72,0,0" VerticalAlignment="Top" Width="32" ToolTip="Select destination folder"/>
  21.        <Label x:Name="Label2" Content="Source" HorizontalAlignment="Left" Margin="25,21,0,0" VerticalAlignment="Top"/>
  22.        <ComboBox x:Name="ComboBox1" HorizontalAlignment="Left" Margin="102,25,0,0" VerticalAlignment="Top" Width="62" ToolTip="Select source card from list"/>
  23.        <ProgressBar x:Name="ProgressBar1" HorizontalAlignment="Left" Height="26" Margin="25,118,0,0" VerticalAlignment="Top" Width="467" IsTabStop="False"/>
  24.        <TextBox x:Name="TextBox2" HorizontalAlignment="Left" Height="136" Margin="25,164,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="467" ToolTip="Status messages" AllowDrop="False" Focusable="False" IsTabStop="False" VerticalScrollBarVisibility="Auto" IsUndoEnabled="False" IsReadOnly="True" HorizontalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True"/>
  25.        <Button x:Name="Button2" Content="Start" HorizontalAlignment="Left" Margin="417,25,0,0" VerticalAlignment="Top" Width="75"/>
  26.        <RadioButton x:Name="RadioButton1" Content="Copy" HorizontalAlignment="Left" Margin="331,19,0,0" VerticalAlignment="Top" IsChecked="True" ToolTip="Copy files from card"/>
  27.        <RadioButton x:Name="RadioButton2" Content="Move" HorizontalAlignment="Left" Margin="331,39,0,0" VerticalAlignment="Top" ToolTip="Move files from card"/>
  28.  
  29.    </Grid>
  30. </Window>
  31. "@
  32.  
  33.   # Remove XML attributes that break a couple things.
  34.   #   Without this, you must manually remove the attributes
  35.   #   after pasting from Visual Studio. If more attributes
  36.   #   need to be removed automatically, add them below.
  37.   $AttributesToRemove = @(
  38.     'x:Class',
  39.     'mc:Ignorable'
  40.   )
  41.  
  42.   Foreach ($Attrib in $AttributesToRemove) {
  43.     if ($xaml.Window.GetAttribute($Attrib)) {
  44.       $xaml.Window.RemoveAttribute($Attrib)
  45.     }
  46.   }
  47.    
  48.   $reader = (New-Object System.Xml.XmlNodeReader $xaml)
  49.    
  50.   $SyncHash.Window = [Windows.Markup.XamlReader]::Load( $reader )
  51.  
  52.   [xml]$XAML = $xaml
  53.   $xaml.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]") | %{
  54.   #Find all of the form types and add them as members to the synchash
  55.     $SyncHash.Add($_.Name, $SyncHash.Window.FindName($_.Name) )
  56.   }
  57.  
  58.   $Script:JobCleanup = [hashtable]::Synchronized(@{})
  59.   $Script:Jobs = [system.collections.arraylist]::Synchronized((New-Object System.Collections.ArrayList))
  60.  
  61.   #region Background runspace to clean up jobs
  62.   $jobCleanup.Flag = $True
  63.   $newRunspace = [runspacefactory]::CreateRunspace()
  64.   $newRunspace.ApartmentState = "STA"
  65.   $newRunspace.ThreadOptions = "ReuseThread"          
  66.   $newRunspace.Open()        
  67.   $newRunspace.SessionStateProxy.SetVariable("jobCleanup", $jobCleanup)    
  68.   $newRunspace.SessionStateProxy.SetVariable("jobs", $jobs)
  69.   $jobCleanup.PowerShell = [PowerShell]::Create().AddScript({
  70.   #Routine to handle completed runspaces
  71.     Do {    
  72.       Foreach($runspace in $jobs) {            
  73.         If ($runspace.Runspace.isCompleted) {
  74.           [void]$runspace.powershell.EndInvoke($runspace.Runspace)
  75.           $runspace.powershell.dispose()
  76.           $runspace.Runspace = $null
  77.           $runspace.powershell = $null              
  78.         }
  79.       }
  80.   #Clean out unused runspace jobs
  81.       $temphash = $jobs.clone()
  82.       $temphash | Where {$_.runspace -eq $Null} | ForEach {$jobs.remove($_)}        
  83.       Start-Sleep -Seconds 1    
  84.     } while ($jobCleanup.Flag)
  85.   })
  86.   $jobCleanup.PowerShell.Runspace = $newRunspace
  87.   $jobCleanup.Thread = $jobCleanup.PowerShell.BeginInvoke()  
  88.   #endregion Background runspace to clean up jobs
  89.  
  90.  
  91.   $SyncHash.Button1.Add_Click({
  92.     $objShell = new-object -com shell.application
  93.     # Special Folders: https://docs.microsoft.com/en-us/windows/desktop/api/shldisp/ne-shldisp-shellspecialfolderconstants
  94.     # eg. Pictures = 0x27
  95.     $objFolder = $objShell.BrowseForFolder(0, "Select destination folder", 0x00000074, $SyncHash.InitFolder)
  96.     if ($objfolder.self.path -ne $null) {
  97.       $SyncHash.TextBox1.Text = $objfolder.self.path
  98.     }
  99.   })
  100.  
  101.   $SyncHash.Button2.Add_Click({
  102. # Start-Job -Name Sleeping -ScriptBlock {start-sleep 5}
  103. # while ((Get-Job Sleeping).State -eq 'Running'){
  104. # region Boe's Additions
  105.     $newRunspace =[runspacefactory]::CreateRunspace()
  106.     $newRunspace.ApartmentState = "STA"
  107.     $newRunspace.ThreadOptions = "ReuseThread"          
  108.     $newRunspace.Open()
  109.     $newRunspace.SessionStateProxy.SetVariable("SyncHash", $SyncHash)
  110.     $PowerShell = [PowerShell]::Create().AddScript({
  111.       Function Update-Window {
  112.         Param (
  113.           $Control,
  114.           $Property,
  115.           $Value,
  116.           [switch]$AppendContent
  117.         )
  118. # This is kind of a hack, there may be a better way to do this
  119.         If ($Property -eq "Close") {
  120.           $SyncHash.Window.Dispatcher.invoke([action]{$SyncHash.Window.Close()}, "Normal")
  121.           Return
  122.         }
  123. # This updates the control based on the parameters passed to the function
  124.         $SyncHash.$Control.Dispatcher.Invoke([action]{
  125. # This bit is only really meaningful for the TextBox control, which might be useful for logging progress steps
  126.           If ($PSBoundParameters['AppendContent']) {
  127.             $SyncHash.$Control.AppendText($Value)
  128.           } Else {
  129.             $SyncHash.$Control.$Property = $Value
  130.           }
  131.         }, "Normal")
  132.       }
  133.  
  134.       Function Get-MetaData {
  135.         Param (
  136.           [PARAMETER(Mandatory=$true)]
  137.           [string]$path = '',
  138. #          [PARAMETER( Mandatory = $true, HelpMessage = 'extension eg. .mp3, .txt or .mov')]
  139.           [boolean]$images,
  140. #          [string]$type = '', # 'mp3'
  141.           [switch]$recurse
  142.         )
  143.  
  144.         if ($images) {
  145.           $types = $SyncHash.imageTypes
  146.         } else {
  147.           $types = $SyncHash.videoTypes
  148.         }
  149.  
  150.         $path += 'DCIM'
  151.         if ($recurse) {
  152.           $LPath = Get-ChildItem -Path $path -Directory -Recurse
  153.         } else {
  154.           $LPath = $path
  155.         }
  156.  
  157. #        $DirectoryCount = 1
  158.         $RetrievedMetadata = $true
  159.         $OutputList = New-Object 'System.Collections.generic.List[psobject]'
  160.  
  161.         Foreach ($pa in $LPath) {
  162.           $shell = New-Object -ComObject shell.application
  163.  
  164.           if ($recurse) {
  165.             $objshell = $shell.NameSpace($pa.FullName)
  166.           } else {
  167.             $objshell = $shell.NameSpace($pa)
  168.           }
  169.           # Build data list
  170.           $count = 0
  171.  
  172.           # Filter on filetype
  173.           for ($i = 0; $i -lt $types.Count; $i++) {
  174.             $filter = $null
  175.             Update-Window -Control ProgressBar1 -Property Value -Value 0
  176.             Start-Sleep -Milliseconds 500
  177.             $filter = $objshell.Items() | where {$_.Name -match $types[$i]}
  178.             Write-Message  "Collecting Metadata for '$($types[$i])' files ..."
  179. <#
  180. $filter.Count > 0 if more than one matching file
  181. $filter.Count = 0 if no matching files
  182. $filter.Count = $null if one matching file
  183. #>
  184.             Foreach ($file in $filter) {
  185.               if ($RetrievedMetadata) {
  186. # Build metanumbers
  187.                 $Metanumbers = New-Object -TypeName 'System.Collections.Generic.List[int]'
  188.                 for ($a = 0; $a -le 400; $a++) {
  189.                   if ($objshell.GetDetailsOf($file, $a)) {
  190.                     $Metanumbers.Add([int]$a)
  191.                   }    
  192.                 }
  193.                 $RetrievedMetadata = $false
  194.               }
  195.  
  196.               $count++
  197.               $CurrentDirectory = Get-ChildItem -Path $file.path
  198.  
  199.               if ($filter.Count -gt 0) {
  200.                 try {
  201.                   Update-Window -Control ProgressBar1 -Property Value -Value ([math]::Round((($count / $filter.count) * 100)))
  202.                 } catch {}
  203.               } else {
  204.                 try {
  205.                   Update-Window -Control ProgressBar1 -Property Value -Value 100
  206.                 } catch {}
  207.               }
  208.                
  209. # Build Hashtable for each file
  210.               $hash = $null
  211.               $Hash = @{}
  212.               foreach ($nr in $Metanumbers) {
  213.                 $PropertyName = $($objshell.GetDetailsOf($objshell.Items, $nr))
  214.                 $PropertyValue = $($objshell.GetDetailsOf($File, $nr))
  215.                 $Hash[$PropertyName] = $PropertyValue
  216.               }
  217.            
  218.               $Hash.Remove("")
  219.               $FileMetaData = New-Object -TypeName PSobject -Property $hash
  220.               $OutputList.Add($FileMetaData)
  221.             }
  222.           }
  223.         }
  224.         Process-OutputList $OutputList $images
  225.       }
  226.  
  227.       Function Process-OutputList {
  228.         Param (
  229.           [object]$files,
  230.           [string]$images
  231.         )
  232.  
  233.         $dest = $SyncHash.Window.Dispatcher.invoke([System.Func[String]] {$SyncHash.TextBox1.Text})
  234.  
  235.         if ($files.Count -eq $null) {
  236.           Write-Message  "Copy/Move one file ..."
  237.           switch ($images) {
  238.             $true { $takenDate = [datetime]((Select-Object -InputObject $files[$j] -ExpandProperty 'Date Taken') -replace '[^\d:/ -_.,]', '') }
  239.             $false { $takenDate = [datetime](Select-Object -InputObject $files[$j] -ExpandProperty 'Date Created') }
  240.           }
  241.           if ($takenDate -ne $null) {
  242.             $outPath = ($dest + '\' + $takenDate.Year + '\' + ($takenDate.Month).ToString('00') + '_' + ((Get-Culture).DateTimeFormat.GetAbbreviatedMonthName($takenDate.Month)) + '\' + $files.Name) -replace '\\', '\'
  243.             Move-File $files.'Path' $outPath $takenDate
  244.             Update-Window -Control ProgressBar1 -Property Value -Value 100
  245.           } else {
  246.             Write-Message "[Warn]: $($files.Name): Date Taken not found, Copy/Move not performed" $true
  247.           }
  248.         } else {
  249.           if ($files.Count -gt 0) {
  250.             Write-Message  "Copy/Move $($files.Count) files ..."
  251.             for ($j = 0; $j -lt $files.Count; $j++) {
  252.               $outPath = $null
  253.               $takenDate = $null
  254.                 switch ($images) {
  255.                   $true {
  256.                       if (((Select-Object -InputObject $files[$j] -ExpandProperty 'Date Taken')).Length -gt 1 ) {
  257.                         $takenDate = [datetime]((Select-Object -InputObject $files[$j] -ExpandProperty 'Date Taken') -replace '[^\d:/ -_.,]', '')
  258.                       } else {
  259.                         Write-Message "[Warn]: $($files[$j].'Name'): Date Taken not found, Copy/Move not performed" $true
  260.                       }
  261.                     }
  262.                   $false {
  263.                       $takenDate = [datetime](Select-Object -InputObject $files[$j] -ExpandProperty 'Date Created')
  264.                     }
  265.                 }
  266.               if ($takenDate -ne $null) {
  267.                 $outPath = ($dest + '\' + $takenDate.Year + '\' + ($takenDate.Month).ToString('00') + '_' + ((Get-Culture).DateTimeFormat.GetAbbreviatedMonthName($takenDate.Month)) + '\' + $files[$j].'Name') -replace '\\', '\'
  268.                 Move-File $files[$j].'Path' $outPath $takenDate
  269.               }
  270.               Update-Window -Control ProgressBar1 -Property Value -Value ([math]::Round((($j + 1) / $files.Count) * 100))
  271.             }
  272.           } else {
  273.             Write-Message  "No matching files found ..."
  274.           }
  275.         }
  276.         Invoke-Item (Split-Path -Path $outPath)
  277.       }
  278.  
  279.       Function Move-File {
  280.         param (
  281.           [string]$source,
  282.           [string]$dest,
  283.           [datetime]$date
  284.         )
  285.         if (!(Test-Path -Path (Split-Path -Path $dest))) {
  286.           New-Item (Split-Path -Path $dest) -ItemType Directory
  287.           if (!$?) {
  288.             Write-Message "[Error] Failed to create folder: $(Split-Path -Path $dest)" $true
  289.           }
  290.         }
  291.  
  292.         if (!(Test-Path $dest)) {
  293.           if ($SyncHash.Window.Dispatcher.invoke([System.Func[string]] {$SyncHash.RadioButton1.IsChecked}) -eq 'True') {
  294.             Copy-Item $source $dest
  295.             if (!$?) {
  296.               Write-Message "[Error] $(Split-Path $source -Leaf): Copy failed" $true
  297.             }
  298.           } else {
  299.             Move-Item $source $dest
  300.             if (!$?) {
  301.               Write-Message "[Error] $(Split-Path $source -Leaf): Move failed" $true
  302.             }
  303.           }
  304.           Set-ItemProperty -Path $dest -Name CreationTime -Value $date
  305.         } else {
  306.           Write-Message "[Warn] $(Split-Path $source -Leaf): Exists in destination" $true
  307.         }
  308.       }
  309.  
  310.       Function Write-Message {
  311.         Param (
  312.           [string]$message,
  313.           [boolean]$err = $false
  314.         )
  315.         Update-Window -Control TextBox2 -Property Text -Value "$($message)`r`n" -Append
  316.         if ($err) {
  317.           $SyncHash.hadError = $true
  318.           $message | Out-File -FilePath $SyncHash.LogFile -Append
  319.         }
  320.       }
  321.  
  322. # Button2 Main
  323.       $srceFol = $SyncHash.Window.Dispatcher.invoke([System.Func[String]] {$SyncHash.ComboBox1.SelectedItem})
  324.       $destFol = $SyncHash.Window.Dispatcher.invoke([System.Func[String]] {$SyncHash.TextBox1.Text})
  325.       $SyncHash.hadError = $false
  326.  
  327.       if (($destFol -ne $null) -and ($destFol -ne '')) {
  328.         if (($srceFol -ne $null) -and ($srceFol -ne '')) {
  329.           $ini = "[General]`r`ndest=$($destFol)`r`ninitfolder=$($SyncHash.InitFolder)`r`nimages=$($SyncHash.h.Get_Item('images'))`r`nvideos=$($SyncHash.h.Get_Item('videos'))"
  330.           Out-File -FilePath $SyncHash.iniFile -InputObject $ini
  331.           $SyncHash.LogFile = ("$($env:TEMP)\$(Get-Date -Format 'yyyyMMdd_HHmmss').txt").Replace('\\', '\')
  332.           Update-Window -Control Button2 -Property IsEnabled -Value $false
  333.           Update-Window -Control RadioButton1 -Property IsEnabled -Value $false
  334.           Update-Window -Control RadioButton2 -Property IsEnabled -Value $false
  335.           Update-Window -Control TextBox1 -Property IsEnabled -Value $false
  336.           Update-Window -Control ComboBox1 -Property IsEnabled -Value $false
  337.           Update-Window -Control Button1 -Property IsEnabled -Value $false
  338.           $SyncHash.hadError = $false
  339.           Update-Window -Control TextBox2 -Property Text -Value ''
  340.           Write-Message "---- START ----`r`nLogfile: $($SyncHash.LogFile)`r`nProcessing image files ..."
  341.           Get-MetaData -Path $srceFol $true -Recurse
  342.           Write-Message "Finished image files`r`nProcessing video files ..."
  343.           Get-MetaData -Path $srceFol $false -Recurse
  344.           Write-Message  "Finished video files`r`n---- END ----"
  345.           Update-Window -Control RadioButton1 -Property IsEnabled -Value $true
  346.           Update-Window -Control RadioButton2 -Property IsEnabled -Value $true
  347.           Update-Window -Control TextBox1 -Property IsEnabled -Value $true
  348.           Update-Window -Control ComboBox1 -Property IsEnabled -Value $true
  349.           Update-Window -Control Button1 -Property IsEnabled -Value $true
  350.           Update-Window -Control Button2 -Property IsEnabled -Value $true
  351.           if ($SyncHash.hadError) {
  352.             "--- SAVE THIS FILE ---`r`n" + (Get-Content $SyncHash.LogFile -Raw) | Set-Content $SyncHash.LogFile
  353.             Write-Message  "*** There were errors, refer to log file ***"
  354.             Invoke-Item $SyncHash.LogFile
  355.           }
  356.         }
  357.       }
  358. # End Button2 Main
  359.  
  360.     })
  361.     $PowerShell.Runspace = $newRunspace
  362.     [void]$Jobs.Add((
  363.     [pscustomobject]@{
  364.       PowerShell = $PowerShell
  365.       Runspace = $PowerShell.BeginInvoke()
  366.     }
  367.     ))
  368.   })
  369.  
  370.     #region Window Close
  371.     $SyncHash.Window.Add_Closed({
  372.       Write-Verbose 'Halt runspace cleanup job processing'
  373.       $jobCleanup.Flag = $False
  374.  
  375.       #Stop all runspaces
  376.       $jobCleanup.PowerShell.Dispose()      
  377.     })
  378.     #endregion Window Close
  379.     #endregion Boe's Additions
  380.  
  381.  
  382. # GUI Main + Functions
  383.   Function Add-Drives {
  384.     $usb = ([System.IO.DriveInfo]::GetDrives() | Where DriveType -match 'Removable')
  385.     for ($i = 0; $i -lt $usb.Count; $i++) {
  386.       $dcimFol = ($usb[$i].Name) + 'DCIM'
  387.       if (Test-Path -Path $dcimFol) {
  388.         [void] $SyncHash.ComboBox1.Items.Add($usb[$i])
  389.       }
  390.     }
  391.   }
  392.  
  393.   Function Read-Ini {
  394.     if (Test-Path -Path $SyncHash.iniFile) {
  395.       Get-Content $SyncHash.iniFile | foreach-object -begin {$SyncHash.h=@{}} -process { $k = [regex]::split($_,'='); `
  396.         if (($k[0].CompareTo("") -ne 0) -and ($k[0].StartsWith("[") -ne $True)) { $SyncHash.h.Add($k[0], $k[1]) } }
  397.       $SyncHash.TextBox1.Text = $SyncHash.h.Get_Item('dest')
  398.       $SyncHash.InitFolder = $SyncHash.h.Get_Item('initfolder')
  399.       $SyncHash.imageTypes = ($SyncHash.h.Get_Item('images')).Split(',')
  400.       $SyncHash.videoTypes = ($SyncHash.h.Get_Item('videos')).Split(',')
  401.     }
  402.   }
  403.  
  404.   if ($PSVersionTable.PSVersion.Major -lt 3) {
  405.     [System.Windows.MessageBox]::Show("This script requires Powershell v3+`r`n`r`nClick OK to exit")
  406.     Exit
  407.   }
  408.   $SyncHash.iniFile = '.\DCIMover.ini'
  409.   Read-Ini
  410.   Add-Drives
  411. # End GUI Main + Functions
  412.  
  413.  
  414.   $SyncHash.Window.ShowDialog() | Out-Null
  415.   $SyncHash.Error = $Error
  416. })
  417. $psCmd.Runspace = $newRunspace
  418. $data = $psCmd.BeginInvoke()

Other things I might look at doing:
  • If Date Taken doesn't exist, default to Date Created, (usually happens with photos that are manipulated in the phone/camera, eg. panoramas).
  • For video files look for Media Created first before using Date Created, (one problem is Media Created uses UTC as defined by the camera setting, which can be different from Date Created).
  • Find some way of outputting Powershell errors, (the red ones), to a log file.
668
LaunchBar Commander / Re: One config for x86 and x64
« Last post by 4wd on October 22, 2018, 05:03 PM »
Regarding running programs via a script/batch file, an alternative would be to run LBC via batch/script that checks the architecture of the OS and sets an environment variable with the appropriate path for the architecture.

Then preface those executables that can be either 32 or 64 bit with that variable rather than %programfiles%.
669
Finished Programs / Re: DONE: Create Folder, Give It Name: Current Date and Time
« Last post by 4wd on October 18, 2018, 01:50 AM »
It actually doesn't need the following parameters -sta -ExecutionPolicy Bypass -NoProfile but it won't do any harm to leave them.

I was just being lazy and didn't remove them when I modified another file  :)
670
General Software Discussion / Re: What Android Apps Do You Use?
« Last post by 4wd on October 17, 2018, 11:00 PM »
Should have mentioned, it does have ads but the developer allows you to turn them off, however a large card/banner will remain in the Settings area unless you donate, (doesn't interfere with operation and there are no Donation-only settings, everything works).

He also has another app along the same lines called Servicely - it requires root access.  Naptime doesn't but will use it for enhancements if it's available.
671
Finished Programs / Re: DONE: Create Folder, Give It Name: Current Date and Time
« Last post by 4wd on October 17, 2018, 10:06 PM »
Double-click on the Create Date-Time Folder - Install.reg file and answer Yes to let it merge with the registry.

It'll create a menu item called Create Date-Time Folder in the context menu of folders only, ie. you need to right-click on a folder to use it.

Create Date-Time Folder - Install.reg
Code: Text [Select]
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_CLASSES_ROOT\Folder\shell\Create Date-Time Folder\command]
  4. @="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -sta -ExecutionPolicy Bypass -NoProfile -Command \"New-Item -ItemType Directory -Path '%1' -Name ((Get-Date).tostring('yyyy-MM-dd hh-mm-ss'))\""

If you don't want the output window that opens you can add | Out-Null after the two close brackets, ie. )) | Out-Null \""


And to remove it, double-click on the other file and answer Yes to merge it.

Create Date-Time Folder - Remove.reg
Code: Text [Select]
  1. Windows Registry Editor Version 5.00
  2.  
  3. [-HKEY_CLASSES_ROOT\Folder\shell\Create Date-Time Folder]


ADDENDUM: Added two more .reg files, these are to Install/Remove the context menu item for when you right-click on the background from within a folder, (ie. you don't need to right-click on a folder).

Windows Registry Editor Version 5.00

Code: Text [Select]
  1. [HKEY_CLASSES_ROOT\Directory\Background\shell\Create Date-Time Folder\command]
  2. @="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -sta -ExecutionPolicy Bypass -NoProfile -Command \"New-Item -ItemType Directory -Path '%1' -Name ((Get-Date).tostring('yyyy-MM-dd hh-mm-ss'))\""

Code: Text [Select]
  1. Windows Registry Editor Version 5.00
  2.  
  3. [-HKEY_CLASSES_ROOT\Directory\Background\shell\Create Date-Time Folder]

2018-10-18 14_51_06-K__.png
672
Very impertinent thread by kalos: https://www.donation...ex.php?topic=45945.0 considering that his problem over there is more or less explained here, whilst he pretends this thread doesn't exist.

Not really, it's been proven that people very rarely bother to use a forum search engine prior to just firing off a new thread.

Plus the search engine here is pretty basic, (probably with most forums), it's usually better to use Google ... of course that doesn't help if you're not, shall we say, proficient in reducing your search terms to the relevant.

Look Ahead/Behind is what I used in my last few posts of that thread.
673
General Software Discussion / Re: What Android Apps Do You Use?
« Last post by 4wd on October 17, 2018, 06:22 AM »
Naptime - An aggressive Doze Service, has basically doubled my battery time from 24-30 hours to 2+ days, (dependent on activity naturally - I have a lot of screen off time).
674
General Software Discussion / Re: Anyone using Blackbird?
« Last post by 4wd 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.
675
General Software Discussion / Re: Anyone using Blackbird?
« Last post by 4wd 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.
Pages: prev1 ... 22 23 24 25 26 [27] 28 29 30 31 32 ... 225next