XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 9:42 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Help with volume icon
PostPosted: August 25th, 2012, 10:28 pm 
Offline

Joined: August 25th, 2012, 9:43 pm
Posts: 22
Hi, I have no idea how to code but for the past few days I've been modifying other people widgets to create my own set

Image

As you can see, they're not very good looking :? but incredibly useful to me since they rest upon the taskbar (as topmost) and can be accessed at any time.
Anyways, my question is, is there a way to make the volume icon change depending of the volume percentage or if it's muted? if there's such an option I couldn't find it...
if you can show me a template it would be awesome.

Thanks for your help and excuse my poor english :oops:

Edit: Also, is there a way to make the mail core to play a sound when new mail arrives?


Top
 Profile  
 
PostPosted: August 30th, 2012, 2:07 am 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
Try this out - http://4ybak47.deviantart.com/art/Round ... -324235369

(And the source file available to download from that link)

To enable the onClick sound change - go to your button -> Attributes -> Binding Core -> volumecore1
Then in your button's -> Functions -> OnClick :: type "!DownVolume=20" or "!UpVolume=5". (The 5 & 20 are the value which the volume is going to be changed by).

The main idea of changing the image corresponding to the core, is to have all the different images available and visible -> hide them on start and each time the value changes, hide all the images and then show only one that matches your value.

Code:
//This function called when the volume is being updated.
function volCoreOnUpdate(Sender)
{
         //Hide all the volume images.
         imgMuted.Visible = false;
         imgLow.Visible = false;
         imgMed.Visible = false;
         imgMax.Visible = false;


         //Display image



         //Display muted image if the volume is muted or the volume is equale to zero.
         //if (volCore.Volume == 0 || volCore.IsMute )
         //On my conputer properity IsMute is not supported, try it on yours by replacing the following string whith the provius one.
         if (volCore.Volume == 0)
         {
              imgMuted.Visible = true;
         }

         //Display full volume if its over 80
         else if (volCore.Volume >= 80)
         {
              imgMax.Visible = true;
         }

         //Display normal volume if its over 40 and below 80
         else if (volCore.Volume >= 40)
         {
              imgMed.Visible = true;
         }

         //Else if the volume is not muted and below 40 show low volume image
         else
         {
              imgLow.Visible = true;
         }

}


The imgMuted, imgLow, imgMed and imgMax are the images


Attachments:
File comment: Widget preview
VolumeControl.png
VolumeControl.png [ 13.37 KiB | Viewed 7431 times ]

_________________
Image
Top
 Profile  
 
PostPosted: August 30th, 2012, 4:38 am 
Offline

Joined: August 25th, 2012, 9:43 pm
Posts: 22
Thank you so much vlad!! this is exactly what I wanted.
if (volCore.IsMute) didn't work for me either, though. It's a shame cause it was so close to be perfectly functional...

Again, you're a genius man. I wish I could come up with this stuff by myself.

Do you have any idea about my other question? I think the mail core without a sound warning is kind of incomplete. Maybe there's an easy way and I'm missing it.


Top
 Profile  
 
PostPosted: August 31st, 2012, 1:56 am 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
Well if u r using the mailCore there is a value valled %Count which represents the amount of emails you have right now, my idea is to save the amount of email you haven't read and on each update (make it 20 - 30 min) check if the amount has been increased or not. If so play a sound and notify the user about an incoming mail.

So you should define a variable "started" onLoad, then u will have to add another one called mailAmount initially we will define it as zero
Code:
function onLoad()
{
     started =  false;
     mailAmount = 0;
}


Add an event to the mail core onUpdate so we can compare the amount of email which had been added from the last time u had checked the mail count.
Code:
function mailCoreOnUpdate()
{
     if ( mailAmount < mailCore.Count)
     {
          playSound();
          showSomeSexyAnimation();
     }

     //Update the mail amount for further compares
     mailAmount = mailCore.Count;
}


The code is not perfect, it will always play sound each time you start your computer or add this widget. And I haven't played yet with this core so im not sure what happen's when u actually read the email. If the amount just drops so that code should work fine, but if not tell me and ill try to figure it out.

_________________
Image


Top
 Profile  
 
PostPosted: August 31st, 2012, 2:36 am 
Offline

Joined: August 25th, 2012, 9:43 pm
Posts: 22
Thank you so much for taking your time to answer.
I'm sorry but , can you make me a template like the last time? I know it's really simple but I can't do it.
Last time for example, when I tried to copy your code into my widget, nothing happened. then I modified yours doing the same stuff I did in mine and it worked perfectly. There's something I'm not doing right...
If you can't don't worry about it, you've been helpful enough.


Top
 Profile  
 
PostPosted: August 31st, 2012, 6:33 am 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
Example of playing sounds:
http://4ybak47.deviantart.com/#/d5d622k

I dont know how to work with the MailCores, if could send me the template u made i could view the way it works. Or just tell me how to set up the user name and password for the gMailCore

_________________
Image


Top
 Profile  
 
PostPosted: August 31st, 2012, 6:58 am 
Offline

Joined: August 25th, 2012, 9:43 pm
Posts: 22
This is my widget (don't laugh).


Attachments:
mail.zip [57.81 KiB]
Downloaded 374 times
Top
 Profile  
 
PostPosted: September 1st, 2012, 12:50 am 
Offline
User avatar

Joined: May 12th, 2012, 8:32 pm
Posts: 594
zequi wrote:
is there a way to make the mail core to play a sound when new mail arrives?


Hi, You can uses function "PlaySound( filepath )" in script,etc:

you need put the "a.wav" sound file into the widget folder,and when image1 clicked,write code:

Code:
function image1OnClick(Sender)
{
  PlaySound("a.wav");
}

_________________
XWidget Software Developer
[XWidget for Android] [Lastest version of XWidget] [Lastest patch of XWidget]
[XDesktop for Android/Windows]


Top
 Profile  
 
PostPosted: September 1st, 2012, 6:43 am 
Offline
User avatar

Joined: August 29th, 2012, 2:34 am
Posts: 56
Listen Tony i tried the PlaySound("a.wav") function but apparently it only works with "wav" files (i used a mp3 file) , maybe its only on my PC the function PlaySound() and PlaySound2() wont work for mp3's, in further release could u make a PlayMp3(...file) ?.

zequi your sound is now playing when new mail is arriving, download the example below.


Attachments:
mail.zip [57.71 KiB]
Downloaded 387 times

_________________
Image
Top
 Profile  
 
PostPosted: September 1st, 2012, 5:10 pm 
Offline

Joined: August 25th, 2012, 9:43 pm
Posts: 22
Thank you so much vlad!! you're my hero.
I swear from now on I will not be bothering you that much ;)


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 20 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