XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 6:49 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Edit script
PostPosted: January 23rd, 2015, 3:47 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
I would like to create a similar widget like this:
http://jimking.deviantart.com/art/Proce ... -378444183

The fact is that for this widget I used a single .png image for the rotation and this script.

Code:
var cs = 0;

function cpucore1OnUpdate(Sender)
{
  cs = cpucore1.get("%Percent");
  if(cs==0)
  {
    pnganimate1.play = false;
    pnganimate1.rotateAngle = 0;
  }
  else  if(cs<=30)
  {
    pnganimate1.RotateAngleStep = Math.round(cs/2);
    pnganimate1.Play = true;
  }
  else
  {
//    print("Max = 17 !");
    pnganimate1.RotateAngleStep = 17;
    pnganimate1.Play = true;
  }
}


Now I'll use a multiple serial png images (0-7). How the script should be edited to work properly...?

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 29th, 2015, 11:29 am 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Please send me the widget, what you have so far, so I can see.


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 30th, 2015, 1:35 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
meme wrote:
Please send me the widget, what you have so far, so I can see.

Here is the widget meme:
Thanks! :)
(the script is from the other widget)

Download and try this one to see what I mean, and how the new widget should work
http://jimking.deviantart.com/art/Proce ... -378444183


Attachments:
cpu_cooler_resources.xwp [422.5 KiB]
Downloaded 315 times

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/
Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 30th, 2015, 2:40 am 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Replace existing code with this, adjust the 100 value to alter the speed range.
Possibly set a minimum speed after the else rather than have the fan stop ?

Code:
var cs = 0;

function cpucore1OnUpdate(Sender)
{
    cs = cpucore1.get("%Percent");
    if(cs>0)
   {
    pnganimate1.Interval = Math.round(100/cs);       //interval range 10~99999ms
    pnganimate1.Play = true;
   }
   else
    pnganimate1.Play = false;
}


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 30th, 2015, 3:05 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Quote:
Possibly set a minimum speed after the else rather than have the fan stop ?

Yes! Is exactly what I was thinking about it. If you notice on the other widget, the fan doesn't stop even on low cpu usage (0%) and the fan movement is more fluid..
So if you can do it to this one, it will be the ideal! :)

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 30th, 2015, 12:35 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Try this, again you can adjust the minimum speed value, ms = 100
Are you going to display the cpu% in the blue box at the front ?

Quote:
var cs = 0; // cpu speed %
var ms = 100; // minimum fan speed value

function cpucore1OnUpdate(Sender)
{
cs = cpucore1.get("%Percent");
if(cs>0)
pnganimate1.Interval = Math.round(ms/cs); // interval = 10~99999ms
else
pnganimate1.Interval = ms
}


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 30th, 2015, 12:55 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Thanks for the script mate! I will try it as soon as possible..
About the cpu percentage I don't know. Maybe I will add a right click option to show /hide it.
What do you think?

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 30th, 2015, 1:23 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
I think it looks OK


Attachments:
cpu.png
cpu.png [ 72.37 KiB | Viewed 9045 times ]
Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 31st, 2015, 12:29 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
I think so...! ;)
Thanks again meme
Quote:
Try this, again you can adjust the minimum speed value, ms = 100

@meme, I tried your second scipt but the fan doesn't move at all... :?
The first script worked..

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 31st, 2015, 12:43 am 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Quote:
@meme, I tried your second scipt but the fan doesn't move at all... :?

Strange... here is the widget with code, try this.


Attachments:
cpu_cooler_resources.xwp [422.6 KiB]
Downloaded 278 times
Top
 Profile  
 
 Post subject: Re: Edit script
PostPosted: January 31st, 2015, 1:08 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
meme wrote:
Strange... here is the widget with code, try this.

Strange because this one works fine!
Thanks :D

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group