Jump to content

Recommended Posts

Posted

When I run my script it gives me an error about not parsing function and a line -1 I dont know how to fix this

Did I write something wrong?

Below is my script, edited for security reasons...

$username = InputBox("OLD LAPTOP USERNAME", "Please type in the User Name of the computer")

$ipaddress = InputBox("OLD LAPTOP IP ADDRESS", "Please type in the IpAddress of the computer")

$answer = MsgBox(4, "NEW OR UPDATE 7?", "If the OLD Laptop is a NEW IMAGE Click YES")


; Check the user's answer to the prompt, if Yes is clicked (6), it is a NEW image)
; If "No" was clicked (7) then it is a UPD 7 Image
If $answer = 6 Then; Handle NEW Image
    Run(@ComSpec & " /k " & 'net use X: \\' & $ipaddress & '\c$ password /user:' & $ipaddress & '\adminaccount /persistent:no', "", @SW_HIDE)
    SLEEP(15000)
    If FileExists("X:\") Then
         Run(@ComSpec & " /k " &  "xcopy ""X:\documents and settings\" & $username & "\my documents\*.*"" ""C:\documents and settings\" & $username & "\my documents\"" /e/f/y" , "", )
         Run(@ComSpec & " /k " &  "xcopy ""X:\documents and settings\" & $username & "\favorites\*.*"" ""C:\documents and settings\" & $username & "\favorites\"" /e/f/y" , "", ) 
         Run(@ComSpec & " /k " &  "xcopy ""X:\documents and settings\" & $username & "\Desktop\*.*"" ""C:\documents and settings\" & $username & "\Desktop\"" /e/f/y" , "", ) 
    Else
         MsgBox(0,"Error!", "Unable to map network drive.")
    EndIf

Else
    Run(@ComSpec & " /k " & 'net use X: \\' & $ipaddress & '\c$ password /user:' & $ipaddress & '\adminaccount /persistent:no', "", @SW_HIDE)
    SLEEP(15000)

    Run(@ComSpec & " /k " & 'net use Y: \\' & $ipaddress & '\d$ password /user:' & $ipaddress & '\adminaccount /persistent:no', "", @SW_HIDE)
    SLEEP(15000)
    If FileExists("Y:\") Then
         Run(@ComSpec & " /k " &  "xcopy ""Y:\documents and settings\" & $username & "\my documents\*.*"" ""D:\documents and settings\" & $username & "\my documents\"" /e/f/y" , "", )
         Run(@ComSpec & " /k " &  "xcopy ""Y:\documents and settings\" & $username & "\favorites\*.*"" ""D:\documents and settings\" & $username & "\favorites\"" /e/f/y" , "", )
         Run(@ComSpec & " /k " &  "xcopy ""Y:\documents and settings\" & $username & "\Desktop\*.*"" ""C:\documents and settings\" & $username & "\Desktop\"" /e/f/y" , "", ) 
     Else 
        MsgBox(0,"Error!", "Unable to map network drive.")
    EndIf 
    If FileExists("X:\") Then
         Run(@ComSpec & " /k " &  'xcopy "X:\program files\ariss\db\*.*" "C:\program files\ariss\db\" /e/f' , "", )
         Run(@ComSpec & " /k " &  'xcopy "X:\program files\ariss\logs\*.*" "C:\program files\ariss\logs\" /e/f' , "", )
         Run(@ComSpec & " /k " &  'xcopy "X:\Girth\*.*" "C:\Girth\" /e/f/y' , "", )
         Run(@ComSpec & " /k " &  'xcopy "X:\epsq2xso\*.*" "C:\epsq2xso\" /e/f/y' , "", )
     Else 
        MsgBox(0,"Error!", "Unable to map network drive.")
    EndIf 
EndIf
Posted (edited)

Just add:

Opt("TrayIconDebug", 1)

And (when an error occur) look over tray icon to find the line number with error.

BTW, why aren't you using Run("C:\WINDOWS\NET.EXE ...") or Run("C:\WINDOWS\COMMAND\XCOPY32.EXE ...")?

Using Comspec is not good solution in my opinion...

Edited by Jacek
  • Developers
Posted

Just add:

Opt("TrayIconDebug", 1)

And (when an error occur) look over tray icon the line number.

BTW, why aren't you using Run("C:\WINDOWS\NET.EXE ...") or Run("C:\WINDOWS\COMMAND\XCOPY32.EXE ...")?

Nah... this is about the syntax not being right .... that can easily be checked with au3check.

The Debug option is more for "runaway" scripts in my mind :P

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Just add:

Opt("TrayIconDebug", 1)

And (when an error occur) look over tray icon to find the line number with error.

BTW, why aren't you using Run("C:\WINDOWS\NET.EXE ...") or Run("C:\WINDOWS\COMMAND\XCOPY32.EXE ...")?

Using Comspec is not good solution in my opinion...

That would not work at all on my computer whereas @comspec usually does.
Posted

I found out the issue early this morning. Thank you for your help.

It wasn't a syntax error, but it was if that makes sense...

The account on the old machine was a unique name, and the script was looking for y:\documents and settings\user\Desktop

when the account was named user documents... this was a unique instance one one machine out of 5000 that had an account incorrectly cached, so everything is good.

Thank you all for the assistance.

Posted

I found out the issue early this morning. Thank you for your help.

It wasn't a syntax error, but it was if that makes sense...

The account on the old machine was a unique name, and the script was looking for y:\documents and settings\user\Desktop

when the account was named user documents... this was a unique instance one one machine out of 5000 that had an account incorrectly cached, so everything is good.

Thank you all for the assistance.

Not a syntax error? How could you NOT have a syntax error from all those Run() lines that end with a comma and no parameter? Like this:

Run(@ComSpec & " /k " &  'xcopy "X:\Girth\*.*" "C:\Girth\" /e/f/y' , "", )

The syntax checker barfs on every line you did that.

Some languages accept blank parameters as "Default", but not AutoIt.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted

Not a syntax error? How could you NOT have a syntax error from all those Run() lines that end with a comma and no parameter? Like this:

Run(@ComSpec & " /k " &  'xcopy "X:\Girth\*.*" "C:\Girth\" /e/f/y' , "", )

The syntax checker barfs on every line you did that.

Some languages accept blank parameters as "Default", but not AutoIt.

:P

Yea, that was another error. See I used an old script, (I think version 2 I don't know but I picked up where someone left off from before...

they used the script like 4 years ago and it worked fine... Now we have to change out machines again and a lot has changed

I did descover that error after I fixed the previous username error. But at the time, I wasn't worried about that one. One step at a time ;)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...