Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: Some Help Pls, with Deleteing files

  1. #11
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Thank for fixing that Dan. I was quickly putting that together from some old code I had around and didn't test it

  2. #12
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    That's ok it was pure luck really... I know nothing

    Now I am having probs sending an event from the script to girder, I used the code in the sticky post, but that does not work...

    my code is:-

    line 29 function goto_which_girderevent ()

    line 31 GirderEvent = wscript.CreateObject("Girder.GirderEvent")
    line 32 GirderEvent.Device = 18;
    line 33 GirderEvent.EventString = ("not");

    line 35 GirderEvent.Send();


    line 38 end


    the error's are:-

    error: attempt to index global `wscript' (a nil value)
    stack traceback:
    1: function `goto_which_girderevent' at line 31 [string "?"]
    2: main of string "?" at line 43


    I am lost again, tried searching for other example but I can't find any at the moment on the forum.

    So if you have any time I wonder if you could tell me what I am doing wrong.

    Part of my problem I beleive is that I do not understand the error msg's. Is there any kind of explaination anywhere?

    Cheers

    Dan

  3. #13
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Well I figured it out

    Here is the code I used

    --Function to Detect Files size
    --Function detect_file_size (which_file)

    UnloadLuaCom ()
    LoadLuaCom ()

    -- Detect the file Size First

    function detect_file_size (which_file)

    fso = luacom.CreateObject ("Scripting.FileSystemObject")
    file =fso:GetFile(which_file)
    file_size = (strsub(file.size,1,3))
    fso = nil
    collectgarbage ()
    return file_size
    end

    -- If the File Size is Over 4.7Gb Set Event to Run Correct Girder Event

    function run_rejig (file_size)

    if ( file_size > "4200" ) then print("Run Rejig") doit = 1
    else print("Don't Run Rejig, Your File is " ..file_size .."Mb") doit = 0
    end
    if ( doit == 1 ) then event = "do"
    else event = "not"
    end
    return doit
    end

    -- Send the Event To Girder depending on the file size from above

    function WMICreateProcess (strComputer,Process)


    local objWMIService,objProcess,result
    strComputer = strComputer or "."
    objWMIService = luacom.GetObject ( "winmgmts:{impersonationLevel=Impersonate}!\\\ \" ..strComputer.."\\root\\cimv2")
    objProcess = objWMIService:Get("Win32_Process")
    result = objProcess:Create (Process,nil,nil,nil)
    objProcess = nil
    objWMIService = nil
    collectgarbage ()
    return result
    end


    detect_file_size ("e:\\Newsround-156027-0.mpg")
    run_rejig (file_size)
    WMICreateProcess (".",'"C:\\Program Files\\girder32\\event.exe "' ..event ..' -silent')

    UnloadLuaCom ()

    I am not a programmer so am quite clueless, but it works

    I used most of it from your examples so cheers

    Dan

  4. #14
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Cool, you are making good progress!

    You have gone the round about way to send an event to Girder

    Just use the lua command...

    TriggerEvent ("eventname",18)


    Mike

  5. #15
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Cool Thanks

    I was looking for that, but the only way I could figure it out was how I did it, It now looks alot simpler!!!

    Now, to bug you some more, how can I rename a file?

    I am trying to get
    object.Name [= newname]

    to work but i will not I am using this code

    -- Rename file for rejig use

    function rename_file ()

    fso = luacom.CreateObject ("Scripting.FileSystemObject")
    fname = fso:GetFile("e:\\temp\\demuxed.mpv")
    fname.name = ("e:\\temp\\rejigdemux.mpv")
    fso = nil
    collectgarbage ()
    end

  6. #16
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    What happens - error or it doesn't work?

    Maybe google on how to use the FSO.

    http://www.15seconds.com/issue/000816.htm ?

  7. #17
    Join Date
    Dec 2001
    Posts
    11,560

  8. #18
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    And since you may want to know disk space
    Code:
    fso = luacom.CreateObject("Scripting.FileSystemObject")
    d = fso:GetDrive(fso:GetDriveName("c:"))
    print (d.TotalSize)

  9. #19
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Well I Suppose I could use that to check there is enough disk space to transcode the video and burn it!!!

    Thanks for the links I will look at the this evening.

    Dan

  10. #20
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Well Mike, I have to thank you for your support, I have done it.............

    Thank godness

    Now I need to get another licence for my girder to put the latest version on my HTPC, I don't think the old freewear version will support luacom?

    Would I beable to get it at the 2 licence rate?

    Cheers

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •