Sign in to follow this  
Followers 0
JimmyTheExploder

Unterminated string error in recorded script

11 posts in this topic

Hi. Recorded my first script using the AU3Recorder. When I try to run it I'm getting an Unterminated string error on line 20, the line with just

")

on it:

#region --- Au3Recorder generated code Start ---

Run('C:\APSS-WIN\spss-set.exe')
_WinWaitActivate("Pack and Reindex data files","Index files are miss")
MouseClick("left",61,97,1)
_WinWaitActivate("SPSS Login","")
Send("mmm")
MouseClick("left",296,61,1)
_WinWaitActivate("SPSS","Printer Driver Gener")
MouseClick("left",102,83,1)
_WinWaitActivate("SPSS Setup","")
MouseMove(12,38)
MouseDown("left")
MouseMove(13,38)
MouseUp("left")
MouseClick("left",47,184,1)
_WinWaitActivate("Confirmation","Exit SPSS Setup?")
MouseClick("left",60,99,1)
")

#region --- Internal functions Au3Recorder Start ---
Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc
#endregion --- Internal functions Au3Recorder End ---

#endregion --- Au3Recorder generated code End ---
#endregion --- Au3Recorder generated code End ---

What the script is supposed to do is fire off an exe, which launches a program called SPSS. A Yes/No dialog is immediately presented. I clicked Yes. After that is a prompt for a username, which I entered. Then another dialog warning about a missing print driver. I clicked OK there. Then from the program's File menu I chose "Exit".

I saved the script that the recorder created, but now I'm getting the Unterminated string error. Not sure how to resolve it.

Share this post


Link to post
Share on other sites



Sorry, I should've noted that I tried that and it produced the following Program Errors:

1. File C:\builders.dbf does not exist.

2. Alias 'BUILDERS' is not found.

3. Variable 'USELOGO' is not found.

4. Variable 'LOGPICT' is not found.

5. Variable 'ENTRYPICT' is not found.

6. Variable 'DESKTOPCLR' is not found.

7. Function argument value, type, or count is invalid.

Then after all those, an "Error Encountered" dialog with the following info:

Error message: File 'C:\brand.dbf' does not exist.

Line of code with error: DO C:\apps-win\spss-set.exe [This is the exe I pointed to when I recorded the script]

Line number of error: 18

Program with Error: PROCEDURE BRANDVAR1.FILLARRAY CM_BRAND.FXP

That's not the entirety of the dialog, but hopefully includes pertinent info. After that another Program Error:

1. Operator/operand type mismatch.

And after that a dialog titled "Please Enter Error Description" that seems to repeat the info from the "Error Encountered" dialog described above.

Not sure what to try next to make the script work.

Share this post


Link to post
Share on other sites

Is that your entire script, what you posted? Because none of those errors refer to anything that's in the posted portion of your script. If you have more of your script that includes any of those words/variables/references then please post the part that isn't working so that we can try to figure out what the problem is.

As of right now, it appears to be your getting error messages from the SPSS setup program and not AutoIt.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

That's the entire script.

So any recommendations on how to proceed with building a new script? I reckon I could change the code to launch the app from Start > All Programs.

Can anyone point me to code that would mimic clicking the Start button first, then All Programs?

Thanks!

Share this post


Link to post
Share on other sites

Try setting the Run command to use the working directory parameter and have it set to the directory that the SPSS program in installed in. You might also want to look at the Start Menu shortcut that is used to start the program from there, and see if there are any parameters in the shortcut Properties that might be needed in your Run command line.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi. The Run command is already set to the directory that the SPSS program in installed in, and there aren't any additional parameters in the Start menu shortcut.

Share this post


Link to post
Share on other sites

Run('C:\APSS-WIN\spss-set.exe', 'C:\APSS-WIN')

This is what he meant.

Share this post


Link to post
Share on other sites

Doing that and removing line 20 (the double quote and closed paren line) got the script going. Whoo!

The app opens, but then the cursor flies off the screen instead of clicking the next dialog button I want it to.

I'll work on that on my own for a bit to see if I can resolve it. Thanks for the help!

Share this post


Link to post
Share on other sites

Second post gave you the answer from the code you provided:

#region --- Au3Recorder generated code Start ---

Run('C:\APSS-WIN\spss-set.exe')
_WinWaitActivate("Pack and Reindex data files","Index files are miss")
MouseClick("left",61,97,1)
_WinWaitActivate("SPSS Login","")
Send("mmm")
MouseClick("left",296,61,1)
_WinWaitActivate("SPSS","Printer Driver Gener")
MouseClick("left",102,83,1)
_WinWaitActivate("SPSS Setup","")
MouseMove(12,38)
MouseDown("left")
MouseMove(13,38)
MouseUp("left")
MouseClick("left",47,184,1)
_WinWaitActivate("Confirmation","Exit SPSS Setup?")
MouseClick("left",60,99,1)

#region --- Internal functions Au3Recorder Start ---
Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc
#endregion --- Internal functions Au3Recorder End ---

#endregion --- Au3Recorder generated code End ---
#endregion --- Au3Recorder generated code End ---
Use the popup code feature, copy and then paste it over you existing code.

[center]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.[/center]

Share this post


Link to post
Share on other sites

Actually the second post combined with the eigth post. Just removing the ") didn't result in the code working, but adding in the different Run command at least got the script to start working. Thanks again for the helpful suggestions.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0