Old 8th February 2013, 22:11   #1
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
Anyone ever successfully add the system date to a skin?

There are objects in std.mi for it but they return garbage. The code below returns "11/31/69" in the text object, regardless of what the actual system date is. Clock functions work perfectly.

PHP Code:
#include "..\..\..\lib\std.mi"

Global container main;
Global 
Timer clockTimer;
Global 
Text clockTextdateText;
Global 
int sysmonthsysdaysysyear;

System.onScriptLoaded () {
  
Group clockgroup getContainer("main").getLayout("normal");
  
clockText clockgroup.findObject("SystemClock");
  
dateText clockgroup.findObject("SystemDate");
  
clockTimer = new Timer;
  
clockTimer.setDelay (50);
  
clockTimer.start();
}

clockTimer.onTimer () {
  
string longtime integerToLongTimegetTimeOfDay() );
  
int datetime;
  
string hoursminssecsampm;
  
hours gettoken(longtime,":",0);
  
mins gettoken(longtime,":",1);
  
secs gettoken(longtime,":",2);
  
ampm=" PM";
  if (
stringtointeger(hours) >= 13) {
    
hours integertostring(stringtointeger(hours) - 12);
  } else {
    if (
stringtointeger(hours) != 12) {
    
ampm=" AM";
  }
  if (
stringtointeger(hours) == 0hours "12";
  }
  
longtime hours ":" mins;
  
clockText.setText (longtime);
  
dateText.setText(integertostring(System.getDateMonth(sysmonth)) + "/" integertostring(System.getDateDay(sysday)) + "/" integertostring(System.getDateYear(sysyear)));
}

System.onScriptUnloading () {
delete clockTimer;

JW is offline   Reply With Quote
Old 9th February 2013, 12:36   #2
pjn123
Major Dude
 
pjn123's Avatar
 
Join Date: Jan 2006
Location: /\/¯¯¯¯¯\/\ , South-Africa
Posts: 1,030
If you want an example, install ClassicPro and look in "C:\Program Files (x86)\Winamp\Plugins\ClassicPro\engine\scripts\cproabout.m".

But from what I can see is that your using the function incorrectly.

Here are two example of how you get the year and day of year:
System.getDateYear(System.getDate())
System.getDateDoy(System.getDate())

So your...
Global int sysmonth, sysday, sysyear;

...line won't be used and all those int's must be replaced by System.getDate() in your code.

Didn't test it again now so might be wrong

ClassicPro© v2.01 : This plugin allows you to use cPro skins in Winamp. ClassicPro skins are all SUI skins and loads very quickly. ClassicPro skins is even easier to skin than Winamp Classic skins. A new layout have been added since version 2.
Download ClassicPro© ==== cPro Skins ==== ClassicPro© Homepage ==== SC Forums
pjn123 is offline   Reply With Quote
Old 9th February 2013, 14:20   #3
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
Yep, that did it. One of those things I wish were spelled out a little better in std.mi

PHP Code:
dateText.setText(integertostring(System.getDateMonth(System.getDate()) + 1) + "/" integertostring(System.getDateDay(System.getDate())) + "/" integertostring(System.getDateYear(System.getDate()) + 1900)); 
JW is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump