for quite some time I've been wanting a method to have more desktops in windows11, one for each context I need, but it seems there is no official way
For now I just associate the files of a context to the relative folder, and then move them in and out of desktop
I've come to realize that i REALLY like for all files to be in the exact position I left them. It helps a lot with getting in the flux.
What I wanted was the following 2 scripts:
desktop_position_get: name -> position
desktop_position_set: name, position -> X
After some tweak, this is the getter script I came up with the help of GPT4:
$desktopPath = [Environment]::GetFolderPath("Desktop")
$itemName = "target_file.ext"
$shell = New-Object -ComObject "Shell.Application"
$desktopFolder = $shell.Namespace($desktopPath)
$desktopItems = $desktopFolder.Items()
$itemIndex = $desktopItems | Get-Member -MemberType Properties | Where-Object { $_.Name -eq "Name" } | Select-Object -ExpandProperty Definition | Select-String -Pattern "$itemName" | Select-Object -ExpandProperty LineNumber
if ($itemIndex) {
$item = $desktopItems.Item($itemIndex - 1)
$position = $desktopFolder.GetDetailsOf($item, 31)
$col = [int]$position
Write-Host "$col"
}
else {
Write-Host "-1"
}
It never seems to work, though. I've googled for a solution on multiple occasions, but I couldn't find what I needed. Does anyone know how to fix this?