Jump to content
Sign in to follow this  

Global in a function

Recommended Posts

I have this inside an adlib function:

$RestartNFileOpen= RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", "MRUList")
$Nsplit = StringSplit($RestartNFileOpen, "");splits off the MRUList registry so each link is readable individually below
Global $Nlog1 = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", $Nsplit[1])

The problem is the "$Nlog1" is used in another func. I'm getting the error:

C:\Documents and Settings\Money\Desktop\Gui test\Final\Test-Function-Part-1.au3(1394,34) : WARNING: $Nlog1: possibly used before declaration.
                Run($settings1 & ' ' & $Nlog1)
C:\Documents and Settings\Money\Desktop\Gui test\Final\Test-Function-Part-1.au3(1378,134) : WARNING: $Nlog1: declared global in function only. Prefer top of file.
Global $Nlog1 = RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\npr", $Nsplit[1])

So what do I do? The "$Nlog1" has to be in the adlib function...but it can't be a global so it can be read by something in another function. I guess another way to put it...how do I read something across functions?

Edit: The end function I'm trying to do reacts off of a menu select.

Edited by Champak

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  

  • Create New...