Intel91 Posted December 8, 2009 Posted December 8, 2009 (edited) Hi, I would like to use FileReadLine to create a variable, but so far every time I try I get a return of blankness. I have a text file, that holds several lines of information, each one is a shortcut on my desktop. Lets say the first line says '\magiciso.lnk' I would like to read that line and turn it into the variable: $variable = '\magiciso.lnk' But so far it keeps turning it into $variable = I am testing the return via both a msgbox and a filewrite both have no return, they are just blank. $shortcutter = FileReadLine ( "C:\Users\workingtext.txt" , 3) <---------Set it to line 3 just to test if I get any return, I know what is on 3. $shortcutdetails = FileGetShortcut ( @DesktopDir & $shortcutter ) <--If above worked, should return file location FileWrite ( "C:\Users\shortcut456.txt", $shortcutdetails[0] ) <------------------If both above worked, should write the return to a text file. If I replace $shortcutter with the line of text manually so $shortcutter = '\magiciso.lnk' then everything works, and it writes the directory to the text as I want. So, after many hours, I can't figure out why this thing won't return anything for FileReadLine ( "C:\Users\workingtext.txt" , 3). I set the file permissions to read, so that isn't it. I tried the file permissions many ways, and made sure all prior write file permissions were closed out. Any suggestions would be greatly appreciated. Thanks, Intel Edited December 8, 2009 by Intel91
JohnOne Posted December 8, 2009 Posted December 8, 2009 Never used it, but the help file says you need to open the the file first, FileOpen() So maybe $file = FileOpen("C:\Users\workingtext.txt", 0) $shortcutter = FileReadLine($file , 3) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Intel91 Posted December 8, 2009 Author Posted December 8, 2009 Thanks. That is the correct format and it works. At first it kept failing, then I double checked my previous FileClose() to makes sure they were all listed, and they weren't all closed out, meaning one was trying to write in read mode, and vice versa. This also helped me fix my other problems later in the code. Thanks, Intel
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