Sign in to follow this  
Followers 0
Intel91

Using FileReadLine to create a Variable

3 posts in this topic

#1 ·  Posted (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 by Intel91

Share this post


Link to post
Share on other sites



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

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