It doesn't necessarily have to show the actual progress (although that would be nice) - but just any kind of hint that the script is still busy and doing something.
I pass a rather large selection of files to another program (repeated calls inside a ForEach loop) and have set up a msg-box to tell me when it's done. So theoretically I know it's still at work when I switch back to XY and don't see that Done-dialog.
But it were reassuring to have the opposite feedback: Seeing something - anything - for as long as the script is at work. An icon that stays up, a status bar message that I configure - any such thing I can do to keep me informed?
Progress Indicator
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Progress Indicator
The script could be modified to periodically call the Status SC to display a message in the status bar.You can even get creative with the messages to create little text animations or progress bars. 
Code: Select all
"Count to 100"
// Start counting at 1.
$i = 1;
// Keep counting until 100.
while ($i < 100) {
// Show current value of $i in the status bar.
Status $i, '222299', 'progress';
// Increment $i.
$i++;
// Pause for dramatic effect.
wait 50;
}
// Print the final value of $i.
Status $i, '229922', 'ready';-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Progress Indicator
Or for the selected files:
Code: Select all
$selectedItems = get("SelectedItemsPathNames");
$countNormalized = gettoken($selectedItems, "count", "<crlf>");
$i = 1;
foreach($item, $selectedItems, "<crlf>") {
status "Percent done: " . round($i / $countNormalized * 100, 0) . "%", "006400", "progress";
wait 500;
$i++;
}
One of my scripts helped you out? Please donate via Paypal
-
Stef123
Re: Progress Indicator
Thanks. Exactly what I needed. Both, feature-wise and also in terms of tasting the sweet grapes of success. It worked on the first go-around (I let it display the filename contained in $item of the ForEach loop that changes in every cycle). 
EDIT: Noticed the percent-done variant just now - thank you highend, that adds the cream on top, getting the total count of my selection, then computing the percentage done. Must put this off for later tonight. Can't wait to try it out.
EDIT: Noticed the percent-done variant just now - thank you highend, that adds the cream on top, getting the total count of my selection, then computing the percentage done. Must put this off for later tonight. Can't wait to try it out.
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Progress Indicator
Interesting example:
http://www.xyplorer.com/xyfc/viewtopic.php?p=65775
(which I think could be adapted to suit your needs)
http://www.xyplorer.com/xyfc/viewtopic.php?p=65775
(which I think could be adapted to suit your needs)
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Progress Indicator
You can enhance my last example with a simple progress bar easily:
Select a hundred files and watch it *g*
You could even colorcode it...
Code: Select all
$selectedItems = get("SelectedItemsPathNames");
$countNormalized = gettoken($selectedItems, "count", "<crlf>");
$i = 1;
foreach($item, $selectedItems, "<crlf>") {
$percentDone = round($i / $countNormalized * 100, 0);
$progressBar = strrepeat("#", $percentDone / 20);
status "Percent done: $progressBar $percentDone% $progressBar", "006400", "progress";
wait 100;
$i++;
}You could even colorcode it...
One of my scripts helped you out? Please donate via Paypal
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Progress Indicator
Keep in mind that if the script is doing some heavy lifting, XYplorer will invest all resources to script execution and stop updating the statusbar. And will also look like it's hanged, I mean hung. 
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
Marco
- Posts: 2354
- Joined: 27 Jun 2011 15:20
Re: Progress Indicator
Unless you place a "wait 1;" at the end of the foreach() loopSammaySarkar wrote:Keep in mind that if the script is doing some heavy lifting, XYplorer will invest all resources to script execution and stop updating the statusbar. And will also look like it'shanged, I mean hung.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]
Don sees all [cit. from viewtopic.php?p=124094#p124094]
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: Progress Indicator
Didn't know that, thanks.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
Stef123
Re: Progress Indicator
Quite some learning curve - have to take it slowly, one step at a time. Didn't expect the programming involved to be so intricate. Makes me see existing software in a more appreciative light.
@SkyFrontier - thanks for the link. Have to figure out the logics behind it. Weekend material
@Highend - your script is the one I've spent most time on, so far. Picked up many things along the way. Gettoken is the most taxing. Not the syntax per se, but understanding what to use it for and why. The same with TheQwerty's hint to "formatlist" (from another thread).
@SkyFrontier - thanks for the link. Have to figure out the logics behind it. Weekend material
@Highend - your script is the one I've spent most time on, so far. Picked up many things along the way. Gettoken is the most taxing. Not the syntax per se, but understanding what to use it for and why. The same with TheQwerty's hint to "formatlist" (from another thread).
Glad you pointed this out. Not just the hang-up issue, but the very fact that resources are limited. Should have been obvious to me, but had not given it any thought at all. Another thing I put on my list - testing performance differences with various progress indicators.Marco wrote:Unless you place a "wait 1;" at the end of the foreach() loopSammaySarkar wrote:Keep in mind that if the script is doing some heavy lifting, XYplorer will invest all resources to script execution and stop updating the statusbar. And will also look like it'shanged, I mean hung.
XYplorer Beta Club