Jump to content

Is this feasible for a script?


Recommended Posts

  • Moderators

rds_correia,

Are you at least seing a list of "File: File_name" lines? :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

rds_correia,

The only box that opens is the one that says "all files dealt with".

There are no other dialogs - the data appears in the lower pane of SciTE. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I'm running the portable version of AutoIt (the self extractable zip).

Therefore, I run a script by running AutoIt3.exe and then I open the desired script.

Does SciTE run, when I execute a script via AutoIt3.exe?

Or do I need to open SciTE manually?

SciTE is a text editor/IDE, right?

Cheers

Link to comment
Share on other sites

  • Moderators

rds_correia,

SciTE is the editor which is installed with Autoit - but as you have not installed it...... :oops:

You are missing a lot - the full version od SciTE4AutoIt3 which you can download here offers lots of extra goodies to help you code in AutoIt. But I believe you need to have both SciTE and AutoIt installed for it to give you full functionality. :rip:

Try this version which only uses MsgBox dialogs: :)

#include <Array.au3>
#include <File.au3>
#include <Date.au3>

Global $sRoot = "C:surveillance"
Global $aPath[5] = [4, "580001", "000", "00", "00"]
Global $sCamera_ID = "323"
Global $sYesterday = StringReplace(_DateAdd("D", -1, @YEAR & "/" & @MON & "/" & @MDAY), "/", "-")
Global $sBefore_Yesterday = StringReplace(_DateAdd("D", -2, @YEAR & "/" & @MON & "/" & @MDAY), "/", "-")

; Find last folder
$aFolder_List = _Last_Folder($aPath)

; Work backwards through the folder list
For $i = $aFolder_List[0] To 1 Step -1
    ; Read the list of files in this folder
    $aFile_List = _FileListToArray($aFolder_List[$i] & "", "*.xml", 1)

    ;_ArrayDisplay($aFile_List, $aFolder_List[$i])

    If IsArray($aFile_List) Then
        If _Check_Files($aFile_List, $aFolder_List[$i]) Then
            ; We have reached the files from 2 days ago
            ExitLoop
        EndIf
    Else
        ; There are no files to check - this should never happen
        ExitLoop
    EndIf
Next

MsgBox(0, "Done", "All files from " & $sYesterday & @CRLF & "taken by camera " & $sCamera_ID & @CRLF & "have been dealt with")

Func _Check_Files($aArray, $sPath)

    ; Clear the "day before yesterday" flag
    $fEnded = False

    For $i = $aArray[0] To 1 Step -1

        ; Read the content of the file
        $sFile_Content = FileRead($sPath & $aArray[$i])
        ; Is it the correct date
        $aDate = StringRegExp($sFile_Content, "(?i)(?U)starttime>(.*)x20", 3)
        Switch $aDate[0]
            Case $sYesterday
                ; Is it the correct camera
                $aCamera = StringRegExp($sFile_Content, "(?i)(?U)servicename>(.*)<", 3)
                If $aCamera[0] = $sCamera_ID Then
                    ; Extract the .avi name
                    $aAVI = StringRegExp($sFile_Content, "(?i)(?U)filename>(.*)<", 3)

                    ; And display the data
                    MsgBox(0, "Action needed", _
                    "File: " & $sPath & $aArray[$i] & @CRLF & @CRLF & _
                    "Avi: " & $sPath & $aAVI[0] & @CRLF & " could now be copied")

                EndIf
            Case $sBefore_Yesterday
                ; Set the flag
                $fEnded = True
                ; No point in going back further
                ExitLoop
        EndSwitch
    Next

    Return $fEnded

EndFunc

Func _Last_Folder($aPath)

    ; Create an array to hold the list of folders found
    Local $aFolders[100] = [1, $sRoot & _ArrayToString($aPath, "", 1, 4) & ""]

    While 1

        ; Add 1 to the folder and reset to 00 if needed
        $aPath[4] = StringFormat("%02i", Mod($aPath[4] + 1, 100))
        ; If we did reset to 00 then we need to check the level above
        If $aPath[4] = "00" Then
            ; Again we add 1 and reset to 00 if required
            $aPath[3] = StringFormat("%02i", Mod($aPath[3] + 1, 100))
            ; And if we reset to 00 we need to check the level above
            If $aPath[3] = "00" Then
                ; Add 1 but this time we reset to 000 if required
                $aPath[2] = StringFormat("%03i", Mod($aPath[2] + 1, 1000))
                ; And again we move up a level if the lower folder was reset
                If $aPath[2] = "000" Then
                    ; If this one gets to 589999 then you need to restart - or add another level to this tree!
                    $aPath[1] = $aPath[1] + 1
                EndIf
            EndIf
        EndIf

        ; Now see if this path exists
        $sNext_Path = $sRoot & _ArrayToString($aPath, "", 1, 4) & ""
        If Not FileExists($sNext_Path) Then
            ; If the path does not exist then we return the list of folders found
            ReDim $aFolders[$aFolders[0] + 1]
            Return $aFolders
        Else
            ; The folder exists so add it to the array - resizing if necessary
            $aFolders[0] += 1
            If UBound($aFolders) <= $aFolders[0] Then
                ReDim $aFolders[$aFolders[0] * 2]
            EndIf
            $aFolders[$aFolders[0]] = $sNext_Path
        EndIf

    WEnd

EndFunc

Do you get the results now? :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

rds_correia,

Yeah!! It works

Good - I was getting a bit worried there for a minute! :rip:

Yes, you have the full file path and name with $sPath & $aAVI[0] and you can use FileMove to get it where you wish. :D

Good luck with the GUI wrapper - as I said before, you know where we are if you run into difficulties. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

rds_correia,

Because I try to follow these coding guidelines in all my AutoIt code. :D

But be aware there is a new version coming out soon which will offer more comprehensive advice. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 3 months later...

Hi Melba23,

I have been using your script above with a lot of success.

But now the cameras will start recording to a local PC instead of recording to a centralized PC server.

We've been having some issues with some cameras and tech support says that way the cameras will work better.

Only issue is I have tried your script using:

Global $sRoot = "\\ip_of_the_local_pc\surveillance\"

But now it doesn't work.

Not even if I map that network path.

Can you give me a hand with this?

Thanks in advance.

Cheers

Link to comment
Share on other sites

  • Moderators

rds_correia,

I am afraid I know next to nothing about networks. I suggest you start a new thread and seek the help of someone who does. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Why not run a script on each local PC that copies all the files to your central computer?

If you use the original script you could modify it to sort the files by camera before sending them.

Or it could just send them all as they come, and work as previously with your script separating them out by camera and date on the central computer.

William

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...