secman Posted November 6, 2008 Posted November 6, 2008 Hi all, I am very new to AutoIt but have been able to put together a few scripts mostly using code examples posted by those much more experienced than I. I have created a script to run on a laptop. The student logs on using a local ID and password and this script runs to allow them to log onto their network account via a wireless link. This has been working fine but recently I have been enhancing it a bit to link it directly to another script to run a simple menu for firing off applications. When I run the compiled script now from a laptop or from another PC (one that does not have Autoit installed), I get "Line -1 Error: Variable must be of type "Object" Now I don't think I have used any "objects" in my script as I am trying to keep it basic and I am not by any means a programmer. I hope someone can help. This problem is also appearing in some other scripts so it must be something daft I've done and used elsewhere. The code is as follows: #include <GUIConstants.au3> #include <String.au3> #include <IE.au3> #include <Array.au3> #include <Inet.au3> #include <Date.au3> #include <ADFunctions.au3> ; Global $LoginGUI, $loginusername, $loginpassword, $loginlogin, $logincreate, $domuname, $uname, $loginPW, $loginUN, $line1, $line2, $line3, $defusername ; ------- Default Username ------ $defusername = "" ; ------- GUI create ------------ $LoginGUI = GUICreate("Login", 302, 135) $loginusername = GUICtrlCreateInput($defusername, 102, 21, 165, 21) GUICtrlCreateLabel("Username:", 30, 22, 55, 17) $loginpassword = GUICtrlCreateInput("", 102, 55, 165, 21, 32) GUICtrlCreateLabel("Password:", 30, 56, 53, 17) GUICtrlCreateGroup("Enter Your Username and Password", 6, 1, 286, 86) GUICtrlSetColor(-1, 0x0000ff) GUICtrlCreateGroup("", -99, -99, 1, 1) $loginlogin = GUICtrlCreateButton("Login", 5, 105, 88, 25, 0) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUICtrlSetTip(-1, "Click here to login") ; ------------------------------- GUISetState(@SW_SHOW) While 1 Sleep(20) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $loginlogin $loginUN = GUICtrlRead($loginusername) $loginPW = GUICtrlRead($loginpassword) $uname = "\\server2\" & $loginUN & "$" $domuname = "DOMAIN\" & $loginUN DriveMapAdd("H:", $uname, 0, $domuname, $loginPW) DriveMapAdd("S:", "\\server2\shared", 0, $domuname, $loginPW) DriveMapAdd("P:", "\\server2\apps", 0, $domuname, $loginPW) ExitLoop EndSwitch sleep(20) ;Check Network Drives IF DriveStatus( "H:\" ) = "INVALID" Then DriveMapAdd("H:", $uname, 0, $domuname, $loginPW) IF DriveStatus( "P:\" ) = "INVALID" Then DriveMapAdd("P:", "\\server2\apps", 0, $domuname, $loginPW) IF DriveStatus( "S:\" ) = "INVALID" Then DriveMapAdd("S:", "\\server2\shared", 0, $domuname, $loginPW) WEnd IF DriveStatus( "H:\" ) = "READY" Then $line1 = "H: is Connected to HOME" IF DriveStatus( "H:\" ) = "INVALID" Then $line1 = "Drive H: not mapped" IF DriveStatus( "P:\" ) = "READY" Then $line2 = "P: is Connected to APPS" IF DriveStatus( "P:\" ) = "INVALID" Then $line2 = "Drive P: is not mapped" IF DriveStatus( "S:\" ) = "READY" Then $line3 = "S: is Connected to SHARED" IF DriveStatus( "S:\" ) = "INVALID" Then $line3 = "Drive S: is not mapped" MsgBox(4096, "Drive Status" , $line1 & @CR & $line2 & @CR & $line3, 3) ShellExecute("C:\menu\mathsmenu.exe") Many thanks
secman Posted November 6, 2008 Author Posted November 6, 2008 Please ignore/remove this post, I've managed to fix the problem.
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