Pointless but fun macro progressbar.

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply

Is this pointless?

Yes
2
100%
Yes again
0
No votes
 
Total votes: 2

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Pointless but fun macro progressbar.

Post by Dorian (MJT support) » Thu Dec 13, 2012 10:50 pm

Sometimes it's nice to have something to watch while a macro is running. Even just to know it's doing something, or to keep a user entertained. :D

So I wrote this. Kinda fun and silly.

Code: Select all

//edit these as you wish
let>waitinterval=0.9
let>progresssymbol=~
let>title=Please Wait : Script Working%CRLF%
let>timecount=seconds

//set up my variables
GetTime>starttime
let>progress=progresssymbol

//creates the status message
srt>progressbar
concat>progress,progresssymbol
message>%title%%progress%
END>progressbar


//just sprinkle these two lines throughout your script.  you can remove the wait if you wish
gosub>progressbar
wait>waitinterval


gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

//announce when the script has finished, and how long it took
GetTime>endtime
TimeDiff>%endtime%,%starttime%,timecount,duration
messagemodal>%title%%progress%%CRLF%%CRLF%Script finished in %duration% %timecount%


Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Dec 13, 2012 11:12 pm

Pointless... maybe But that's how they used to inform users back before GUIs

We could run all the way back to 1985 style "rolling" text.

Code: Select all

//edit these as you wish
let>waitinterval=0.9
let>progresssymbol_1= -
let>progresssymbol_2= \
let>progresssymbol_3= |
let>progresssymbol_4= /
let>title=Please Wait : Script Working%CRLF%
let>timecount=seconds

//set up my variables
GetTime>starttime
let>progress=0

//creates the status message
srt>progressbar
Add>progress,1
Let>roller=progresssymbol_%progress%
message>%title%%roller%
If>Progress=4
  let>progress=0
EndIf
END>progressbar


//just sprinkle these two lines throughout your script.  you can remove the wait if you wish
gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

//announce when the script has finished, and how long it took
GetTime>endtime
TimeDiff>%endtime%,%starttime%,timecount,duration
messagemodal>%title%%progress%%CRLF%%CRLF%Script finished in %duration% %timecount%

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Thu Dec 13, 2012 11:32 pm

I like that addition, and i remember those twirly text things!

Almost every time I'm here I notice something new.

This time, it was Add>

I'm still using Let>x=x+1

#rusty #StuckInVersion5
Yes, we have a Custom Scripting Service. Message me or go here

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Dec 14, 2012 12:41 am

Looks like a job for the Python fish .

Code: Select all

//edit these as you wish
let>waitinterval=0.3
let>progresssymbol_1= >))'>
let>progresssymbol_2=     >))'>
let>progresssymbol_3=         >))'>
let>progresssymbol_4=             >))'>
let>progresssymbol_5=         <'((<
let>progresssymbol_6=     <'((<
let>title=Please Wait : Script Working%CRLF%
let>timecount=seconds

//set up my variables
GetTime>starttime
let>progress=0

//creates the status message
srt>progressbar
Add>progress,1
Let>roller=progresssymbol_%progress%
message>%title%%roller%
If>Progress=6
  let>progress=0
EndIf
END>progressbar

//just sprinkle these two lines throughout your script.  you can remove the wait if you wish
gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

gosub>progressbar
wait>waitinterval

//announce when the script has finished, and how long it took
GetTime>endtime
TimeDiff>%endtime%,%starttime%,timecount,duration
messagemodal>%title%%progress%%CRLF%%CRLF%Script finished in %duration% %timecount%


User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Fri Dec 14, 2012 12:45 am

Lol, that does look like a fish.

Hmm, maybe we could get really creative and animate some Ascii art. A man walking or something. :)
Yes, we have a Custom Scripting Service. Message me or go here

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Dec 14, 2012 1:30 am

I did tinker with something like that and the classic blinking eyes* but as you can see from JRL's twirly the message window doesn't use a monospaced font so alignment is a problem. I'll bet JRL could do it in a dialog though :wink:

*
(o) (o)
(-) (-)
(_) (_)

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Fri Dec 14, 2012 1:36 am

Ah, yes, I see what you mean. I tried to make a countdown out of the ascii numbers below, but they went all screwy (on the forum, too)
Ascii generator : http://www.network-science.de/ascii/

Code: Select all

  ##   
 ####   
   ##   
   ##   
   ##   
   ##   
 ###### 

 #######  
