View Full Version : Issue with windows - system variable
volker2035
November 22nd, 2006, 08:51 PM
Hi to all,
during the lasst weeks I made my first steps with Girder and Netremote trying to control my Home Cinema equipment and additionally the lights (controled by RF using parts from ELV (germany)).
Since a few days I'm trying to work with a windows system-variable within girder in order to switch between different disk on which my executables are located. The issue is now, that I can't find any hint how to use these variables within a file execution action. I'm trying to do it the "normal" way - so:
I created a "File execution" action and as the file name to execute I defined %MYHKLW%\Heimkino\Funkhaussteuerung\Batchdateien\F HZCommandSet.bat
MYHKLW is defined as "L:". And yes, the file exists ;)
The result in the Logger:
Girder Shell Execute Failed:1(VMYHeimkino.gml:\\FHZCommandSET)
The amazing thing is, that the error message does only include the name of the bat-file, but not the path and nor the disk-drive. What am I'm doing wrong ?
I allready searched and read throughout the forum for a couple of days now, I searched through the documentation - but, I can't find a solution. Maybe somebody can help me with this issue.
Thanks in advance and best regards from germany.
Volker
Rob H
November 23rd, 2006, 12:32 AM
In the file execute action use [ and ] rather than % to surround the variable name.
volker2035
November 23rd, 2006, 12:54 AM
Hi Rob,
I tried it and it ends up in the same result.
Any other idea ?
Thanks and best regards
Volker
Rob H
November 23rd, 2006, 01:31 AM
What do you have now as the File execute string? And what error do you get?
volker2035
November 23rd, 2006, 01:43 AM
it is the same error message as it was before:
Girder Shell Execute Failed:1(VMYHeimkino.gml:\\FHZCommandSET)
Volker
Rob H
November 23rd, 2006, 01:47 AM
But what does the execute string look like now?
Rob H
November 23rd, 2006, 01:50 AM
And can you type the following in the interactive Lua console and show me the output
print(MYKHLW)
Hmm.. is it MYKHLW or MYHKLW? You seem to have both in your original message.
volker2035
November 23rd, 2006, 02:30 AM
But what does the execute string look like now?
%MYHKLW%\Heimkino\Funkhaussteuerung\Batchdateien\F HZCommandSet.bat
(sorry, there was a misstyping in my first post; MYHKLW is the right one)
In addition, SET in a DOS-Command Box shows, that MYHKLW is defined and the value is L:
Best regards
Volker
PS: I also tried [MYHKLW]\Heimkino\Funkhaussteuerung\Batchdateien\FHZComman dSet.bat - same result !
volker2035
November 23rd, 2006, 02:32 AM
And can you type the following in the interactive Lua console and show me the output
print(MYKHLW)
Output is nil
Hmm.. is it MYKHLW or MYHKLW? You seem to have both in your original message.
as I wrote before - misstyping in my first post !
btw: Thanks for your help !
best regards
Volker
Rob H
November 23rd, 2006, 03:37 AM
Ah, sorry, now I see what you're trying to do - MHKLW is a DOS environment variable rather than a Girder variable.
In that case just add a simple batch file somewhere that calls the real batch file using the %
volker2035
November 23rd, 2006, 04:06 AM
Hi Rob,
thank's for the hint and sorry that my english is maybe the source for the missunderstanding !
Just curious - isn't it possible to work with these system variables from DOS/Windows ? I saw one file execution action within the Windows Media Center 2005 GML (within the group "start") working with "%WINDWOS%" and I thought this is refering to a windows/dos SET-variable ?
Thanks again and best regards
Volker
volker2035
November 23rd, 2006, 04:35 AM
...and again
I checked again the Actions reference within the Girder Help. Under "File Execution Action" it is written:
2. Command line symbols are expanded if available. For example "%GIRDER%designer.exe" starts the Girder DUI designer.
If I interpretate it correctly, "%MYHKLW%\Heimkino\Funkhaussteuerung\Batchdateien\F HZCommandSet.bat" should work, but it doesn't.
In addition I tried the following:
I added a little script with only 1 line:
myhklw = "L:"
a "print(myhklw)" does give me the output "L:" - seems to be good. The variable inspector gives me the same answer.
Now I tried the file execution with:
[MYHKLW]\Heimkino\Funkhaussteuerung\Batchdateien\FHZComman dSet.bat
and still - the same error message: Girder Shell Execute Failed:1(VMYHeimkino.gml:\\FHZCommandSET)
Any comment or hint from your side ?
The background is, that I have my computer at home, all necessary files are on the C-Drive. The development of my project is mainly done with a notebook, files stored on an USB-Stick (L-Drive). Therefore, I need a dynamic assignment of the drive-letter.
Thanks in advance
Volker
Rob H
November 23rd, 2006, 04:37 AM
Looking at the example in the manual which refers to %GIRDER% I don't think that this refers to environment variables as such, but a limited set that is similar to the parameters to the win.GetDirectory() function. This uses the gir.ParseString() function.
Rob H
November 23rd, 2006, 04:38 AM
Lua (ie Girder) variable names are case sensitive so myhklw is not the same as MYHKLW
volker2035
November 23rd, 2006, 05:50 AM
Lua (ie Girder) variable names are case sensitive so myhklw is not the same as MYHKLW
o.k. - this is solved now - the file execution is working. Tank you very much !
But (I'm sure, you allready assume it ;-) I have the next question (please keep in mind, that I'm a beginner with Girder and LUA - be patient with me):
Within the forum I found a hint for the function "readfrom" to check if a file is available or not. With help of this function I'm trying to fill up now my "MYHKLW" variable:
MYHKLW = "C:"
if readfrom("l:\\heimkino\\zeigerdatei.txt") then
MYHKLW = "L:"
end
readfrom()
The scripting action is linked to the event "GirderOpen" and it is executed - but I receive the error message
[string "VMYHeimkino.gml:\Startup\WennGirderStartet\..."]:2: attempt to call global `readfrom' (a nil value)
I'm pretty sure that I have missed something that Girder (lua) is'nt able to find execute "readfrom" - but I don't know what. Maybe you have an additional hint for this one for me ?
Thanks again
Volker
Rob H
November 23rd, 2006, 06:06 AM
Use win.FileExists() to check if a file exists.
volker2035
November 23rd, 2006, 06:33 AM
Rob - I have a big smile in my face :)
Thank you very much for your help.
Volker
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.