Jump to content

Illegal text error & Share path problem


Recommended Posts

Hi. I'm new to AutoIt, and have a couple questions about a script I'm trying. The script automates user configuration for the SoftMax Pro application. It's pretty basic and seems to work...mostly. All it does is check to see that the app is running (Windows Exists). If so it clicks a menu item, navigates to a network share and submits some credentials. And that's about it. I've compiled it into an .exe so end users can run this.

Seems to work just fine for me and a coworker on an XP machine in VMWare. For an actual remote user though the script also runs, but when complete throws up an error window that reads:

Line-1:

Error: Illegal text at the end of statement (one statement per line).

A second issue I ran into was for a longer version of this same code. Code did the same stuff except if the application wasn't running, it automatically launched it. Everything worked fine there too until I tried to SEND the share path \\chafps01\data\etc., et...

No matter how I tried formatting the line it would drop one or both of the leading \ marks and fail out on the network path. The same syntax however works just fine if the application is already running before I launch the script. I'm pretty puzzled.

Any thoughts are appreciated. Code is below:

; Script to automate user configuration for SoftMax Pro 4.3.1
; AutoIT v3 Script created with SciTE4AutoIt3 editor
; Created by: Timothy Hatter
; Created on: 11/21/2007

Global $path = "\\chafps01\Data\Softmax 431\User\Production Users.edb"
Global $username = "user"
Global $password = "pass"

; Checks to see if SoftMax Pro application window is open
If WinExists("SOFTmax Pro") Then
    
    WinActivate("SOFTmax Pro")

; Check for User Group database not set message window. If present, clear the window and proceed.
    If WinExists("SOFTmax Pro", "User Group database not set.") Then
    
    ; Presses ENTER key for user group database error message box.
        Send("{ENTER}")
        WinWaitActive("SOFTmax Pro")
    
    ; Waits for SoftMax Pro application window to be active
        WinWaitActive("SOFTmax Pro")
    ; Sends keystrokes to open security drop-down to configure user database
        Sleep(250)
        Send("!s""{ENTER}")
        Sleep(250)

    ; Sends text to navigate to the database network share
        Send($path)
        Sleep(500)
        Send("{ENTER}")
    
    ; Sends administrator credentials to configure the user
        WinWait("Administrator Log On")
        Send($username)
        Send("{TAB}")
        Sleep(250)
        Send($password)
        Send("{ENTER}")
        Sleep(250)
        
    ; Alerts the user that the application is now ready for use
        MsgBox(0, "Notice", "SoftMax Pro is now configured and ready to use.")
        
    Else 
    ; Waits for SoftMax Pro application window to be active
        WinWaitActive("SOFTmax Pro")
    ; Sends keystrokes to open security drop-down to configure user database
        Sleep(250)
        Send("!s""{ENTER}")
        Sleep(250)

    ; Sends text to navigate to the database network share
        Send($path)
        Sleep(500)
        Send("{ENTER}")
    
    ; Sends administrator credentials to configure the user
        WinWait("Administrator Log On")
        Send($username)
        Send("{TAB}")
        Sleep(250)
        Send($password)
        Send("{ENTER}")
        Sleep(250)
        
    ; Alerts the user that the application is now ready for use
        MsgBox(0, "Notice", "SoftMax Pro is now configured and ready to use.")
    EndIf
    
Else
    
; Message box instructing the user to open SoftMax Pro and re-run the script
    MsgBox(0, "Notice", "SoftMax Pro is not running. Please open SoftMax Pro, and re-run the configuration tool.")
    
EndIf
Link to comment
Share on other sites

Was curious if anyone had any thoughts or feedback on the below issue I described?

Thanks...

Hi. I'm new to AutoIt, and have a couple questions about a script I'm trying. The script automates user configuration for the SoftMax Pro application. It's pretty basic and seems to work...mostly. All it does is check to see that the app is running (Windows Exists). If so it clicks a menu item, navigates to a network share and submits some credentials. And that's about it. I've compiled it into an .exe so end users can run this.

Seems to work just fine for me and a coworker on an XP machine in VMWare. For an actual remote user though the script also runs, but when complete throws up an error window that reads:

Line-1:

Error: Illegal text at the end of statement (one statement per line).

A second issue I ran into was for a longer version of this same code. Code did the same stuff except if the application wasn't running, it automatically launched it. Everything worked fine there too until I tried to SEND the share path \\chafps01\data\etc., et...

No matter how I tried formatting the line it would drop one or both of the leading \ marks and fail out on the network path. The same syntax however works just fine if the application is already running before I launch the script. I'm pretty puzzled.

