Newbie needs help setting system variables

nnCron and nnCron LITE discussion

Newbie needs help setting system variables

Postby fade » Sat, 08 Jul 2006, 19:47

Hello to all!

I'm trying to set 2 variables SCREEN_WIDTH & SCREEN_HEIGHT
each time the system starts, so I can write to the screen (using osd.spf) at pos
eg. SCREEN_WIDTH - 100, SCREEN_HIDTH - 100
The idea (which I don't know if it is possible) is
(...)
OSD-FONT: "Arial" 50 0x0000FF00
OSD-POS: %SCREEN_WIDTH% - 200 %SCREEN_HIDTH% - 100
OSD: "My Message..." 2000
(...)

I searched the help file and this forum for that matter and I found this...
So far, this is what I got (consulting the help file)
#( taskX
VARIABLE x
VARIABLE y
VARIABLE b
VARIABLE r
Action:
WIN-EXIST: "*Aston*"
IF
WIN-HWND WIN-RECT x ! y ! b ! r !
TMSG: "%FOUND-WINDOW% x=%x @% y=%y @% b=%b @% r=%r @%" 10
THEN
)#

which gives me in b and r the width and height respectively

The problem is that I'm not getting any luck in setting SCREEN_WIDTH...
How can i set SCREEN_WIDTH to b?
SYS-SET SCREEN_WIDTH=%b does not work

The examples present in the help file, only show how to set a var with a string value.
SYS-SET varname="string value" :(

Thanks in advance
fade
fade
 
Posts: 7
Joined: Sat, 08 Jul 2006, 18:54

Re: Newbie needs help setting system variables

Postby Valery_Kondakoff » Wed, 12 Jul 2006, 17:09

fade wrote:examples present in the help file, only show how to set a var with a string value.
SYS-SET varname="string value" :(


This is just because environvent variables are strings. But you can convert number to a string and then convert it back to a number when needed ( http://www.nncron.ru/help/EN/add_info/f ... htm#n_to_s )

The code
Code: Select all
OSD-POS: %SCREEN_WIDTH% - 200 %SCREEN_HIDTH% - 100
is wrong but you can rewrite it using postfix notation ( http://www.nncron.ru/help/EN/add_info/f ... tm#postfix )
CU
VK
User avatar
Valery_Kondakoff
Site Admin
 
Posts: 769
Joined: Thu, 01 Jul 2004, 20:49
Location: Moscow, Russia

Postby fade » Wed, 12 Jul 2006, 19:49

I've dropped the System Environment Variables idea in favor of normal
Variables as their scope's global too.
I've defined a simple task running at start time like this...
(If someone ever needs this here it is...)

# ------------------------ Get_Screen_Width_And_Height ------------------------
#( Get_Screen_Width_And_Height
\ NoActive
NoDel
AsLoggedUser LoadProfile
Time: START-TIME
VARIABLE e_screenWidth VARIABLE e_screenHeight
Action:
WIN-EXIST: "*Progman*"
IF
WIN-HWND WIN-RECT DROP DROP e_screenWidth ! e_screenHeight !
THEN
e_screenWidth FREE DROP
e_screenHeight FREE DROP
)#
# -----------------------------------------------------------------------------

As their scope is global, I can use e_screenWidth and e_screenHeight
in any task, in any tab file.

This is a simple example (OSD-POS postfix notation)
e_screenWidth @ 100 - e_screenHeight @ 100 - OSD-POS

Thanks again Valery_Kondakoff
fade
 
Posts: 7
Joined: Sat, 08 Jul 2006, 18:54


Return to nnCron forum (English)

Who is online

Users browsing this forum: Bing [Bot] and 1 guest