##     ## 
       ## 
 #######  
##        
##        
#########

 #######  
##     ## 
       ## 
 #######  
       ## 
##     ## 
 ####### 

##        
##    ##  
##    ##  
##    ##  
######### 
      ##  
      ##  

######## 
##       
##       
#######  
      ## 
##    ## 
 ######                               

Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Dec 14, 2012 5:39 am

Here's a downsized version of Happy Button. It grins at random intervals. Me_again's blinking eyes could be substituted for the Asterisk and Caret that was used.

Code: Select all

Dialog>Dialog1
   Caption=Happy Button
   Width=200
   Height=100
   Top=CENTER
   Left=CENTER
   Close=0
   Button=*     *%CRLF%[__________],50,1,80,40,3
EndDialog>Dialog1

show>dialog1

Let>kcount=0
Random>150,kwait

Label>start
Add>kcount,1
Wait>0.01
Random>10,kdwell
Let>kdwell=%kdwell%/10
If>kdwell<0.3
  add>kdwell,1
EndIf
GetDialogAction>dialog1,r1
If>r1=3,Quit
Let>dialog1.msbutton1=*     *%CRLF%[________]
If>%kcount%>%kwait%
  Let>dialog1.msbutton1=^     ^%CRLF%(_________)
  RDA>dialog1
  Wait>%Kdwell%
  Let>kcount=0
  Random>350,kwait
EndIf
Goto>start

Label>Quit

Here's the same thing with just a label

Code: Select all

Dialog>Dialog1
   Caption=Happy Button
   Width=200
   Height=100
   Top=CENTER
   Left=CENTER
   Close=0
   Label=        *     *%CRLF%  [_________],50,1,80,40,3
EndDialog>Dialog1

show>dialog1

Let>kcount=0
Random>150,kwait

Label>start
Add>kcount,1
Wait>0.01
Random>10,kdwell
Let>kdwell=%kdwell%/10
If>kdwell<0.3
  add>kdwell,1
EndIf
GetDialogAction>dialog1,r1
If>r1=3,Quit
Let>dialog1.mslabel1=        *     *%CRLF%  [_________]
If>%kcount%>%kwait%
  Let>dialog1.mslabel1=       ^     ^%CRLF%(___________)
  RDA>dialog1
  Wait>%Kdwell%
  Let>kcount=0
  Random>350,kwait
EndIf
Goto>start

Label>Quit
Here's the countdown. I think the SetDialogObjectFont> function requires version 10. I don't remember how or even if it was possible to set label font in a dialog prior to v10.

Thanks to a post by kpassaur back in 2007 I found how to set dialog fonts starting in version 9.

Code: Select all

Dialog>Dialog1
   Caption=Happy Button
   Font=Terminal,8
   Width=200
   Height=100
   Top=CENTER
   Left=CENTER
   Close=0
   Label=########%crlf%##       %crlf%##       %crlf%#######  %crlf%      ## %crlf%##    ## %crlf% ######,50,1,80,40,3
EndDialog>Dialog1

//SetDialogObjectFont>Dialog1,mslabel1,terminal,8,1,0

show>dialog1

Wait>1
//4
  Let>dialog1.mslabel1=##        %crlf%##    ##  %crlf%##    ##  %crlf%##    ##  %crlf%######### %crlf%      ##  %crlf%      ##
  RDA>dialog1
Wait>1
//3
  Let>dialog1.mslabel1= #######  %crlf%##     ## %crlf%       ## %crlf% #######  %crlf%       ## %crlf%##     ## %crlf% #######
  RDA>dialog1
Wait>1
//2
  Let>dialog1.mslabel1= #######  %crlf%##     ## %crlf%       ## %crlf% #######  %crlf%##        %crlf%##        %crlf%#########
  RDA>dialog1
Wait>1
//1
  Let>dialog1.mslabel1=  ##   %crlf% ####   %crlf%   ##   %crlf%   ##   %crlf%   ##   %crlf%   ##   %crlf% ######
  RDA>dialog1
Wait>1
//0
  Let>dialog1.mslabel1= #######  %crlf%##     ## %crlf%##     ## %crlf%##     ## %crlf%##     ## %crlf%##     ## %crlf% #######
  RDA>dialog1
Wait>1

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Sat Dec 15, 2012 12:08 am

Wow, those are awesome. Especially the last one.

I've avoided dialogs so far, but see how they can almost be used in place of messagemodal, but with far more control.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts