g15web
DOWNLOAD G15WEB
What is g15web?
g15web is an extension/mod/applet/plugins for the
Logitech G15 Keyboard.
The goal of this extension is to get some webpages regularly, parse them using regular expression and extract some values to display them on the LCD screen of the keyboard.
Where can I get g15web?
g15web is completely free and you can download it
here. There's no installation, only one file.
If the application is already running, you'll not be able to erase the old exe. You have to choice:
- 1: kill the g15web process in the process manager and then download/overwrite the old exe and launch the new one.
- 2: rename the old exe, download the new one, execute the new one, delete the renamed old exe.
Release note
version 1.1 (03/30/07)
- When you launch the application 2 times, it killed the old one and run the new one.
- Added buttons to directly go on the homepage/help/share pages.
How to use it?
Just double click on g15web.exe and it starts in background. Don't run it 2 times or you'll the program 2 times in memory.
How to access to the configuration?
- Right click on the
logitech lcd manager in the traybar
- Click on
Settings
- Select the
Programs tab
- Click on
g15web in the table
- Click on
configure
How to configure it?
You can configure the 4 buttons of the lcd display for 4 different screen. Click on the radio button group to select which button you want to configure.
The
Refresh Rate field is the amount of time in second between 2 checks. It can be different for each screen. For example the screen 1 can refresh every 10 seconds and the screen 2 every one hour.
The
Font button enables you to choose a special font for each screen.
If
No UTF8? is checked, g15web will try to convert some utf8 characters into simple 7bits ASCII. It can be useful if your font doesn't display utf8 characters.
If
To Upper is checked, g15web will convert lower case characters into upper case. It can be useful if your font doesn't display lower case characters.
You see 3 groups that contains the same things,
Url,
Match and
Output. It's because you can put a different request on each line of the lcd display.
-
Url: This is the url that contains what you want to display. If you only fill this field, g15web will display to whole content of the url.
-
Match: (optional) This is a regular expression that will be used to extract things you want to display.
-
Output: (optional) It's a text that will be displayed on the lcd screen. $0 to $9 will be replaced by the extracted field.
When you press
Save button or
OK button, g15web automatically save all configuration.
When you press the
Test button, it'll simulate the line as if it was in the lcd display but render the output in the bottom text edit. It's useful to test or if you don't have the G15 keyboard you can still do some try.
The
Test All button will simulate the 3 lines of the current button. It should be similar to what you'll see on the display.
How to close/kill it?
Open the process manager, select g15web, right mouse click and click terminate the process.
How Regular Expressions work?
I invite you to read the microsoft web page about Regular Expression: msdn2.microsoft.com/en-us/library/k3zs4axe(vs.71).aspx
| . | Matches any single character. |
| [ ] | Indicates a character class. Matches any character inside the brackets (for example, [abc] matches "a", "b", and "c"). |
| ^ | If this metacharacter occurs at the start of a character class, it negates the character class. A negated character class matches any character except those inside the brackets (for example, [^abc] matches all characters except "a", "b", and "c"). If ^ is at the beginning of the regular expression, it matches the beginning of the input (for example, ^[abc] will only match input that begins with "a", "b", or "c"). |
| - | In a character class, indicates a range of characters (for example, [0-9] matches any of the digits "0" through "9"). |
| ? | Indicates that the preceding expression is optional: it matches once or not at all (for example, [0-9][0-9]? matches "2" and "12"). |
| + | Indicates that the preceding expression matches one or more times (for example, [0-9]+ matches "1", "13", "666", and so on). |
| * | Indicates that the preceding expression matches zero or more times. |
| ?? +? *? | Non-greedy versions of ?, +, and *. These match as little as possible, unlike the greedy versions which match as much as possible. Example: given the input "<abc><def>", <.*?> matches "<abc>" while <.*> matches "<abc><def>". |
| ( ) | Grouping operator. Example: (\d+,)*\d+ matches a list of numbers separated by commas (such as "1" or "1,23,456"). |
| { } | Indicates a match group. The actual text in the input that matches the expression inside the braces can be retrieved through the CAtlREMatchContext? object. |
| \ | Escape character: interpret the next character literally (for example, [0-9]+ matches one or more digits, but [0-9]\+ matches a digit followed by a plus character). Also used for abbreviations (such as \a for any alphanumeric character; see table below). If \ is followed by a number n, it matches the nth match group (starting from 0). Example: <{.*?}>.*?</\0> matches "<head>Contents</head>". Note that in C++ string literals, two backslashes must be used: "\\+", "\\a", "<{.*?}>.*?</\\0>". |
| $ | At the end of a regular expression, this character matches the end of the input. Example: [0-9]$ matches a digit at the end of the input. |
| | | Alternation operator: separates two expressions, exactly one of which matches (for example, T|the matches "The" or "the"). |
| ! | Negation operator: the expression following ! does not match the input. Example: a!b matches "a" not followed by "b". |
| \a | Any alphanumeric character: ([a-zA-Z0-9]) |
| \b | White space (blank): ([ \\t]) |
| \c | Any alphabetic character: ([a-zA-Z]) |
| \d | Any decimal digit: ([0-9]) |
| \h | Any hexadecimal digit: ([0-9a-fA-F]) |
| \n | Newline: (\r|(\r?\n)) |
| \q | A quoted string: (\"[^\"]*\")|(\'[^\']*\') |
| \w | A simple word: ([a-zA-Z]+) |
| \z | An integer: ([0-9]+) |
Simple example
First, setup the
Refresh Rate to 2 seconds and save. It will be easier to see the results.
The simplest way to use g15web is to display a whole Internet file. For example, you are working on a server and you want to display some server data. You'll create a php file or whatever on the server that will only display raw texts. In this case, you only have to enter the url of this webpage and it works.
For a demonstration, I have created a dumb php script that display some values at the url:
http://www.ploki.info/g15web/test1.php
Just copy paste this url in the
URL field of the
Line 0, click
Test and you should see the date of the day.
If you click on
Save button, you should see the result directly on the lcd screen.
Second simple example
If you still have a server and want to display more than 1 line of information in the same file, you can, you just have to put some
\n in the php script. In this case, it'll move to the second and third line of the screen. If you put one carriage return, in this case the
Line 0 will take 2 screen lines and the
Line 1 will be displayed on the third line and you'll not see the
Line 3.
Copy the url in the
Line 0 and you'll see that all the three line are used with only one file:
http://www.ploki.info/g15web/test2.php
Third example
Imagine that you want to get your favorite webpage and extract an information from it. It's the hardest part because you need to use regular expression.
Let see how we can use this great tool to extract the number of threads in the
g15 forums
First, we have to enter the url in the
URL of the
Line 0:
http://www.g15forums.com/forum/
We can click on
Test button and we see that the content is lot too much for the lcd screen so we have to filter it. In this web page we see the part in the bottom of the page that contains what we want:
<div>
Threads: 2,986,
Posts: 24,679,
Members: 14,234,
<span title="Within the Last 30 Days">Active Members: 1,105</span>
</div>
We would like to get the
Threads 2,986. The regular expression is quite simple
Threads: [0-9,]+,\n. Basically, it means that we are looking for the text
Threads: followed by one or more number or virgule and then follow by one virgule and a new line. We now have to put some
{} around the block we want to extract. So the final regular expression is
{{Threads: [0-9,]+},\n.
Put this regular expression in the
Match and press
Test. You should get
Input is matching in the output. Wow! Great! It means that the regular expression was found on the webpage. But it's not what we want, we want to display the text! It's easy, just enter what you want to display in the
Output field. You just have to know that
$0 means the first extracted value. Since we have only one value, just put
$0 in the
Output field and press
Test and voila!
Imagine now that we don't want to get
Threads: text of the url because it is too big and we only want to display
T:2,986. In this case, we have to change the regular expression to say to only extract the number:
Threads: {[0-9,]+},\n. Press
Test and you'll see
2,986. You just have to put
T:$0 in the
Output and it's ok.
Imagine now that we want to extract the threads, posts and members. We will not create 3 lines with 3 times the same url, it will be too slow. We need to do that in only one line. So try the new regexp:
Threads: {[0-9,]+},\n\b+Posts: {[0-9,]+},\n\b+Members: {[0-9,]+},\n. It put in
$0 the number of Threads,
$1 the number of Posts and in
$2 the number of Members. You can setup the
Outputwith
$0 $1 $2 to display these values or
T:$0 P:$1 M:$2 to add a text. The good news is that if you want to display the members first, you just have to put
M:$2 P:$1 T:$0. Now if you want to use the 3 lines to display that, you just have to use the
\n token that do a new line.
Thr:$0\nPos:$1\nMem: $2 in the
Output will do that.
That's all for the sample. Now you have to try by yourself!
How to create some regexp without G15 keyboard?
It is possible, you just have to run the g15web executable with a parameter. To do that, you can create a shortcut, right click / properties on the shortcut. Now add "editor" after the executable and after the quote on the target field. Click OK and when you launch the shortcut you should see the configuration panel. When clicking on OK on the panel, it'll save and quit the application.
Some example of "useful" regexp
Nb pages from Google
Just replace
REPLACE with your work you want to search. Put a + for the space, for example if you search
my name use
my+name
Number of Threads Posts Members on g15forums
Get the 3 latest news from linuxfr
Made by Darky
- http://linuxfr.org/news/
- <h1 class="newstitle"><a href="[^"]*">[^<]+</a>\b:\b{[^<]+}</h1>.*?<h1 class="newstitle"><a href="[^"]*">[^<]+</a>\b:\b{[^<]+}</h1>.*?<h1 class="newstitle"><a href="[^"]*">[^<]+</a>\b:\b{[^<]+}</h1>
- $0\n$1\n$2
Display how many time g15web was downloaded
Do you have a good font?
I really like
proggy fonts
I have a question
If you have any questions, comments, or whatever related to g15web, post it on this
forum thread.
I want to share my regexp
You can post your own regular expressions on this
forum thread.