Anyone Have Script Ideas/Requests?

812 views
Skip to first unread message

Kyle Condon

unread,
Oct 5, 2023, 1:38:23 PM10/5/23
to OneCommander
I'm looking to expand my OC script repository with new scripts. Is there anything people would like to automate from OC's script menu that uses selected files, or current/opposite directories?

Repository is located here:

Thanks!
Message has been deleted

Tim Morton

unread,
Oct 6, 2023, 9:34:27 AM10/6/23
to OneCommander
Thanks for sharing your scripts @Kyle 

I especially liked your install script, which made it super-easy to get started with scripts in OC.  I have to confess that I hadn't really seen the potential of these until your post caught my eye and I decided to give them a try.

Kind regards
Tim

Kyle Condon

unread,
Oct 6, 2023, 2:27:32 PM10/6/23
to OneCommander
@Simon After looking at the Api and running a test script I think that's doable. Would you be looking for just the filenames, the whole file path, or the filename + extension? Also, I'm hesitant to use my own Dev Api Key to send the message to the Api as it would expose it to everyone. Do you have one that I could prompt for to use for yourself?

@Tim No Problem. I'm glad you found them useful. If you think of any ideas for scripts let me know. I will be adding an Update script soon as well that will not duplicate a couple things so run that when you want to update next time. :)

Message has been deleted

Kyle Condon

unread,
Oct 6, 2023, 5:53:10 PM10/6/23
to OneCommander
@Simon  Okay I have made the script, and it is working. Just pushed it to the repository. Just an fyi until I make the Update script running Install.ps1 will make a duplicate entry in your PowerShell profile which you will need to delete manually.
Message has been deleted

Kyle Condon

unread,
Oct 12, 2023, 7:13:07 AM10/12/23
to OneCommander
Yes, you can post those issues here or on the repo issues page. And a script to append the date shouldn't be too hard to make. I'll try to get that finished by the end of the weekend. 

On Thursday, October 12, 2023 at 5:48:41 AM UTC-5 Simon Durkee wrote:
Hi Kyle,

I found a few issues with the ***Send to PasteBin*** script, which I will post in the next few days.

Meanwhile, can you whip up a script to automatically append the date to the end of the selected file/folder?
Example: Filename.txt -> Filename-2023-10-12.txt
I use the foumart YYYY-MM-DD so it sorts correctly in all scenarios.

Many thanks!

Jarosław Pietras

unread,
Oct 12, 2023, 1:59:59 PM10/12/23
to OneCommander
Could you create a script that calculates the MD5 of the selected file? I miss this in the program and it would be useful.

OneCommander Support

unread,
Oct 12, 2023, 11:00:41 PM10/12/23
to OneCommander
Thank you for doing all this!

@ spdu...@gmail.com
If you F2 to rename a file, you can use the dropdown with suggestions and one of them is adding yyyy-MM-dd to the end
if you want to skip the step of clicking the dropdown arrow, you can make suggestion popup show automatically
Settings<Other>Show rename suggestions popup

Kyle Condon

unread,
Oct 13, 2023, 2:45:45 AM10/13/23
to OneCommander
@Milos No Problem, I use a lot of these myself, and it's good practice coding, so a win win for sure.

@Jaroslaw Yes, I can, though if you are looking for a possible faster solution, installing 7zip will add a context menu option to calculate multiple types of hashes, md5 included. Would you want a GUI involved to display the results in a text box to copy or observe. or is putting it on the clipboard acceptable?

Jarosław Pietras

unread,
Oct 13, 2023, 12:11:07 PM10/13/23
to OneCommander
I don't have md5? 
2023-10-13_18-05-56.png

To copy the calculated value to the clipboard.

Kyle Condon

unread,
Oct 13, 2023, 1:38:16 PM10/13/23
to OneCommander
@Jaroslaw My bad, my memory was incorrect on that one. I will add this to my script todo list.

Jarosław Pietras

unread,
Oct 13, 2023, 4:00:58 PM10/13/23
to OneCommander
Ok, thx.

Kyle Condon

