Immensee Posted May 28, 2006 Share Posted May 28, 2006 Hello, i'm new in here, could someone help me? I'm a guru with PHP but AU3 is hard.. $pk1_filename = "Finfo.pk1" $file = FileOpen($pk1_filename,1) $pk1_lines = _FileCountLines($pk1_filename) For $number = 1 To $pk1_lines-1 ;; FileLine starts with 1 $pk1_line = FileReadLine($file,$number) ;; FileReadLine 1 $pk1_array = StringSplit($pk1_line,"\") ;; Split into \ (4 splits) If IsArray($pk1_array) Then $pk1_name = UBound($pk1_array,0) ;GUICtrlCreateMenuitem($pk1_name,$item2) MsgBox(0,"Title",$pk1_name) ;; Show UBound ;Array $menuID[$number] = menuitem/load name Next This is my code, the thing is, it says an error. This is what i want to get with the code: I have already a code that opens a file Dialog and asks for a file. When selecting a file it automatically writes this: line1 = C:\Program Files\Documents and Settings\Myfile.txt I want to get the end of that line (Myfile.txt) and show it with an Control Menu Item. And on Press it must load the file. Can anyone help me with that? please, i'm a nub Well Cya - ImMenSe Link to comment Share on other sites More sharing options...
Zedna Posted May 28, 2006 Share Posted May 28, 2006 Look into helpfile - examples for FileReadLine, StringSplit, GuiCtrlCreateListViewItemor search in forum, there was code snippets for this already.Have fun with AutoIt Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Nomad Posted May 28, 2006 Share Posted May 28, 2006 (edited) I seen some errors in your code, including the missing #include file. Try This: #include <File.au3> $pk1_filename = "Finfo.pk1" $file = FileOpen($pk1_filename,1) $pk1_lines = _FileCountLines($pk1_filename) For $number = 1 To $pk1_lines step -1 ;; FileLine starts with 1 $pk1_line = FileReadLine($pk1_filename,$number);; FileReadLine 1 $pk1_array = StringSplit($pk1_line,"\");; Split into \ (4 splits) If IsArray($pk1_array) Then $pk1_name = UBound($pk1_array) ;GUICtrlCreateMenuitem($pk1_name,$item2) MsgBox(0,"Title",$pk1_name) ;; Show UBound ;Array $menuID[$number] = menuitem/load name Next hope this helps, Nomad Edited May 28, 2006 by Nomad Link to comment Share on other sites More sharing options...
Immensee Posted May 28, 2006 Author Share Posted May 28, 2006 (edited) I know some things are missing , i copy pasted only the bugged part AND WAUW!!! it worked thank you so much, immense Edited May 28, 2006 by Immense Link to comment Share on other sites More sharing options...
Nomad Posted May 28, 2006 Share Posted May 28, 2006 No problem, I just noticed a small error in the script I gave you though.. The -1 after the step should be a 1. Since it starts at 1, you want it to count positive up to the number of lines, not backwards to the negative side... my mistake. Link to comment Share on other sites More sharing options...
Immensee Posted May 28, 2006 Author Share Posted May 28, 2006 I know that i've changed the - into + And it works perfectly! thanks again Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now