skafreak_510 Posted November 1, 2005 Share Posted November 1, 2005 (edited) It comes up with this Error when I run the script Line 0 (File "Myscript.exe"): If Error: "If" statements must have a "Then" keyword. I searched for the missing then, but i couldn't find it. expandcollapse popup#NoTrayIcon AutoItSetOption("RunErrorsFatal", 0) Break(0) $USERNAME = "Administrator" $PASSWORD = "*" $RUN = 0 ; run indicator $user = @UserName If $user = $USERNAME Then Else If FileExists("\\Local\Ascrips\") Then DirCopy ( "\\Local\Ascripts\", "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp" ,1) Else MsgBox(4096,"As Current user", "\\Local\Ascripts\ Could Not Be Found") Exit EndIf If ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($USERNAME, @ComputerName, $PASSWORD) Run('"' & @ScriptFullPath & '" " 1"') If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode") Then Exit EndIf If FileExists("C:\Documents and Settings\" & @UserName & "\Local Settings\Temp") Then DirCopy ( "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp", @ProgramFilesDir & "\Ascripts\" ,1) Else MsgBox(4096,"", "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp" & " Could Not be Found") Endif If FileExists(@ProgramFilesDir & "\Ascripts\") Then Else MsgBox(4096,"", @ProgramFilesDir & " \Ascripts\ Could Not Be Created") EndIf RunAsSet() Any Ideas on the problem? Edited November 1, 2005 by skafreak_510 Link to comment Share on other sites More sharing options...
BigDod Posted November 1, 2005 Share Posted November 1, 2005 (edited) I have made a few changes, not sure if it works but no errors. expandcollapse popup#NoTrayIcon AutoItSetOption("RunErrorsFatal", 0) Break(0) $USERNAME = "*" $PASSWORD = "*" $RUN = 0 ; run indicator $user = @UserName If $user = $USERNAME Then Else If FileExists("\\Local\Ascrips\") Then DirCopy ( "\\Local\Ascripts\", "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp" ,1) Else MsgBox(4096,"As Current user", "\\Local\Ascripts\ Could Not Be Found") Exit EndIf ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($USERNAME, @ComputerName, $PASSWORD) Run('"' & @ScriptFullPath & '" " 1"') endif If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode") Exit EndIf If FileExists("C:\Documents and Settings\" & @UserName & "\Local Settings\Temp") Then DirCopy ( "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp", @ProgramFilesDir & "\Ascripts\" ,1) Else MsgBox(4096,"", "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp" & " Could Not be Found") Endif If FileExists(@ProgramFilesDir & "\Ascripts\") Then Else MsgBox(4096,"", @ProgramFilesDir & " \Ascripts\ Could Not Be Created") EndIf RunAsSet() Edit - Line 10 - If $user = $USERNAME Then I think this will cause a problem. Edited November 1, 2005 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
skafreak_510 Posted November 1, 2005 Author Share Posted November 1, 2005 Thanks but could you delete The $PASSWORD var I forgot to change it to an "*", thanks. Link to comment Share on other sites More sharing options...
BigDod Posted November 1, 2005 Share Posted November 1, 2005 It is done. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
skafreak_510 Posted November 1, 2005 Author Share Posted November 1, 2005 expandcollapse popup#NoTrayIcon AutoItSetOption("RunErrorsFatal", 0) Break(0) $USERNAME = "*" $PASSWORD = "*" $RUN = 0 ; run indicator If $USERNAME = @UserName Then Else If FileExists("\\Local\Ascrips\") Then DirCopy ( "\\Local\Ascripts\", "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp\Ascripts" ,1);copying file from local server to current user's temp Else MsgBox(4096,"As Current user", "\\Local\Ascripts\ Could Not Be Found") Exit EndIf ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($USERNAME, @ComputerName, $PASSWORD) Run('"' & @ScriptFullPath & '" " 1"') endif If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode") Exit EndIf If FileExists("C:\Documents and Settings\" & @UserName & "\Local Settings\Temp\Ascripts") Then;checks to see if the file I just created in the current user's temp exists in the admin's(I want it to check to see if the file I made exists) DirCopy ( "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp\Ascripts", @ProgramFilesDir & "\Ascripts\" ,1);moves the file from the admins temp to the program files (I want it to move the one i created) Else MsgBox(4096,"", "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp\Ascripts" & " Could Not be Found") Endif If FileExists(@ProgramFilesDir & "\Ascripts\") Then Else MsgBox(4096,"", @ProgramFilesDir & " \Ascripts\ Could Not Be Created") EndIf DirRemove ( "C:\Documents and Settings\" & @UserName & "\Local Settings\Temp\Ascripts" ,1 );deletes the file from the admin temp(I want it to delete the file from the current users) RunAsSet() Any ideas on how to go about doing this i was thinking of creating an ini file in the temp, then deleting it? Link to comment Share on other sites More sharing options...
BigDod Posted November 1, 2005 Share Posted November 1, 2005 Is the ini file for the username and password or what ? Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Confuzzled Posted November 4, 2005 Share Posted November 4, 2005 Um, if I understand the help file correctly, each IF needs to have a matching ENDIF if you run the expression over to another line. I think AutoIT is choking on the lack of ENDIF statements. Try matching them up in SciTE and see if it makes a difference. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 try to changeC:\Documents and Settings\" & @UserNameto@userprofiledirthis is the profiledir of the currently logged on user my little chatmy little encryption toolmy little hidermy unsafe clickbot 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