Jump to content

Functions and variables


dinodod
 Share

Recommended Posts

Little stumped over this.

I have a function that reads my text file and needs to pass each line back up to the main script yet so far, it's not. I have even gone as far as declaing my variable GLOBAL in the beginning of my script and then tried putting it in the function itself. Neither work. I have a feeling it's pretty simple but I'm not myself today.

Thanks!

$PCNAME1 needs to be passed back to the main script.

Func Func_PCList()

$file = FileOpen($PCList, 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open PCList.txt file!!.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$PCName1 = FileReadLine($file)

If @error = -1 Then ExitLoop

Wend

FileClose($file)

EndFunc

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Link to comment
Share on other sites

Thanks for the quick reply. So an Array is the only way to do it then eh? Would not have thought of that.

Thanks!

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...