unread,
Oct 16, 2023, 12:10:20 AM10/16/23
to OneCommander
Sorry, had to go to the ER this weekend to find out I have an impacted wisdom tooth that's infected, it'll be a little bit before I'm good enough to code again.

Kyle Condon

unread,
Oct 16, 2023, 9:35:54 PM10/16/23
to OneCommander
@ Jaroslaw I have finished the MD5 calculation script. If a single file is selected it will just put the hash itself on the clipboard. If multiple files are selected it will return in the format "Filename - FileHash" Using winkey+v will allow you to access all hashes generated with that naming scheme.

Kyle Condon

unread,
Oct 16, 2023, 9:40:10 PM10/16/23
to OneCommander
@Simon Is the solution Milos posted good enough appending the current date, or would you still like a script? Also what were the issues with the Pastebin script?

Kyle Condon

unread,
Oct 17, 2023, 4:34:56 AM10/17/23
to OneCommander
Update: Added a script under the ADB category that will give you a list of all third party installed packages on the device including their common name. Depending on how many apps you have installed this can take a long time as it has to pull all apks off the phone and then use the aapt2 binary to get the correct info and parse it. Just give it time to run and eventually a window will pop up with a sorted list of package names with their common names. You can select an entry and copy the entry or search for a specific app. Will be used to implement other features in the future.

Jarosław Pietras

unread,
Oct 18, 2023, 1:00:37 PM10/18/23
to OneCommander
Thanks,
how to install only this (MD5) script?

Kyle Condon

unread,
Oct 18, 2023, 1:14:05 PM10/18/23
to OneCommander
Easiest way would be to clone the repository from github use the Install script and delete the unwanted scripts from the One Commander Scripts Folder, and in the KPC Folder in the OC Resources Folder Delete All .ps1 files except for Set-OCVariables.ps1 and Get-FileHashMD5ToClipboard.ps1 and the Export Folder.

Kyle Condon

unread,
Oct 18, 2023, 1:15:34 PM10/18/23
to OneCommander
Though this raises another idea for me. I might add parameters to the Install.ps1 script to choose specific scripts from the collection upon install.

Jarosław Pietras

unread,
Oct 19, 2023, 11:28:11 AM10/19/23
to OneCommander
I can't install it. 

pwsh_2023-10-19_17-23-57.png

Kyle Condon

unread,
Oct 19, 2023, 8:58:03 PM10/19/23
to OneCommander
I haven't implemented it in the MS Store version yet. So either use the portable or installer version from onecommander.com if you'd like it now. Or wait until I implement it for the store version. Sorry about that.

Kyle Condon

unread,
Oct 21, 2023, 10:13:18 PM10/21/23
to OneCommander
Okay try deleting the old repo clone and cloning it again and running Install.ps1 again. It should account for all install types now.

Kyle Condon

unread,
Oct 21, 2023, 10:33:19 PM10/21/23
to OneCommander
Or I have added the current repo as of Today as a release that you can download as a zip file and extract and then run Install.ps1.

Jarosław Pietras

unread,
Oct 22, 2023, 5:12:28 AM10/22/23
to OneCommander
That's the message:
[11:07:58 INF] MSG: ⚠ & : The term 'C:\Program Files\WindowsApps\44576milosp.OneCommander_3.54.1.0_neutral__p0rg76fmnrgsm\Rapidrive\Resources
\KPC\Set-OCVariables.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:8 char:3
+ & (Join-Path $ParseOCPath 'Resources\KPC\Set-OCVariables.ps1') -Curre ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program File...OCVariables.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
The argument 'C:\Program Files\WindowsApps\44576milosp.OneCommander_3.54.1.0_neutral__p0rg76fmnrgsm\Rapidrive\Resources\KPC\Get-FileHashMD5ToClipboard.ps1' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Kyle Condon

unread,
Oct 22, 2023, 11:51:15 AM10/22/23
to OneCommander
Aw crap yeah, I'm gonna have to update each script individually. But I'll put out another release when I'm done with that. It should only take me a day or two.

Kyle Condon

unread,
Oct 22, 2023, 11:59:22 AM10/22/23
to OneCommander

Jarosław Pietras

