Welcome, Guest
Please Login or Register.    Lost Password?

Using system data within Rainlendar
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Using system data within Rainlendar
#24828
Using system data within Rainlendar 1 Month, 1 Week ago  
Hi,

I'm trying to get some system information displayed in Rainlendar.
Since the system access from Rainlendar is limited, my idea was
- to execute a system script from within Rainlendar,
- which fills variables in Rainlendar to be able to display them in my skin.

My first problem is, I'm not able to execute an external script in background. I'm using Windows 10 and using "os.execute" will raise a command line window. "Rainlendar_Execute" doesn't open a command line window, but can't be used to execute scripts.

My second problem is, if I run the command Rainlendar2 --execute My_Function("bla") from my external script, to get the information "bla" to Rainlendar, the variable, which should contain "bla" seems not to be populated, it's nil.
Setting an environment variable within the system script and reading it with "os.getenv" doesn't work either, because it won't be contained in Rainlendar's process, but in the process triggering Rainlendar2 --execute

Has anyone a smart idea, how to get some (non-static) system data into Rainlendar?
BigMike
Junior Boarder
Posts: 30
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#24829
Re:Using system data within Rainlendar 1 Month, 1 Week ago  
What kind of system information do you want?
I can get / show all the environment variable values.
You can try to create a lua file and put it in Rainlendar's scripting folder and then call it.

my.lua example:

function getenv()
env = os.getenv("SystemRoot")
Rainlendar_Message(env, 4)
end
keepstudy
Expert Boarder
Posts: 132
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Taiwan
Last Edit: 2017/12/11 11:17 By keepstudy.
The administrator has disabled public write access.
Native Language: Chinese
Email: jhg5702@hotmail.com
 
#24830
Re:Using system data within Rainlendar 1 Month, 1 Week ago  
Yes, this works, as SystemRoot is a global variable, which is already present in the shell context in which Rainlendar itself is executed.

I've tried exactly what you proposed (except I used USERNAME...) which works fine.
But basically the plan is to show some basic system information in a Rainlendar window. I thought I can gain this by exectuting a PowerShell script from time to time, which collects the information and updates the corresponding variables in Rainlendar:

For example free space on drive C:
Code:

$env:DiskFree = Get-PSDrive | ? {$_.Name -like "C"} | Select -ExpandProperty Free
puts the value in the environment variable "DiskFree".

First I tried to pass the free space directly with a LUA function
Code:

Rainlendar2.exe --% --execute DiskCFree($env:DiskFree)


Code:


function DiskCFree(space)
 Rainlendar_Log(""..space)
end


This returns an error, since space seems to be nil
Afterwards, I tried:
Code:


function DiskCFree()
 space=os.getenv("DiskFree")
 Rainlendar_Log(""..space)
end


The result is the same.
BigMike
Junior Boarder
Posts: 30
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#24832
Re:Using system data within Rainlendar 1 Month, 1 Week ago  
Ok, I found a workaround for the data exchange.
I'm writing the information to a file and read and parse it within Rainlendar.

Actually, it would be much easier to be able to pass parameters with
Code:

Rainlendar2 --execute function(param1, param2, ...)


Also, instead of triggering the execution of the external script from within Rainlendar, I'm using a scheduled task now.
BigMike
Junior Boarder
Posts: 30
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop