Need help writing a script for work

vbimport

#1

I’m not sure if this is the proper forum to add it to, but I have a quick question for all of you who know a little bit of ‘programming’ or even basic scripting. :confused:
First off, my boss bought those crappy ass X10 cameras to use as a ‘security system’… yeah
Using the software, the cameras take one picture per cycle (say one PICTURE every 5 seconds, so a cycle would be 20 seconds). The pictures are then thrown into a directory with random filenames. What he wants me to do is to display these on an internal ‘web page’.
What I’m looking to do is to take the latest file written into the directory and move it to the website’s directory. I want to just rename it then to a generic name that the website will link to.
What I can’t figure out how to do is to move and rename the files by the modified time. If anyone can halp me out, it would be greatly appreciated!!:bow:


#2


Using the software, the cameras take one picture per cycle (say one PICTURE every 5 seconds, so a cycle would be 20 seconds).

Four cameras? Please provide more info about your security system.


The pictures are then thrown into a directory with random filenames.

This does not make sence. There must be some pattern to names of files. The software must (or should be) using some kind of nameing convention for the files. Can you post the names of files that have been produced so far? If there are toomany then a sample from last 1 or 2 minutes would do.


What he wants me to do is to display these on an internal ‘web page’. What I’m looking to do is to take the latest file written into the directory and move it to the website’s directory.

You may be able to automate this with Widnows Task Schedualer to do this.


I want to just rename it then to a generic name that the website will link to.

In VB, you should be able to do this with


What I can’t figure out how to do is to move and rename the files by the modified time.

In VB, you can use FileSystemObject to copy and move file(s). Also look into “Name Statement”, which allows you to rename a file. The trickey part is the finding the files you want. DateLastModified method should help you with this. Also look into DateCreated. Files Collection, Files property can be used to get list of files in a directory.

[/B]
If anyone can halp me out, it would be greatly appreciated!!:bow: [/B]

You may be able to use JavaScript or VBScript to load images based on modified (or created) date/time propery. So you don’t have to do all the copy and rename and schedualing.


#3

First off, I love how my post says ‘wrong forum! moved here’ when i started it in this forum :slight_smile:

Ok - It is not really a very good security system - it’s a pile… my boss is just an imbecile. He purchased cameras from X10.com and expected them to be a ‘cheap and efficient’ security system.
The cameras are ‘wireless’ (despite the long wire running from the outlet to the camera…) and are each assigned a specific number.
The software used is crap - the timing is always off and it never takes good quality pictures (it tends to leave another camera switched on therefore causing interference)

Here is a what I have figured out from their filenames:
[B]164210433_0000_0000000000000000_lab1.jpg

16 = Hour + 5
42 = Minute
10 = Number which increments by the set ‘second’ interval between captures, with each new picture file - Most likely just the
‘seconds’ number at the specific time
433 = ??? In most cases, number increases by 13 ??? May be the up time for the camera - they tend to overlap for a few
seconds, so basically impossible to preconcieve
_
0000 = Camera number (Last number is 0, 1, 2, 3)
_
0000000000000000 = String of 16 0’s - always present, not sure why
_
lab1 = Assigned camera name
.jpg = File extension[/B]

I called their tech support to ask about the filename - they told me they’d email me about how I could maybe ‘change’ the renaming method… here’s their response:

[B]I got an answer for you. Unfortunately it may not be one you prefer, but it is the only one I am permitted to give. The algorithm used to name the image files is proprietary and as such, we are not able to provide you with that information.

In reference to the question you gave me over the phone, there is no way to alter the names that the software assigns.

Sorry I can’t provide you with more useful information.[/B]

In other words, I don’t know what it does and I won’t help you because our software is crap.

So basically what I would like to do is take the last modified file and rename it according to the 4 character name it has at the end of the file (lab1 in this case) and throw it into a folder for viewing with a standard webpage
Unfortunately, I do not know and VB or JS so I’m unable to figure this out on my own. Our in house programmers are to bogged down with other projects to help me out so I’m kind of stuck. If somone could even write a basic script for me and send it to my email, I would appreciate it sooo much (They need it soon because I’m leaving for school in 6 days).
Thanks again


#4

Is there a way to direct these jpg’s toward a specific folder? Are they going to a folder now with no other jpg’s? Because if so you can just try looking for freeware or consider first writing a script to search for files using a wildcard type method of finding all *.jpg files. Also, a followup script to automatically grab them from a directory you can always adjust by date/time created for latest uploads. Or cycle them, because I don’t think your boss wants these from a week ago or further.


#5

i duno much (anything) about scripting :(. what i would do, though, if i could do this with something i knew, is first shorten the filename. you know how many leading characters u dont need - just filter them out. easy enough?

then, have your script execute a batch file based on the new filename, or maybe do it itself, as im sure thats possible too. should be a little move command or something simple like that.

im sure there are more efficeint methods.