Jump to content

skysel

Active Members
  • Posts

    163
  • Joined

  • Last visited

skysel's Achievements

Prodigy

Prodigy (4/7)

1

Reputation

  1. Wow Melba23, many thanks for your generous help! I am constantly trying to improve in AutoIT, but since logic isn't my strong attribute, I am struggling with programming :-) That's why so many "errors" in the script, sometimes I don't understand how specific functions work exactly (like loops, ...) Thank you for commenting on the code as it will improve my understanding :-)
  2. Hello everyone, Below is a modified script, which I use to create folder names based on file names and then move each file in folder created. Which works good. However, the modification below I'm trying to achieve now is: - search for files, create folders based on that files (filename is xxxxxx_001.ext, so stringtrim takes care of _001.ext so it isn't included in folder name) - this works ok - function KopirajDatoteke() should now move the files, starting with xxxxxx_***.*** to folder xxxxxx. I am not sure how to achieve this, I would like some pointers. Basically, if part of filename matches folder name, then it should move to the folder that it matches with. Since I need to get Arrays of folders and files, I'm guessing both array functions should stay. I was looking at StringCompare for example, but I think its wrong direction. thanks. #include <File.au3> #include <Array.au3> #include <RecFileListToArray.au3> $DIR = "C:\1" $TIFF = "C:\1" KreirajMape() KopirajDatoteke() Func KreirajMape() $FileArray = _RecFileListToArray($DIR, "*", 1, 0, 1, 0) For $i = 1 to UBound($FileArray) - 1 ;need -1 or you'll go out of range $FileArray[$i] = StringTrimRight(StringRegExpReplace($FileArray[$i], '[^\_]+$', ''), 1) ;Use this just in case the extension is more than 3 letters like "Video.dvr-ms" Next _ArrayDelete($FileArray,0) For $i = 0 to Ubound($FileArray) - 1 DirCreate($DIR & "\" & $FileArray[$i]) Next EndFunc Func KopirajDatoteke() $FileArray = _RecFileListToArray($DIR, "*", 1, 0, 0, 2) $FolderArray = _RecFileListToArray($DIR, "*", 2, 0, 1, 2) For $i = 1 To $FileArray[0] Next For $i = 1 To $FolderArray[0] FileMove($FileArray[$i],$FolderArray[$i],8) Next ;_ArrayDisplay($FileArray) ;_ArrayDisplay($FolderArray) EndFunc
  3. I don't think it's possible - unless if you try MouseClick() or ControlClick() function. You might want to setup your lan card using this: http://technet.microsoft.com/en-us/library/cc732869%28v=ws.10%29.aspx same goes for wlan..
  4. http://msdn.microsoft.com/en-us/library/windows/desktop/cc144191%28v=vs.85%29.aspx maybe this? Define what "control panel" is for you..
  5. Too much unnecessary quotes. This should be better + looks cleaner: Run(@ScriptDir & 'setup.exe' & ' /adminfile' & @ScriptDir & '\profiles\MAK-Passive.msp') I am not sure if .msp will run with Run command, if it doesn't, use ShellExecute instead.
  6. You should use function ShellExecute, Run only works on executables... ShellExecute(@DesktopDir & 'HM-rasphone.pbk')
  7. Just a thought - maybe try connecting as .Username? . stands for whatever the remote computer name is and is used when you try to connect as local user on the machine.
  8. You were right. After I removed the arraydelete function, the script did its magic :-) Thanks!
  9. I have tried changing $i to $j as you provided with $i2 and it didn't work. Edit: Ah I see you've placed Next statements differently - I will try and tell how it goes :-) I am only deleting the first row, since it includes count of files and thats interfering with my actions (since I don't have a folder named e.g. 9 (9 files in folder) and file 9.tif does not exist, obviously) :-) What is your purposed solution? I am still trying to wrap my head around loops... Thank you both for your effort so far!
  10. Hi there, _ArrayDisplay shows me FULL path to files and FULL path to folders, so I think that's not what's wrong (I have tried various combinations on parameters for _RecFileListToArray, can't remember now if I've set it back or not here on OP).. What I'm trying to achieve is to get list of all files and folders in 1 folder (e.g. c:1) and copy them accordingly to subfolders. Folders are named by filenames, for which I use another function and it works well. For example, the structure looks like this: Folders: c:100000001 c:100000002 c:100000003 c:100000004 Files: c:100000001.tif c:100000002.tif c:100000003.tif c:100000004.tif Desired FileCopy operation should copy files to those folders, I have both sorted with parameter within _RecFileListToArray, so it would always match since both are same name: c:10000000100000001.tif c:10000000100000002.tif c:10000000100000003.tif c:10000000100000004.tif I have also tried to put the FileCopy operation in the second loop, right before Next statement, however files are still not copied. I hope I made it bit clearer now on my desired output ;-)
  11. So I'm using _RecFileListToArray by Melba23, I've added _ArrayDisplay to the function, to make sure values returned are normal - which they are. $DIR is the directory where the script is searching for files / folders. What bugs me, is, that when I preform FileCopy operation (according to array that would be - c:1filename.tif -> c:1filenamefilename.tif) but it only copies file from row 1 in the array! other folders are left blank :-( I can't seem to find the error below... help appreciated! Func KopirajDatoteke() $FileArray = _RecFileListToArray($DIR, "*", 1, 0, 0, 2) _ArrayDelete($FileArray,0) $FolderArray = _RecFileListToArray($DIR, "*", 2, 0, 1, 2) _ArrayDelete($FolderArray,0) For $i = 1 To $FileArray[0] Next For $i = 1 To $FolderArray[0] Next FileCopy($FileArray[$i],$FolderArray[$i],8) _ArrayDisplay($FileArray) _ArrayDisplay($FolderArray) EndFunc
  12. Thank you @water, I will look into it today/tomorrow and come back if I'll have more questions (which I'm sure I'll have :-)). @kylomas, I googled for Kiwi syslog API, but it throws me to the CatTools page which is not the same product as the syslog. And as I stated previous, their website and documentation is really badly scattered..
  13. I've contacted their technical support if they have any solution for monthly / yearly reports, but they answered that there isn't an option yet and that they might add it in future releases. I checked out example scripts on it, but figured it would be much less hassle doing it in AutoIT than in Syslog server. Documentation and website are poorly constructed on their side...
  14. So the situation is as following: - The kind of email I get is report (daily statistics) - I want to extract relevant data into DB or Excel, so later I can generate monthly/yearly report based on it. - I would like extracted table Breakdown of Syslog messages by severity and Kiwi Syslog Server Statistics, I would let Breakdown by sending host out of parsing. - I am aware of Outlook UDF and ability to read email body with it The trouble is, I am unsure how to parse data below to suit my needs / what kind of approach to use for that. My guess would be to first read date from the 3rd line, so we know for what day statistics apply. Secondly, I would go with matching text i.e. "Messages received - Total:" and match it with Excel row. Table would be designed: - 1st column Messages received total, messages received - last 24 hours, etc... - 2nd column would be "Date", 2nd row of column 2 would be the numbers according to below.. That's how much I figured that it should be. Any more pointers / examples would be highly appreciated. The body of email appears like this: /// Kiwi Syslog Server Statistics /// --------------------------------------------------- 24 hour period ending on: Mon, 25 Mar 2013 00:00:02 Syslog Server started on: Thu, 07 Mar 2013 07:48:35 Syslog Server uptime: 17 days, 16 hours, 10 minutes --------------------------------------------------- + Messages received - Total: 5199162 + Messages received - Last 24 hours: 246856 Messages received - Since + Midnight: 244632 + Messages received - Last hour: 10015 + Message queue overflow - Last hour: 0 + Messages received - This hour: 1900 + Message queue overflow - This hour: 0 + Messages per hour - Average: 10207 + Messages forwarded: 0 + Messages logged to disk: 244760 + Errors - Logging to disk: 0 + Errors - Invalid priority tag: 0 + Errors - No priority tag: 0 + Errors - Oversize message: 91096 + Disk space remaining on drive E: 31727 MB --------------------------------------------------- Breakdown of Syslog messages by sending host +--------------------------+------------+------------+ | Top 20 Hosts | Messages | Percentage | +--------------------------+------------+------------+ | server1.domain.local| 79238 | 32,39% | | server2.domain.local| 60212 | 24,61% | | server3.domain.local| 18084 | 7,39% | | server4.domain.local| 17341 | 7,09% | | 10.10.10.1 | 12223 | 5,00% | | 10.10.10.2 | 11869 | 4,85% | | server5.domain.local| 8093 | 3,31% | | server6.domain.local| 4945 | 2,02% | | server7.domain.local| 4001 | 1,64% | | server8.domain.local| 3952 | 1,62% | | server9.domain.local| 3872 | 1,58% | | server10.domain.local| 3520 | 1,44% | | server11.domain.local| 3413 | 1,40% | | server12.domain.local| 2936 | 1,20% | | server13.domain.local| 2908 | 1,19% | | server14.domain.local| 2737 | 1,12% | | server15.domain.local| 1777 | 0,73% | | server16.domain.local| 1164 | 0,48% | | server17.domain.local| 1085 | 0,44% | | server18.domain.local| 1007 | 0,41% | | All others (4) | 255 | 0,10% | +--------------------------+------------+------------+ Breakdown of Syslog messages by severity +--------------------+------------+------------+ | Message Level | Messages | Percentage | +--------------------+------------+------------+ | 0 - Emerg | 0 | 0,00% | | 1 - Alert | 0 | 0,00% | | 2 - Critical | 208 | 0,09% | | 3 - Error | 198 | 0,08% | | 4 - Warning | 697 | 0,28% | | 5 - Notice | 216086 | 88,33% | | 6 - Info | 27443 | 11,22% | | 7 - Debug | 0 | 0,00% | +--------------------+------------+------------+
×
×
  • Create New...