Iznogoud Posted June 27, 2006 Posted June 27, 2006 I made a script while ago wich just has to fill some fields. I want to develop it further when needed. But i want it to run today and i got an error wich i know for sure i didn't got it a while ago. Does someone knows what this error means in normal language : ==> Subscript used with non-Array variable.: MouseClick("Left", $realsize[0]+206, $realsize[1]+48) MouseClick("Left", $realsize^ ERROR This is my code, more simple then this can it not be as far as i know. expandcollapse popupGlobal $Paused HotKeySet("!x", "ExitProgram") HotKeySet("!s", "Sending") $var1 = IniRead("OutlookConnector.ini", "settings", "variable1", "unknown") $var2 = IniRead("OutlookConnector.ini", "settings", "variable2", "unknown") $var3 = IniRead("OutlookConnector.ini", "settings", "variable3", "unknown") $var4 = IniRead("OutlookConnector.ini", "settings", "variable4", "unknown") $var5 = IniRead("OutlookConnector.ini", "settings", "variable5", "unknown") While 1 Sleep(100) Wend Func Sending() $realsize = WinGetPos("Outlook Connector for MDaemon 2.0") MouseClick("Left", $realsize[0]+206, $realsize[1]+48) ControlClick("Outlook Connector for MDaemon", "", "Button1") MouseClick("Left", $realsize[0]+38, $realsize[1]+45) ControlClick("Outlook Connector for MDaemon", "", "Edit1") Send("{END}") Send("{BACKSPACE 30}") Send($var1 & " " & @UserName) ControlClick("Outlook Connector for MDaemon", "", "Edit2") Send("{END}") Send("{BACKSPACE 30}") Send($var2) ControlClick("Outlook Connector for MDaemon", "", "Edit3") Send("{END}") Send("{BACKSPACE 30}") Send(@UserName & $var3) ControlClick("Outlook Connector for MDaemon", "", "Edit5") Send("{END}") Send("{BACKSPACE 30}") Send($var4) ControlClick("Outlook Connector for MDaemon", "", "Edit6") Send("{END}") Send("{BACKSPACE 30}") Send($var5) ControlClick("Outlook Connector for MDaemon", "", "Edit7") Send("{END}") Send("{BACKSPACE 30}") Send(@UserName) Exit EndFunc Func ExitProgram() $answer = MsgBox(4, "Hotkeys uitschakelen", "Weet u zeker dat de Hotkeys wilt uitschakelen?") If $answer = 7 Then ;Do Nothing Else Exit EndIf EndFunc ok ok ok, maybe somethings could be better or quicker, but i am still a learning n00b
Xenobiologist Posted June 27, 2006 Posted June 27, 2006 HI, does this help? expandcollapse popupGlobal $Paused HotKeySet("!x", "ExitProgram") HotKeySet("!s", "Sending") $var1 = IniRead("OutlookConnector.ini", "settings", "variable1", "unknown") $var2 = IniRead("OutlookConnector.ini", "settings", "variable2", "unknown") $var3 = IniRead("OutlookConnector.ini", "settings", "variable3", "unknown") $var4 = IniRead("OutlookConnector.ini", "settings", "variable4", "unknown") $var5 = IniRead("OutlookConnector.ini", "settings", "variable5", "unknown") While 1 Sleep(100) WEnd Func Sending() Global $realsize = WinGetPos("Outlook Connector for MDaemon 2.0") If $realsize = 0 Or @error = 1 Then MsgBox(16, "Error", "Window not found!") Else MouseClick("Left", $realsize[0] + 206, $realsize[1] + 48) ControlClick("Outlook Connector for MDaemon", "", "Button1") MouseClick("Left", $realsize[0] + 38, $realsize[1] + 45) ControlClick("Outlook Connector for MDaemon", "", "Edit1") Send("{END}") Send("{BACKSPACE 30}") Send($var1 & " " & @UserName) ControlClick("Outlook Connector for MDaemon", "", "Edit2") Send("{END}") Send("{BACKSPACE 30}") Send($var2) ControlClick("Outlook Connector for MDaemon", "", "Edit3") Send("{END}") Send("{BACKSPACE 30}") Send(@UserName & $var3) ControlClick("Outlook Connector for MDaemon", "", "Edit5") Send("{END}") Send("{BACKSPACE 30}") Send($var4) ControlClick("Outlook Connector for MDaemon", "", "Edit6") Send("{END}") Send("{BACKSPACE 30}") Send($var5) ControlClick("Outlook Connector for MDaemon", "", "Edit7") Send("{END}") Send("{BACKSPACE 30}") Send(@UserName) Exit EndIf EndFunc ;==>Sending Func ExitProgram() $answer = MsgBox(4, "Hotkeys uitschakelen", "Weet u zeker dat de Hotkeys wilt uitschakelen?") If $answer = 7 Then ;Do Nothing Else Exit EndIf EndFunc ;==>ExitProgram So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Moderators big_daddy Posted June 27, 2006 Moderators Posted June 27, 2006 Try this: expandcollapse popupFunc Sending() $realsize = WinGetPos("Outlook Connector for MDaemon 2.0") If IsArray($realsize) Then MouseClick("Left", $realsize[0] + 206, $realsize[1] + 48) ControlClick("Outlook Connector for MDaemon", "", "Button1") MouseClick("Left", $realsize[0] + 38, $realsize[1] + 45) ControlClick("Outlook Connector for MDaemon", "", "Edit1") Send("{END}") Send("{BACKSPACE 30}") Send($var1 & " " & @UserName) ControlClick("Outlook Connector for MDaemon", "", "Edit2") Send("{END}") Send("{BACKSPACE 30}") Send($var2) ControlClick("Outlook Connector for MDaemon", "", "Edit3") Send("{END}") Send("{BACKSPACE 30}") Send(@UserName & $var3) ControlClick("Outlook Connector for MDaemon", "", "Edit5") Send("{END}") Send("{BACKSPACE 30}") Send($var4) ControlClick("Outlook Connector for MDaemon", "", "Edit6") Send("{END}") Send("{BACKSPACE 30}") Send($var5) ControlClick("Outlook Connector for MDaemon", "", "Edit7") Send("{END}") Send("{BACKSPACE 30}") Send(@UserName) Else MsgBox(48, "Error", "The window was not found.") EndIf Exit EndFunc ;==>Sending
Iznogoud Posted June 27, 2006 Author Posted June 27, 2006 th.meger and big_daddy you guys are right. Both solution are working, or at least at home. I will try it tomorrow where i can activate the window to. But do you guys know why it has worked before, and suddenly after 3 weeks a run the code again and i got this error. Did i do something wrong or something? Thx for the better solution to let me see where it goes wrong with the option for checking if the windows excist.
Xenobiologist Posted June 27, 2006 Posted June 27, 2006 Hi, I think because 3 weeks ago you had the correct window open and then it works, because the array is created correctly. You can test it this way. HotKeySet("!s", "Sending") While 1 Sleep(100) WEnd Func Sending() Global $realsize = WinGetPos("AutoIt Help") MsgBox(0, "pos", $realsize[0] & " " & $realsize[1]& " " & $realsize[2]& " " & $realsize[3]) EndFunc ;==>Sending So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Iznogoud Posted June 27, 2006 Author Posted June 27, 2006 Hi, I think because 3 weeks ago you had the correct window open and then it works, because the array is created correctly. You can test it this way. HotKeySet("!s", "Sending") While 1 Sleep(100) WEnd Func Sending() Global $realsize = WinGetPos("AutoIt Help") MsgBox(0, "pos", $realsize[0] & " " & $realsize[1]& " " & $realsize[2]& " " & $realsize[3]) EndFunc ;==>Sending So long, Mega It was the same window, but i will try. No harm will done
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