unread,
Oct 22, 2023, 1:50:44 PM10/22/23
to OneCommander
I reinstalled it and no change, still error.

Kyle Condon

unread,
Oct 22, 2023, 6:50:30 PM10/22/23
to OneCommander
I will have to do some more experimentation In that case.

Kyle Condon

unread,
Oct 25, 2023, 8:48:45 PM10/25/23
to OneCommander
@ Jaroslaw, you might need to uninstall OneCommander and Reinstall and run the updated releases Install.ps1 again... just make sure to backup your settings and such from C:\Users\"YourUsername"\OneCommander. Or be willing to reset them yourself. Sorry but I can't recreate that error with the new release.

Kyle Condon

unread,
Oct 30, 2023, 3:56:47 PM10/30/23
to OneCommander
Found my scripting error in the actual scripts files. Everything should work as expected with any version of OC now.

Jarosław Pietras

unread,
Nov 1, 2023, 1:01:51 PM11/1/23
to OneCommander
Now something like this:
[17:58:53 INF] MSG: ⚠ & : File C:\Users\jarko\OneCommander\Resources\KPC\Set-OCVariables.ps1 cannot be loaded because running scripts is disa
bled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=13517
0.
At line:16 char:3

+ & (Join-Path $ParseOCPath 'Resources\KPC\Set-OCVariables.ps1') -Curre ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
[31;1mImport-Clixml: [0mC:\Users\jarko\OneDrive\Dokumenty\PowerShell\Microsoft.PowerShell_profile.ps1:2 [0m
[31;1m [0m [36;1mLine | [0m
[31;1m [0m [36;1m [36;1m   2 | [0m Variables = [36;1mImport-Clixml -Path "C:\Users\jarko\OneCommander\Resource [0m [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m     | [31;1m               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m [31;1m [31;1m [36;1m     | [31;1mCould not find file 'C:\Users\jarko\OneCommander\Resources\KPC\Export\CusPSVars.xml'. [0m
[31;1mInvalidOperation: [0mC:\Users\jarko\OneDrive\Dokumenty\PowerShell\Microsoft.PowerShell_profile.ps1:3 [0m
[31;1m [0m [36;1mLine | [0m
[31;1m [0m [36;1m [36;1m   3 | [0m [36;1m$CustomVariables.GetEnumerator() | ForEach-Object -Process { New-Vari [0m [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m     | [31;1m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m [31;1m [31;1m [36;1m     | [31;1mYou cannot call a method on a null-valued expression. [0m
[31;1mGet-FileHash: [0mC:\Users\jarko\OneCommander\Resources\KPC\Get-FileHashMD5ToClipboard.ps1:4 [0m
[31;1m [0m [36;1mLine | [0m
[31;1m [0m [36;1m [36;1m   4 | [0m     $SelFileMD5Hash = Get-FileHash -LiteralPath [36;1m$_ [0m -Algorithm MD5 [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m     | [31;1m                                                 ~~ [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m [31;1m [31;1m [36;1m     | [31;1mCannot bind argument to parameter 'LiteralPath' because it is null. [0m
[31;1mSplit-Path: [0mC:\Users\jarko\OneCommander\Resources\KPC\Get-FileHashMD5ToClipboard.ps1:5 [0m
[31;1m [0m [36;1mLine | [0m
[31;1m [0m [36;1m [36;1m   5 | [0m     $SplitPathLeaf = Split-Path -Path [36;1m$_ [0m -Leaf [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m     | [31;1m                                       ~~ [0m
[31;1m [0m [36;1m [36;1m [0m [36;1m [0m [36;1m [31;1m [31;1m [36;1m     | [31;1mCannot bind argument to parameter 'Path' because it is null. [0m

Kyle Condon

unread,
Nov 1, 2023, 9:23:18 PM11/1/23
to OneCommander
That's an elevation issue, open an elevated/admin powershell and do "Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser"

Kyle Condon

unread,
Nov 1, 2023, 9:24:27 PM11/1/23
to OneCommander
Or rather it's a security feature to keep random scripts from being run automatically without you setting that execution policy first.
Reply all
Reply to author
Forward
0 new messages