After I have manged to use Ruby as other COM language in the Automation plugin, I wanted to write more complex script to show and test the possibilities. I have decided to share for anyone who would like to write in ruby too.
Script displays n (user input) largest files at the path entered by the user (take from Salamander panel, but user can overwrite it). Nothing life changing but, at least for me, practical. I also wanted to have some framework for next scripts.
Nearly everything worked as it should. The biggest issue was caused Salamander.AbortScript(), because for unknown reason that has hang whole salamander when executed. I wanted to abort the script when user pressed cancel at InputBox (from what I tested it works for jscript and vbsript). I have circumvented the issue by managing the program workflow.
I hope someone will enjoy the script too .).
EDIT: New version of the file - to fix the cancel button even after wrong user answer. Should be final version.
Automation and ruby - listing largest files
Automation and ruby - listing largest files
- Attachments
-
- ruby_largest_files.zip
- (2.43 KiB) Downloaded 769 times
Last edited by tukanos on 17 Feb 2016, 17:22, edited 4 times in total.
-
- Plugin Developer
- Posts: 216
- Joined: 09 Dec 2005, 23:23
- Location: Ceske Budejovice, Czech Republic
- Contact:
Re: Automation a ruby - listing largest files
I recommend avoiding Salamander.AbortScript method in 3rd party script engines. I found it to be very buggy. You will probably have issues with WScript.Quit as well (you can try it). If it also hangs the WScript host, you can report the bug to the engine author.The biggest issue was caused Salamander.AbortScript(), because for unknown reason that has hang whole salamander when executed. I wanted to abort the script when user pressed cancel at InputBox (from what I tested it works for jscript and vbsript).
It's always the better ideaI have circumvent the issue by managing the program workflow.

Re: Automation a ruby - listing largest files
I seemanison wrote:I recommend avoiding Salamander.AbortScript method in 3rd party script engines. I found it to be very buggy. You will probably have issues with WScript.Quit as well (you can try it). If it also hangs the WScript host, you can report the bug to the engine author.The biggest issue was caused Salamander.AbortScript(), because for unknown reason that has hang whole salamander when executed. I wanted to abort the script when user pressed cancel at InputBox (from what I tested it works for jscript and vbsript).It's always the better ideaI have circumvent the issue by managing the program workflow.

I have one question concerning the InputBox: Why does the size of the InputBox does not adjust to the size of the string?
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Automation a ruby - listing largest files
We didn't need it 

Re: Automation a ruby - listing largest files
I thought soJan Rysavy wrote:We didn't need it