Any thoughts are appreciated. Code is below:

; Script to automate user configuration for SoftMax Pro 4.3.1
; AutoIT v3 Script created with SciTE4AutoIt3 editor
; Created by: Timothy Hatter
; Created on: 11/21/2007

Global $path = "\\chafps01\Data\Softmax 431\User\Production Users.edb"
Global $username = "user"
Global $password = "pass"

; Checks to see if SoftMax Pro application window is open
If WinExists("SOFTmax Pro") Then
    
    WinActivate("SOFTmax Pro")

; Check for User Group database not set message window. If present, clear the window and proceed.
    If WinExists("SOFTmax Pro", "User Group database not set.") Then
    
; Presses ENTER key for user group database error message box.
        Send("{ENTER}")
        WinWaitActive("SOFTmax Pro")
    
; Waits for SoftMax Pro application window to be active
        WinWaitActive("SOFTmax Pro")
; Sends keystrokes to open security drop-down to configure user database
        Sleep(250)
        Send("!s""{ENTER}")
        Sleep(250)

; Sends text to navigate to the database network share
        Send($path)
        Sleep(500)
        Send("{ENTER}")
    
; Sends administrator credentials to configure the user
        WinWait("Administrator Log On")
        Send($username)
        Send("{TAB}")
        Sleep(250)
        Send($password)
        Send("{ENTER}")
        Sleep(250)
        
; Alerts the user that the application is now ready for use
        MsgBox(0, "Notice", "SoftMax Pro is now configured and ready to use.")
        
    Else 
; Waits for SoftMax Pro application window to be active
        WinWaitActive("SOFTmax Pro")
; Sends keystrokes to open security drop-down to configure user database
        Sleep(250)
        Send("!s""{ENTER}")
        Sleep(250)

; Sends text to navigate to the database network share
        Send($path)
        Sleep(500)
        Send("{ENTER}")
    
; Sends administrator credentials to configure the user
        WinWait("Administrator Log On")
        Send($username)
        Send("{TAB}")
        Sleep(250)
        Send($password)
        Send("{ENTER}")
        Sleep(250)
        
; Alerts the user that the application is now ready for use
        MsgBox(0, "Notice", "SoftMax Pro is now configured and ready to use.")
    EndIf
    
Else
    
; Message box instructing the user to open SoftMax Pro and re-run the script
    MsgBox(0, "Notice", "SoftMax Pro is not running. Please open SoftMax Pro, and re-run the configuration tool.")
    
EndIf
Link to comment
Share on other sites

Is this syntax allowed Send("!s""{ENTER}")???

Hmm... that's interesting. Never noticed it before.

All of these do exactly the same thing as a one-line script:

Send("!s""{ENTER}")oÝ÷ Ù«­¢+ÙM¹ ÅÕ½ÐìÌÌíÌÅÕ½ÐìµÀìÅÕ½Ðíí9QIôÅÕ½Ðì¤oÝ÷ Ù«­¢+ÙM¹ ÅÕ½ÐìÌÌíÍí9QIôÅÕ½Ðì¤

Send() just isn't that picky about how you append strings together...

: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
Link to comment
Share on other sites

Any thoughts on my original error that I described:

Line-1:

Error: Illegal text at the end of statement (one statement per line).

...From what I read thus far I wasn't sure what could account for this error...or more specifically what in my code, converted to an .exe, could result in this error on an end user's system?

Hmm... that's interesting. Never noticed it before.

All of these do exactly the same thing as a one-line script:

Send("!s""{ENTER}")oÝ÷ Ù«­¢+ÙM¹ ÅÕ½ÐìÌÌíÌÅÕ½ÐìµÀìÅÕ½Ðíí9QIôÅÕ½Ðì¤oÝ÷ Ù«­¢+ÙM¹ ÅÕ½ÐìÌÌíÍí9QIôÅÕ½Ðì¤

Send() just isn't that picky about how you append strings together...

:P

Link to comment
Share on other sites

  • Developers

Hmm... that's interesting. Never noticed it before.

All of these do exactly the same thing as a one-line script:

Send() just isn't that picky about how you append strings together...

:P

I would think that :

Send("!s""{ENTER}")

is the same as:

Send('!s"{ENTER}')

;)

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.
  :)

Link to comment
Share on other sites

I get no error on my test system. The end user got that error a couple times, but not today. They don't have AutoIt installed, and are just running it from a compiled .exe that I made from AutoIt.

The shown code looks correct ... do you get any error when running it with AutoIt3 ?

Link to comment
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
 Share

  • Recently Browsing   0 members

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