|
|
|||||||
I am attempting to OPEN a file via this path \\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex070102.log When run from the command line with notepad it takes 2-3 seconds to open completely. When I attempt to open the file in KiX I get The filename, directory name, or volume label syntax is incorrect. Could this be an issue of speed? The file sizes are 12 to 25 Mb. |
||||||||
|
|
|||||||
Well if you can open a 25MB log file in notepad in 2-3 seconds I'd go with that solution That's pretty quick to open a file that size with notepad. Just joking with you. Let's see your code as KiX should not have an issue opening it either. |
||||||||
|
|
|||||||
You asked for it. Code: $rc = SetOption(NoVarsinStrings,On) Break On $System = CreateObject("Kixforms.System") If Not $System $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16) Quit() EndIf $nul = $System.Application.EnableVisualStyles $Form1 = $System.Form() $Form1.BackColor = $System.Color.FromName("Control") $Form1.Left = 60 $Form1.StartPosition = 0 ;FormStartPosition_Manual $Form1.Size = $System.Size(255,292) ;(Width,Height) $Form1.Text = "FTP Log Parse" $Form1.Top = 219 $Label1 = $System.Label() $Label1.BorderStyle = 0 $Label1.Left = 5 $Label1.Text = "Provider User ID" $Label1.Top = 11 $nul = $Form1.Controls.Add($Label1) $TextBox1 = $System.TextBox() $TextBox1.Left = 112 $TextBox1.Text = "" $TextBox1.Top = 11 $nul = $Form1.Controls.Add($TextBox1) $Label2 = $System.Label() $Label2.BorderStyle = 0 $Label2.Left = 7 $Label2.Text = "Starting Search Date" $Label2.Top = 48 $Label2.Width = 113 $nul = $Form1.Controls.Add($Label2) $ComboBox1 = $System.ComboBox() $ComboBox1.DropDownWidth = 88 $ComboBox1.Left = 7 $ComboBox1.Text = "MONTH" $ComboBox1.Top = 77 $ComboBox1.Width = 88 $nul = $Form1.Controls.Add($ComboBox1) $ComboBox1Item0 = $ComboBox1.Items.Add("JAN 01") $ComboBox1Item1 = $ComboBox1.Items.Add("FEB 02") $ComboBox1Item2 = $ComboBox1.Items.Add("MAR 03") $ComboBox1Item3 = $ComboBox1.Items.Add("APR 04") $ComboBox1Item4 = $ComboBox1.Items.Add("MAY 05") $ComboBox1Item5 = $ComboBox1.Items.Add("JUN 06") $ComboBox1Item6 = $ComboBox1.Items.Add("JUL 07") $ComboBox1Item7 = $ComboBox1.Items.Add("AUG 08") $ComboBox1Item8 = $ComboBox1.Items.Add("SEP 09") $ComboBox1Item9 = $ComboBox1.Items.Add("OCT 10") $ComboBox1Item10 = $ComboBox1.Items.Add("NOV 11") $ComboBox1Item11 = $ComboBox1.Items.Add("DEC 12") $ComboBox2 = $System.ComboBox() $ComboBox2.DropDownWidth = 47 $ComboBox2.Left = 100 $ComboBox2.Text = "DAY" $ComboBox2.Top = 77 $ComboBox2.Width = 47 $nul = $Form1.Controls.Add($ComboBox2) $ComboBox2Item0 = $ComboBox2.Items.Add("01") $ComboBox2Item1 = $ComboBox2.Items.Add("02") $ComboBox2Item2 = $ComboBox2.Items.Add("03") $ComboBox2Item3 = $ComboBox2.Items.Add("04") $ComboBox2Item4 = $ComboBox2.Items.Add("05") $ComboBox2Item5 = $ComboBox2.Items.Add("06") $ComboBox2Item6 = $ComboBox2.Items.Add("07") $ComboBox2Item7 = $ComboBox2.Items.Add("08") $ComboBox2Item8 = $ComboBox2.Items.Add("09") $ComboBox2Item9 = $ComboBox2.Items.Add("10") $ComboBox2Item10 = $ComboBox2.Items.Add("11") $ComboBox2Item11 = $ComboBox2.Items.Add("12") $ComboBox2Item12 = $ComboBox2.Items.Add("13") $ComboBox2Item13 = $ComboBox2.Items.Add("14") $ComboBox2Item14 = $ComboBox2.Items.Add("15") $ComboBox2Item15 = $ComboBox2.Items.Add("16") $ComboBox2Item16 = $ComboBox2.Items.Add("17") $ComboBox2Item17 = $ComboBox2.Items.Add("18") $ComboBox2Item18 = $ComboBox2.Items.Add("19") $ComboBox2Item19 = $ComboBox2.Items.Add("20") $ComboBox2Item20 = $ComboBox2.Items.Add("21") $ComboBox2Item21 = $ComboBox2.Items.Add("22") $ComboBox2Item22 = $ComboBox2.Items.Add("23") $ComboBox2Item23 = $ComboBox2.Items.Add("24") $ComboBox2Item24 = $ComboBox2.Items.Add("25") $ComboBox2Item25 = $ComboBox2.Items.Add("26") $ComboBox2Item26 = $ComboBox2.Items.Add("27") $ComboBox2Item27 = $ComboBox2.Items.Add("28") $ComboBox2Item28 = $ComboBox2.Items.Add("29") $ComboBox2Item29 = $ComboBox2.Items.Add("30") $ComboBox2Item30 = $ComboBox2.Items.Add("31") $ComboBox3 = $System.ComboBox() $ComboBox3.DropDownWidth = 70 $ComboBox3.Left = 154 $ComboBox3.Text = "YEAR" $ComboBox3.Top = 77 $ComboBox3.Width = 70 $nul = $Form1.Controls.Add($ComboBox3) $ComboBox3Item0 = $ComboBox3.Items.Add("2006") $ComboBox3Item1 = $ComboBox3.Items.Add("2007") $Label3 = $System.Label() $Label3.BorderStyle = 0 $Label3.Left = 6 $Label3.Text = "Ending Search Date" $Label3.Top = 108 $Label3.Width = 113 $nul = $Form1.Controls.Add($Label3) $ComboBox4 = $System.ComboBox() $ComboBox4.DropDownWidth = 92 $ComboBox4.Left = 5 $ComboBox4.Text = "MONTH" $ComboBox4.Top = 135 $ComboBox4.Width = 92 $nul = $Form1.Controls.Add($ComboBox4) $ComboBox4Item0 = $ComboBox4.Items.Add("JAN 01") $ComboBox4Item1 = $ComboBox4.Items.Add("FEB 02") $ComboBox4Item2 = $ComboBox4.Items.Add("MAR 03") $ComboBox4Item3 = $ComboBox4.Items.Add("APR 04") $ComboBox4Item4 = $ComboBox4.Items.Add("MAY 05") $ComboBox4Item5 = $ComboBox4.Items.Add("JUN 06") $ComboBox4Item6 = $ComboBox4.Items.Add("JUL 07") $ComboBox4Item7 = $ComboBox4.Items.Add("AUG 08") $ComboBox4Item8 = $ComboBox4.Items.Add("SEP 09") $ComboBox4Item9 = $ComboBox4.Items.Add("OCT 10") $ComboBox4Item10 = $ComboBox4.Items.Add("NOV 11") $ComboBox4Item11 = $ComboBox4.Items.Add("DEC 12") $ComboBox5 = $System.ComboBox() $ComboBox5.DropDownWidth = 45 $ComboBox5.Left = 103 $ComboBox5.Text = "DAY" $ComboBox5.Top = 135 $ComboBox5.Width = 45 $nul = $Form1.Controls.Add($ComboBox5) $ComboBox5Item0 = $ComboBox5.Items.Add("01") $ComboBox5Item1 = $ComboBox5.Items.Add("02") $ComboBox5Item2 = $ComboBox5.Items.Add("03") $ComboBox5Item3 = $ComboBox5.Items.Add("04") $ComboBox5Item4 = $ComboBox5.Items.Add("05") $ComboBox5Item5 = $ComboBox5.Items.Add("06") $ComboBox5Item6 = $ComboBox5.Items.Add("07") $ComboBox5Item7 = $ComboBox5.Items.Add("08") $ComboBox5Item8 = $ComboBox5.Items.Add("09") $ComboBox5Item9 = $ComboBox5.Items.Add("10") $ComboBox5Item10 = $ComboBox5.Items.Add("11") $ComboBox5Item11 = $ComboBox5.Items.Add("12") $ComboBox5Item12 = $ComboBox5.Items.Add("13") $ComboBox5Item13 = $ComboBox5.Items.Add("14") $ComboBox5Item14 = $ComboBox5.Items.Add("15") $ComboBox5Item15 = $ComboBox5.Items.Add("16") $ComboBox5Item16 = $ComboBox5.Items.Add("17") $ComboBox5Item17 = $ComboBox5.Items.Add("18") $ComboBox5Item18 = $ComboBox5.Items.Add("19") $ComboBox5Item19 = $ComboBox5.Items.Add("20") $ComboBox5Item20 = $ComboBox5.Items.Add("21") $ComboBox5Item21 = $ComboBox5.Items.Add("22") $ComboBox5Item22 = $ComboBox5.Items.Add("23") $ComboBox5Item23 = $ComboBox5.Items.Add("24") $ComboBox5Item24 = $ComboBox5.Items.Add("25") $ComboBox5Item25 = $ComboBox5.Items.Add("26") $ComboBox5Item26 = $ComboBox5.Items.Add("27") $ComboBox5Item27 = $ComboBox5.Items.Add("28") $ComboBox5Item28 = $ComboBox5.Items.Add("29") $ComboBox5Item29 = $ComboBox5.Items.Add("30") $ComboBox5Item30 = $ComboBox5.Items.Add("31") $ComboBox6 = $System.ComboBox() $ComboBox6.DropDownWidth = 75 $ComboBox6.Left = 151 $ComboBox6.Text = "YEAR" $ComboBox6.Top = 135 $ComboBox6.Width = 75 $nul = $Form1.Controls.Add($ComboBox6) $ComboBox6Item0 = $ComboBox6.Items.Add("2006") $ComboBox6Item1 = $ComboBox6.Items.Add("2007") $Button1 = $System.Button() $Button1.BackColor = $System.Color.FromName("ControlDark") $Button1.FlatStyle = 3 ;System $Button1.Height = 30 $Button1.Left = 54 $Button1.Text = "Create Output File" $Button1.Top = 165 $Button1.Width = 121 $Button1.Click = "Create()" $nul = $Form1.Controls.Add($Button1) $Button2 = $System.Button() $Button2.Enabled = 0 ;False $Button2.FlatStyle = 3 ;System $Button2.Left = 21 $Button2.Text = "PARSE" $Button2.Top = 226 $Button2.Click = "Parse()" $nul = $Form1.Controls.Add($Button2) $Button3 = $System.Button() $Button3.FlatStyle = 3 ;System $Button3.Left = 147 $Button3.Text = "EXIT" $Button3.Top = 226 $Button3.Click = "Done()" $nul = $Form1.Controls.Add($Button3) $Label4 = $System.Label() $Label4.BorderStyle = 0 $Label4.Left = 0 $Label4.Text = "" $Label4.Top = 195 $Label4.Width = 255 ;$Label4.Height = 60 $nul = $Form1.Controls.Add($Label4) $Form1.Show ;Displays the Form While $Form1.Visible $Nul = Execute($Form1.DoEvents()) Loop Exit 0 Function Done() Quit EndFunction Function Parse() $Title = "Missing Information" ;Verify that all fields have something in them If $Textbox1.text = "" $RC = MessageBox("Please input a Provider Name",$Title,0) Else $Flag = $Flag + 1000000 EndIf If $ComboBox1.SelectedIndex <0 Or $ComboBox1.SelectedIndex >11 $RC = MessageBox("Please Select the starting month",$Title,0) Else $Flag = $Flag + 0100000 EndIf If $ComboBox2.SelectedIndex <0 Or $ComboBox2.SelectedIndex >30 $RC = MessageBox("Please select the starting day",$Title,0) Else $Flag = $Flag + 0010000 EndIf If $ComboBox3.SelectedIndex <0 Or $ComboBox3.SelectedIndex >1 $RC = MessageBox("Please select the starting year",$Title,0) Else $Flag = $Flag + 0001000 EndIf If $ComboBox4.SelectedIndex <0 Or $ComboBox4.SelectedIndex >11 $RC = MessageBox("Please select the ending month",$Title,0) Else $Flag = $Flag + 0000100 EndIf If $ComboBox5.SelectedIndex <0 Or $ComboBox5.SelectedIndex >30 $RC = MessageBox("Please select the ending day",$Title,0) Else $Flag = $Flag + 0000010 EndIf If $ComboBox6.SelectedIndex <0 Or $ComboBox6.SelectedIndex >1 $RC = MessageBox("Please select the ending year",$Title,0) Else $Flag = $Flag + 0000001 EndIf If $Flag = 1111111 DoIt() $rc = Close(1) $rc = Close(3) EndIf $Form1.BackColor = $System.Color.FromName("Control") EndFunction Function Create() Dim $SAve $Save = $System.SaveFileDialog() $Save.Defaultext = "TXT" $Save.Filename = "FTP_Export" $Save.Filter = "*.txt" $Save.OverwritePrompt = "True" If $Save.Showdialog = 1 $rc = Open(1,$Save.Filename,5) EndIf $Label4.Text = "Output File = "+$Save.Filename $Button2.Enabled = "True" EndFunction Function DoIt() $Form1.BackColor = $System.Color.FromName("Red") $Button2.Enabled = "False" $Date = Join(Split(@DATE,"/"),"") $Start = $ComboBox3.Text+"/"+Right($ComboBox1.Text,2)+"/"+$ComboBox2.Text $End = $ComboBox6.Text+"/"+Right($ComboBox4.Text,2)+"/"+$ComboBox5.Text If Open(3,@SCRIPTDIR+"\errorlogs\"+$dATE+"-"+@USERID+".log",5) =0 For $i = serialdate($Start) to serialdate($End) $FileDate = Split(Serialdate($i),"/") If Open(2,Chr(34)+"\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex" + Right($Filedate[0],2)+$Filedate[1]+$Filedate[2]+".log"+Chr(34)) = 0 $Label4.Text = "Now Reading File Date: "+$SerialDate($i) For $ = 0 to 4 $RC = ReadLine(2) Next $Line = ReadLine(2) While @ERROR = 0 $Array = Split($Line," ") If UBound($Array) =>3 If $Array[3] = $TextBox1.Text $RC = WriteLine(1,$Line+@CRLF) EndIf EndIf ReDim $Array $Line = ReadLine(2) Loop $rc = Close(2) $Form1.BackColor = $System.Color.FromName("Control") $Textbox1.Text = "" $ComboBox1.SelectedIndex = -1 $ComboBox1.Text = "Month" $ComboBox2.SelectedIndex = -1 $ComboBox2.Text = "Day" $ComboBox3.SelectedIndex = -1 $ComboBox3.Text = "Year" $Label4.Text = @CRLF+"Complete" Else $E = "Error: "+@ERROR+" "+@SERROR+@CRLF $Label4.Text = "ERROR Please see log file"+@CRLF+@SCRIPTDIR+"\errorlogs\"+$Date+"-"+@USERID+".log" $rc = WriteLine(3,"Unable to open file dated: "+serialdate($i)+" "+$E+@CRLF+"FileName: "+"\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex" + Right($Filedate[0],2)+$Filedate[1]+$Filedate[2]+".log"+@CRLF) EndIf Next Else $Form1.BackColor = $System.Color.FromName("Control") $Label4.Text = "Unable to open errror log file." EndFunction Function serialdate($ExpD) Dim $z,$h,$a,$b,$c,$y,$m,$d If InStr($ExpD,'/') $ExpD=Split($ExpD,'/') $y=Val($ExpD[0]) $m=Val($ExpD[1]) $d=Val($ExpD[2]) If $m<3 $m=$m+12 $y=$y-1 EndIf $SerialDate=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306 Else $z=0+$ExpD+306 $h=100*$z-25 $a=$h/3652425 $b=$a-$a/4 $y=(100*$b+$h)/36525 $c=$b+$z-365*$y-$y/4 $m=(5*$c+456)/153 $d=$c-(153*$m-457)/5 If $m>12 $y=$y+1 $m=$m-12 EndIf $SerialDate=Right('0000'+$y,4)+'/'+Right('00'+$m,2)+'/'+Right('00'+$d,2) EndIf EndFunction |
||||||||
|
|
|||||||
Well didn't STUDY it, but nothing obvious popped out at me to indicate an error. So is the issue that it works but is SLOW or that it doesn't work period due to the syntax error? I'll see if I can get time to give it a test drive at work if someone else doesn't spot the issue. Maybe Benny69 can take a look, he is pretty darn good at KF |
||||||||
|
|
|||||||
Create a small file in the same folder and see how the code handles it. |
||||||||
|
|
|||||||
@Doc It does not work at all. I am sure that there is some sort of syntax error that I just don't see from looking at it for way to long. The first run of this script only opened one file at a time, and that worked. It was when I added a time range that it started failing. The only code that really changed was in the DOIT() function. |
||||||||
|
|
|||||||
Thought I would add that the files are from an ftp server (IIS). If you hadn't caught that yet. |
||||||||
|
|
|||||||
Originally Posted By: Gargoyle Thought I would add that the files are from an ftp server (IIS). If you hadn't caught that yet. |
||||||||
|
|
|||||||
I hope you enclosed the folder name in quotes due to the space in one of the folder names: "\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex070102.log" I would call it a best practice to always enclose path names in quotes. |
||||||||
|
|
|||||||
yes I did enclose them within quotes. CHR(34) + path\filename + CHR(34) |
||||||||
|
|
|||||||
So has anyone seen anything at all? I am at such a loss on why it will not open the file (not even a small one). All of the debugging is showing that the proper path is being sent, and when I copy the output and then open it with notepad Quote: c:\scripts> Notepad "\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex070102.log" The exact output of a ? statement Quote: ? Chr(34)+"\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex" + Right($Filedate[0],2)+$Filedate[1]+$Filedate[2]+".log"+Chr(34) Results in Quote: "\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex070102.log" When using a date range of any length, I get error 123 (not found) for each of the files that it attempts to open. Any troubleshooting that you can pass on would be a great welcome. |
||||||||
|
|
|||||||
What a bizarre coincidence. The same coding error coming up twice at the same time. Your problem is that you are adding quote characters to the file path, so KiXtart is trying to open a file which has quote characters in the file name and will of course fail. Simple to fix, just change this line: Code: If Open(2,Chr(34)+"\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex" + Right($Filedate[0],2)+$Filedate[1]+$Filedate[2]+".log"+Chr(34)) = 0 Drop the quotes from the path data and you should be fine: Code: If Open(2,"\\serverx\d$\Inetpub\ftp logs\MSFTPSVC1\ex" + Right($Filedate[0],2)+$Filedate[1]+$Filedate[2]+".log") = 0 |
||||||||
|
|
|||||||
Was just about to say Drop the quotes but Richard beat me to it |
||||||||
|
|
|||||||
Thanks Richard, That sounds like it is quite probable the answer. Sorry Garg - couldn't dig deep into it, been working on re-subnetting and routing my network with some old junk routers that really suck. Hopefully though it looks like Richard found the answer. |
||||||||
|
|
|||||||
Thanks guys, I will have a go at it on Thursday (after the holiday). Doc, I can completly understand your pain and frustration, we are in the process of doing the same thing, and I am starting with a class B that has been broken into class C and then further subnetted beyond that... Me and the other network tech, are still trying to figure out why it was done the way it was.... Ever so slowly though. |
||||||||
|
|
|||||||
class b? well, easiness of setting it up? or just simply because that was in the manual's example section... |
||||||||
|
|
|||||||
AFAIK class B networks range between 128.0.0.0 and 191.255.255.255. The net mask is per default 255.255.0.0. These networks can be subnetted. PIX Firewall Series Configuration Guide, Version 4.0 Quote: •For a Class B address, which ranges from 128.0.0.0 to 191.255.255.255, the network address is in the first two octets and the host ID is in the last two. This permits 65,536 hosts to be represented by a single Class B IP address. •For a Class C address, which ranges from 192.0.0.0 to 223.255.255.255, the network address is in the first three octets and the host ID is in the last octet. This permits 256 hosts to be represented by a single Class C IP address |
||||||||
|
|
|||||||
And your points are? |
||||||||
|
|
|||||||
Not sure. You can subnet and superscope any of the addresses depending on what you're looking for. Then segment with VLANS if wanted as well. Too many choices and soon IPV6 will give even more possibilities |
||||||||
|
|
|||||||
Originally Posted By: Gargoyle I am starting with a class B that has been broken into class C I do not see how a class B network can become a class C network. Class B addresses range from 128.0.0.0 to 191.255.255.255 Class C addresses range from 192.0.0.0 to 223.255.255.255 |
||||||||
|
|
|||||||
Class B subnetted into Class C address space. Assuming 129.65.0.0 /16 Would give you
At which point you can then further subnet your class C address space. Example 129.65.65.0 /24
|
||||||||
|
|
|||||||
OK, now I see, you are subnetting like Doc said. You should write your IP Address binary. Start counting at the left hand side. If the first bit = 0, the Address is Class A. If the first bit = 1 and the second = 0, the Address is Class B. If the first and the second bit = 1 and the third = 0, the Address is Class C. Any IP Address with 129 as first octet is a class B address. 129(10) = 10000001(2) |
||||||||
|
|
|||||||
Hey Witto, congrats on the 1K mark. Yea I know all about binary and subnetting, after all my primary function at work is network security engineer. Although you did not mention Class D or Class E address space.. |
||||||||
|
|
|||||||
class E is most likely filled with silicon... |
||||||||
|
|
|||||||
@Richard H. Thanks, that fixed the file open issue, exposed a few other problems, but they were easy by comparison. My thoughts originally had been that because the file path includes a space in it, I had to wrap the whole thing in quotes, beyond the quotes to seperate my strings and my vars. Sort of like "'stuff' + other + 'more stuff'" |
||||||||
|
|
|||||||
I agree.. subnetting a class A or B network gives you a subnetted class A or B network, not a class C. It's semantics, but it is what it is. Prolly why most network people use CIDR netmasks and avoid the whole class structure. Glenn |
||||||||
|
|
|||||||
That was a PITA Worked on issue with intermittent connectivity for my .0 subent for a few hours and it turns out that one of my VPN switches had an invalid mask. Didn't even think that switch was involved in the internal setup but it was. Just never have to deal with routing much so you don't use it you lose it. |
||||||||
|
|
|||||||
We are in the process of setting up our "Virtual Office"(VO) to use seperate (but connected) sites for connectivity back to the network. Being that the VO is on an external network and it can come in via one of two entry points, and those enty points are of course protected by a firewall, which requires that you follow the same path out as you took in... Beginning to get the idea? So much fun |
||||||||
|
|
|||||||
Yeah could be fun, but not when I'm under pressure to fix it because the production network is having connectivity issues. Better if one had to work with it daily, then you'd know it better and so many areas to configure/play in. |