Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Central

Adding Cities to World Clock

Author Message
IanTheMacFan
No longer registered


Joined: 27 May 2005
Posts: 79
Location: calgary, ab

Posted: Fri May 27, 2005 - 12:54 pm    Post subject: Adding Cities to World Clock Reply with quote

How do I add cities to Apple's World Clock widget? I want to add Orlando to the list. Yes, I know I could use Miami, but how do I get Orlando??
View user's profile Send private message Send e-mail Widgets
CraigStanton



Joined: 06 May 2005
Posts: 45
Location: New Zealand

Posted: Fri May 27, 2005 - 3:07 pm    Post subject: Reply with quote

You could use the hint I wrote for MacOSXHints.com

http://www.macosxhints.com/article.php?story=20050430193250534
View user's profile Send private message Visit poster's website Widgets
JohnGaver



Joined: 17 May 2005
Posts: 20
Location: Texas

Posted: Sun May 29, 2005 - 2:28 pm    Post subject: Save your changes!!! Reply with quote

I did the same thing that Craig's post details, on the day I installed Tiger 10.4, which was the day it was released.

Problem: 10.4.1 overwrote my changes a couple of weeks later.

Either be prepared to re-do your changes, when new releases come out or back them up. I have backed up both files, for now and I am writing a "fixclockwidgit" shell script, using "sed", that I will be able to run to apply my changes to future updates, should I need to. That will be better than restoring the changed file, since the update may actually modify one of those files and restoring the old file will remove the update. My script will just apply the same change to the new file, thus keeping any new updated code intact.

I will try to remember to post that script here, when I get around to finishing it.
View user's profile Send private message Send e-mail Visit poster's website Widgets
JohnGaver



Joined: 17 May 2005
Posts: 20
Location: Texas

Posted: Tue Jun 07, 2005 - 2:33 am    Post subject: add2clockwidget Shell Script Now Available (FREEWARE) Reply with quote

OK. For all you folks who just can't understand why Apple didn't include in their World Clock Widget, booming metropolises like, for example, the Texas cities of Cut 'n Shoot, Dime Box, Ding Dong or Paducah and you want to see your own city on that list, I just completed the "add2clockwidget" shell script.

I have seen many wrong (or actually, the proper word is "incomplete") descriptions of how to add a new city manually. There are timezone and other issues that most of those posts ignore.

The "add2clockwidget" is a UNIX shell script that will automate that task and do it right. It requires the user to go into the script and set 5 or 6 variables, before running it. It is copiously commented, so you should be able to easily figure out where and how to add those variables. There are over 250 lines of comments and only about 65 lines of actual working code, so even a UNIX novice should be able to understand what is going on. But, because of the fact that Apple has set the ownership of that widget to "root", you must be logged in as "root", to run it. The variables are the name of the new city, the minutes of offset from GMT, the timezone, the directory for the backup, the name of the city that you want the new city to appear above and the Language.

Just download the script, unzip it, go the the terminal and set your variables and run it. It is really best if you use a UNIX editor to put in your variables, since "TextEdit" can, under certain circumstances, change some special characters that you may not want changed. You can download the script at:

http://www.ActionAmerica.org/fun/add2clockwidget.zip

I have tried to include error checks for most types of errors. Let me know if you find something that I missed.
View user's profile Send private message Send e-mail Visit poster's website Widgets
EricNau



Joined: 22 Jun 2005
Posts: 92
Location: California, USA

Posted: Tue Jul 05, 2005 - 2:04 pm    Post subject: Sounds pretty hard Reply with quote

Is there an easier way for those of us out there (or maybe just me) that aren't programmers, but would still like thier city on there. I can't believe they forgot Sacramento...We are the Capital.
View user's profile Send private message Send e-mail Widgets
CraigStanton



Joined: 06 May 2005
Posts: 45
Location: New Zealand

Posted: Tue Jul 05, 2005 - 2:22 pm    Post subject: Reply with quote

Well you've got two methods here. Do it yourself through changing some text files, or modify a script and run it. I doubt it'll get much easier than those two.
View user's profile Send private message Visit poster's website Widgets
JohnGaver



Joined: 17 May 2005
Posts: 20
Location: Texas

Posted: Wed Jul 06, 2005 - 3:43 am    Post subject: Adding city to clock widget Reply with quote

Apple included in the World Clock widget, just about every permutation of timezone and daylight savings time that exists anywhere in the world. Unfortunately, that makes for a very complicated widget.

That's why the "add2clockwidget" shell script was created. There were way too many incorrect methods floating around out there. Even if you choose to manually code the changes, that shell script will give you the information that you need to do it right. In fact, about 80% of that script is explanation, in the form of commented lines. You can sometimes get away with shortcutting the process, but you may end up creating a lot of console exceptions that you won't normally see, as a user. It's best to just do it right to begin with.

That whole script boils down to 2 lines that do the actual work and about 63 lines of executable code that essentially, sets a few variables and does a whole lot of error checking, to make sure that everything is setup "PROPERLY", before those two lines that do the actual work are executed.

To add Sacramento, simply download the "add2clockwidget file", unzip it and follow the instructions at the top of the shell script. It might be a good idea if you print out the shell script, so you will have the comment (instruction) text to refer to.

It's best to use the "vi" editor, but if you are not familiar with "vi", you should be able to get away with using Apple's "TextEdit" to make the required changes, since adding "Sacramento" should not require you to make any weird changes (special characters, etc.). For Sacramento, make these changes to the script:

mycity="Sacramento"
offset="-420"
timezone="US\/Pacific"
citybelow="Salt Lake City"

Selecting "Salt Lake City" will place "Sacramento" in alphabetic order. Alternatively, you could select "Adak", to place "Sacramento" at the top of the list.

"backupuser" defaults to "owner". If you want the backup file placed on a different user's desktop, then you will want to change that, too. Since your language is obviously English, you can ignore setting "lang", as it defaults to English.

Once you have made those changes, simply save the file in a convenient place and run the script. To run the script, go to your "Utilities" folder and run "Terminal". When the terminal window opens, type

login root

(Since Apple has protected the World Clock widget at the "root" level, you have to be logged in as root for this script to make the changes.)

Enter your root password. Then change directories to the location where you saved the script. If you saved it on the "owner" Desktop, then you would type:

cd /Users/owner/Desktop

From there, you will simply run the script with the following command:

sh add2clockwidget

That's about as easy as I can make it. That's because to do it right, you have to take into consideration, timezones, daylight savings time and where, in each of the two files, the changes are to be placed.

Here's where I get to go ballistic with my security rant. Before you run any shell script as "root", you should read through the script and make sure that it is not doing anything that you don't want it to do. I will tell you that this script does only what it says it will do and nothing more. But chances are, you don't know me, so what I say is only words on a computer screen. Scan through the script, yourself. Even if you do know and trust me, it's still a good habit to get into. It may seem daunting, if you are not a UNIX geek, but as you look at each line, it should be obvious what most of them do and the rest should not take a lot of thought to figure out. Just try it. End of security rant.

I hope that this helps.
View user's profile Send private message Send e-mail Visit poster's website Widgets
EricNau



Joined: 22 Jun 2005
Posts: 92
Location: California, USA

Posted: Wed Jul 06, 2005 - 4:38 am    Post subject: Thanks Reply with quote

Thanks...I'll give it a try as soon as I have a little free time. I'll let you know how it works out.
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group