Paulie Posted May 21, 2006 Share Posted May 21, 2006 I am thinking about how i could block some popups from coming up on my comp, and i also wanted to improve my scripting skills so i'm making one in autoit. however, it is saying that i have an error Heres Code: expandcollapse popup#NoTrayIcon ;---Includes--- #Include <GUIConstants.au3> ;---Variables--- Global $Button_[1], $i = 0 ;---INI--- If Not FileExists(@ScriptDir & "\Popuplist.ini") Then Create_def_ini() Global $Window_name = IniReadSection(@ScriptDir & "\Popuplist.ini", "Name") ;---GUI--- $wind = GuiCreate("Popup?", 275, 50, 1000,900, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $Button_[0] = GUICtrlCreateButton("Push Here If Active Window Is A Popup", 25, 10, 225, 30) GUISetState() ;---Display--- While 1 Closepopups() $msg= GUIGetmsg() If $msg = $GUI_EVENT_CLOSE then $close_msg= Msgbox(2, "Close?", "This will close you Popup blocker, Are you sure?") If $close_msg = 7 then Continueloop Else Exitloop Endif Endif If $msg = $Button_[0] then $windtitle = WinGetTitle("") IniWrite(@ScriptDir & "\Popuplist.ini", "Name", $i, $windtitle) $i = $i + 1 Endif Wend ;---Functions--- Func Create_def_ini() IniWrite(@ScriptDir & "\Popuplist.ini", "Author", 1, "Paulie") EndFunc ;=== Func Closepopups() For $numbers= 1 to $Window_name[0][0] If Winexists( $Window_name[$numbers][1]) Then Winkill($Window_name[$numbers][1]) Endif Next EndFunc and it says my varible here: For $numbers= 1 to $Window_name[0][0] has subscript used without an array variable, but the helpfile says Returns a 2 dimensional array where element[n][0] is the key and element[n][1] is the value. help plz TY Link to comment Share on other sites More sharing options...
Paulie Posted May 22, 2006 Author Share Posted May 22, 2006 **Bump** No ideas? No helpful hints or tips? For real?!! Link to comment Share on other sites More sharing options...
jefhal Posted May 22, 2006 Share Posted May 22, 2006 (edited) but the helpfile saysThrow an _arraydisplay in just after your $Window_name[0][0] statement to see what that variable contains. I don't see it declared in your script. Are you sure it would contain a number? Also, be sure to #include <array.au3> if you use _arraydisplay... Edited May 22, 2006 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Paulie Posted May 22, 2006 Author Share Posted May 22, 2006 Throw an _arraydisplay in just after your $Window_name[0][0] statement to see what that variable contains. I don't see it declared in your script. Are you sure it would contain a number? Also, be sure to #include <array.au3> if you use _arraydisplay... I get the same error with array display, and the var is declared right here: ;---INI--- If Not FileExists(@ScriptDir & "\Popuplist.ini") Then Create_def_ini() Global $Window_name = IniReadSection(@ScriptDir & "\Popuplist.ini", "Name") Link to comment Share on other sites More sharing options...
jefhal Posted May 31, 2006 Share Posted May 31, 2006 Does this line work by itself? That is, can you have a key named "1"? If so, don't you need quotes around it? IniWrite(@ScriptDir & "\Popuplist.ini", "Author", 1, "Paulie") ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 31, 2006 Moderators Share Posted May 31, 2006 Looks like you've never populated "Name" that your doing the IniReadSection on. It's in your loop but your calling the function before you ever get to populate it. When you create it originally, your creating Author not Name section. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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