systemhijack Posted November 7, 2007 Share Posted November 7, 2007 Okay, Lets say that i have a variable ( $ie=_iecreate("www.google.com",0,1,0) ) in a function called Search. And i got another function called Click, and i need the $ie variable there. how can i do this? p.s This is an example! please dont provide information about google because its for something different. Thanks Link to comment Share on other sites More sharing options...
Generator Posted November 7, 2007 Share Posted November 7, 2007 Global $ie Link to comment Share on other sites More sharing options...
Paulie Posted November 7, 2007 Share Posted November 7, 2007 (edited) "Global" is what you are looking for Func1() Func2() Global $GlobalVar = "green" Func Func1() Local $LocalVar = "red" EndFunc Func Func2() Msgbox(0,"", "Global: "&$GlobalVar&@CRLF&"Local: "&$LocalVar) EndFunc Edited November 7, 2007 by Paulie Link to comment Share on other sites More sharing options...
systemhijack Posted November 7, 2007 Author Share Posted November 7, 2007 Func Login($sAccount, $sPasswd, $sWorld) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "No") Global $oIE = _IECreate("http://www.secret.com", 0, 1) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Display Inline Images", "REG_SZ", "Yes") $oForm = _IEFormGetCollection($oIE, 0) $oSelect = _IEFormElementGetObjByName($oForm, "server") $oAccount = _IEFormElementGetObjByName($oForm, "user") $oPasswd = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oAccount, $sAccount) _IEFormElementSetValue($oPasswd, $sPasswd) If $sWorld > 0 And $sWorld < 6 Then _IEFormElementOptionselect($oSelect, "nl" & $sWorld, 1, "byValue") Else MsgBox(0 + 16, "ERROR", "Wereldt bestaat niet.") _IEQuit($oIE) Exit EndIf _IEFormSubmit($oForm, 0) _IELoadWait($oIE) If StringInStr(_IEBodyReadHTML($oIE), "Account niet beschikbaar") Then MsgBox(0 + 16, "ERROR", "Account bestaat niet.") _IEQuit($oIE) Exit ElseIf StringInStr(_IEBodyReadHTML($oIE), "Wachtwoord ongeldig") Or StringInStr(_IEBodyReadHTML($oIE), "" & _ "Ongeldig wachtwoord") Then MsgBox(0 + 16, "ERROR", "Wachtwoordt is fout.") _IEQuit($oIE) Exit EndIf EndFunc ;==>Login Like that? And @ Paul, whats the differents between Local and Global then? Thanks Link to comment Share on other sites More sharing options...
Paulie Posted November 7, 2007 Share Posted November 7, 2007 (edited) @ Paul, whats the differents between Local and Global then?Thanks Well, a global variable is meant to be able to be accessed from anywhere in the script (hence globally)where as "Local" is only supposed to be accessable in the function in which it is created. Edited November 7, 2007 by Paulie Link to comment Share on other sites More sharing options...
systemhijack Posted November 7, 2007 Author Share Posted November 7, 2007 I get it, Thanks alot! 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