View Full Version : Is there a way to set up something like a cron/sched.task?
thorr
February 3rd, 2004, 09:46 AM
I am writing a Netremote interface for the Holo3D card, and when I change settings, it takes about 1 second for the Holo3D.ini file to show the new settings. These settings are then printed back to my PocketPC.
The problem is if I put a Wait command in before I show the new settings, I have to wait 1 second for each command sent. If I hold down a key, it will update the setting, wait, update the setting, wait,... and eventually it will stop.
What I want to do is be able to hold down a button, and let it update the setting very quickly. Separately I want Girder to automatically run my LUA script that updates the display on my PocketPC every few seconds in the background continuously. Is this possible?
Thanks,
Mike
Promixis
February 3rd, 2004, 11:52 AM
Mike,
Its not quite clear to me what you want to do. The winluaex plug can be used to generate an event when a file changes. You could use this event to then look at the file and update NR...
thorr
February 3rd, 2004, 12:43 PM
Mike C,
That sounds perfect! Can you provide some instruction how to use this function?
Something easy like this would be great:
Click here, type this, insert this code here...
Basically as you said, I would want something like:
File=c:\Holo3D.ini
When File Changes, Run Girder command with LUA Script in it.
Thanks again!
Mike
Promixis
February 3rd, 2004, 02:25 PM
Mike, I actually haven't used this function but the readme is pretty self explanatory. Give it a shot and post your results here. Once you get started I will try and give you a hand.
thorr
February 3rd, 2004, 03:28 PM
Ok, I gave it a shot, but I am not having any luck. I don't know where to put the code. I tried pasting the code from the Time Sample LUA file into the variable manipulation script inside a command and it worked. Then I tried the sample code from the latest winluaex version readme for the folderwatcher and it just crashes Girder.
-- Create a folder watcher and save it in the global variable fw
fw = WINDOWS_CreateFolderWatcher("EventString", "C:\\", 1, 0)
-- print a folder watcher
fw:print()
-- Destroy a folder watcher
fw = nil
I also tried putting one of the sample LUA files in a newly created LUA directory inside the Girder directory, but it didn't do anything.
I don't understand how this is going to work yet either. Does the folder watcher run all the time, or just when I tell it to inside a script?
I am completely lost. Any help you can provide would be greatly appreciated. Thanks.
Promixis
February 3rd, 2004, 08:07 PM
Okay, I have a working demo for you. PM me you email address.
thorr
February 3rd, 2004, 10:15 PM
Got it. Thanks a lot! I will let you know if I have any further questions. :)
thorr
February 4th, 2004, 09:45 PM
Mike,
Thanks again for the file. I got it to work, but it seems that the latest winluaex.dll is required, and when I install this, netremote breaks. :(
So, basically one or the other works depending on which dll I use.
Mike
Promixis
February 4th, 2004, 10:04 PM
Hm, I wonder if there could be variable conflict between scripts....
Does it break with or without the FW example loaded.
thorr
February 4th, 2004, 10:16 PM
I just tried again without the FW script and still have the same problem. Netremote works, but the feedback part does not. To see this, just load the feedback test and try to send a label.
thorr
February 5th, 2004, 05:48 PM
Mike, Thanks for your help. Everything is working perfect now. I had to install LUAevents 1.0.1.
The FileWatcher script is working perfect. This is great!!!
Thanks again.
Mike
Wabiloo
July 8th, 2004, 01:01 PM
Mike, could you possibly send me the same code?
I'm struggling as well with making it work. I cannot quite understand where I'm supposed to store the script that sets the FolderWatcher, since, as is said in the documentation for WinLua Ex:
NOTE: The returned FOLDERWATCHER object will be destroyed (no more events generated) if the variable containing it goes out of scope (is destroyed). If you want a FOLDERWATCHER object to survive the life of a subroutine,do not leave it in a local variable!
So, adding it to an event with Variable Manipulation Script surely isn't the right way to do it.
Thanks in advance
Promixis
July 8th, 2004, 01:38 PM
No, you can declare the variable in a script from an event.
It wouldn't work if
function x ()
local y
y = folderwatcher...
end
x ()
Then variable y would go out of scope at the end of the function call.
Wabiloo
July 8th, 2004, 01:44 PM
But how would I trigger that event?
Do I put it in a command that gets triggered onGirderOpen?
I already have a command with onGirderOpen, can I have more than one?
Promixis
July 8th, 2004, 01:51 PM
OnGirderOpen and AfterScriptReset events should be linked to the code.
And yes, you can have as many of these as you like.
Wabiloo
July 8th, 2004, 02:03 PM
I have a very simple LUA script
fw = WINDOWS_CreateFolderWatcher("FWchange", "c:\\foo.ini", 16, 0)
in a command FolderWatchStart, and tiggered by GirderEnable
If I try to "Test Command" or enable Girder, Girder (3.3.1b) crashes horribly.
:-( any reason for that behaviour?
Wabiloo
July 8th, 2004, 02:15 PM
Ah, it seems that it is because I pointed to a file, rather than a folder...
Ah annoying. Is there a way to watch a particular file rather than the folder that contains it? I don't want to receive 5x the same event because five files get changed...
Promixis
July 8th, 2004, 02:52 PM
I believe the folderwatch will work with files...
Promixis
July 8th, 2004, 02:52 PM
Also, please upgrade to 3.3c
VaioUserChris
July 23rd, 2004, 12:47 AM
Ok Mike,
I've tried and tried to get the folder watcher to work and I can't get it to do a thing. I'm sure I'm doing something wrong here.
Basically, I'd like to watch a folder to see if a file has been dropped into it. The folder is at "C:\Program Files\girder\TVPI Muncher"
For testing purposes I'd like to trigger the XP OSD when the folder changes, which I have given an event string of "FWEVENT"
And here's the code I've tried in a LUA script:
fw = WINDOWS_CreateFolderWatcher("FWEVENT", "C:\\Program Files\\girder\\TVPI Muncher", 16, 0)
I then test the script by dropping files into the "TVPI Muncher" folder (which changes the file's last write date/time) but I can never get the FWEVENT to trigger.
Can you tell me what I'm doing wrong?
Chris
Promixis
July 23rd, 2004, 06:59 AM
Chris, you have to make sure that you "run" that script to start it. So you can link a GirderLoad event to that script or to test it, press F5 or the play button.
VaioUserChris
July 23rd, 2004, 10:40 AM
I'm sorry, I left a step out. After writing the script I have tried to run it three ways - from within the Lua editing window, using the test command from the tree, and by assigning it a "On Girder Open" event. Then I've tried to drop files into the applicable folder but seen no event triggered no matter how I run it.
By the way, I'm running Microsoft XP Home SP1 in case that matters.
I've separately tested FWEVENT to make sure that I set it up properly and the XP-OSD does activate, just not from my folderwatcher script.
How do I use this folderwatcher command? Do I run the script once and then it continually monitors the folder for me until I destroy the folder watcher?
Chris
Promixis
July 23rd, 2004, 11:16 AM
Change the 16 to 31 ...
VaioUserChris
July 23rd, 2004, 09:28 PM
Hi Mike,
Thanks for the suggestion. I made the change but I'm still having no luck - I'm still not getting FWEVENT to trigger. Here's the new code:
fw = WINDOWS_CreateFolderWatcher("FWEVENT","C:\\Program Files\\girder\\TVPI Muncher", 31, 0)
But I may have a clue. I ran the logger and it shows that the watcher is indeed generating events when I drop something into the file, however the device number seems odd - here's what I get:
EVENT: Dev: 220 FWEVENT Pld1: C:\Program Files\girder\TVPI Muncher
The odd thing is that when I trigger the FWEVENT using the trigger event command, I get an entirely different device number:
EVENT: Dev: 18 FWEVENT
Am I supposed to be getting a device number of 220 from the folderwatcher event?
Chris
Promixis
July 23rd, 2004, 09:42 PM
Yes, I guess it is 220. When you learn the event chose Winluaex event and type in the event string..
Hm, I always assumed it was 18 too.
VaioUserChris
July 24th, 2004, 02:13 PM
Thank you Mike. That worked!!!! I really appreciate your patience.
This is really odd thought. I guess we don't have to specify a valid eventstring in the Folderwatcher command since it can't trigger the eventstring with device 18. But the Winluaex event worked like a charm.
Should I report this anomoly to Mark? (FYI, I confirmed that I am running the most current version of the plugin - 1.0.9)
Chris
Promixis
July 24th, 2004, 04:20 PM
Chris, I am sure that Mark intended it to work this way... You can specify the eventstring or just any winluaex event.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.