Sign in to follow this  
Followers 0
Xenos

Simple Script

4 posts in this topic

Hey gang! Love this product!

Ok I need to script the following:

I have a 3 mapped drives with UNC paths. On the mapped drives is a heirarchy I can hard code to a sub folder level. Then I need to open the folder with todays date (possibly any date I specifiy) and search all the files inside (all are .txt files) for keyword "Error:"

So I need to launch the script, get the number of days I would like to script to run as user input, search for 1 or 2 "Days" based on what the user puts in the input box.

Anybody out there a super pro at this stuff who feels like guiding this newbie?

Cheers

Share this post


Link to post
Share on other sites



I guess this also might help - I have several searches I want to bundle into this script. So I will probably hard code several UNC paths in the top of the script as variables. So I have 2 different server sources, then inside each server I have 4 or 5 different company sub folders - THEN inside of of these subfolders is a folder called Logs.

Logs folder basically just puts a new folder everyday for todays log files. This is the folder I have to search all the contained files for "Error:"

Same search will be run in every Logs folder, over 5 or 6 parent folders, over 2 different servers.

Thanks again!

Share this post


Link to post
Share on other sites

I am not a Pro at it but i seen something like this before

$InputBox = InputBox(ect...)

Do

" all of the things you want it to repeat for the amount of time that is set from the input box."

Until @HOUR&@MIN = $InputBox

You will have to fill in the details and the the info from the inputbox has to be in the right format. This should run until the time on your computer = the time set in the input box.

I hope this helps.


.

Share this post


Link to post
Share on other sites

Hey gang! Love this product!

Ok I need to script the following:

I have a 3 mapped drives with UNC paths. On the mapped drives is a heirarchy I can hard code to a sub folder level. Then I need to open the folder with todays date (possibly any date I specifiy) and search all the files inside (all are .txt files) for keyword "Error:"

So I need to launch the script, get the number of days I would like to script to run as user input, search for 1 or 2 "Days" based on what the user puts in the input box.

Anybody out there a super pro at this stuff who feels like guiding this newbie?

Cheers

<{POST_SNAPBACK}>

This won't be hard to implement. Just do some reading on

FileExists

FileFindFirstFile

FileFindNextFile

_FileReadToArray

FileGetTime

StringInStr

If I understood you correctly, you wanted to look in a folder called "Logs" and find another folder with a certain date. Once you have the date range you can use FileExists to check your folders using a loop. Once you have identified the folders you need to check, you can then use FileFindFirstFile and FileFindNextFile to get the names of the files you will search. To search the files I'd use _FileReadToArray and StringInStr to find "Error:" Once you have a match for you string search you can then do what ever it is you need to do at that time.

If I misunderstood and you don't have a sub folder in "Logs" you will only be searching for files in a date range in that folder and you can use FileGetTime when you do your FileFindFirst and FileFindNextFile.

All these commands have good examples in the help file.


Kerby

Share this post


Link to post
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
Sign in to follow this  
Followers 0