Jump to content

Working within Terminal Services & AutoIt scripts issues


Recommended Posts

Hello everyone,

I'm currently new to AutoIt. I have the basic understanding of the potentials that this program can do. I've coded a basic script for automating Crystal Reports.

My company is within a terminal services environment. Being I'm an admin, when I install any software in my session, its automatically pushed to all users.

So, everyone has AutoIt on there session. Everyone can open AutoIt, create, edit and etc.

We have about 25 users all using Crystal Reports. This script is meant to make the users workload less.

I wrote a script that works flawlessly on my terminal session. If I build an exe file or copy the script to another users session.

It will run only for a few seconds and then pause. (Example: Only open the crystal reports file. Mouse spins like its going to do something and then it pauses. No refresh command is sent.)

I've searched for answers to why this happens. I've tried changing my code design to clean up all the unnecessary steps, to no prevail. I cannot get this script to run on other users sessions.

Being we are all logged into Terminal Services Windows Server 2008 R2 and I have admin rights, I thought it might be a permissions issue with users.

I created a "TEST" account and promoted it to Administrator. Copied the script and the exe file over. Tried both files. Same result: Opens the Crystal Report and then pauses.

I'm sure someone out there can help me address this issue. Many thanks in advance.

Please note: My code has been stripped of username and password information for this post.

Script steps:

1: Open Crystal reports file directly through Explorer.exe (Reason being is Crystal reports when opened directly with crw32.exe - it sometimes prompts for registration information)

2: Hits F5 to refresh and prompt for INPUT from user. (Ex: 123456)

3: Prompts for username and password to login to ODBC connection

4:Exports to PDF file, saves to local user Desktop\Reports directory and prints to default printer.

5:Closes without saving.

I have added code to also automatically email these attachments and that works perfectly.

As stated before, I've come a long way for just tackling this project the first of this week. Before this, I knew nothing about scripting in AutoIt.

I really want to find a solution to make this work throughout the company without having to look at other solutions.

Thank you!

============CODE BELOW===============

Run('C:\WINDOWS\EXPLORER.EXE /n,/e,F:\SHARED\Wall Street Tickets\Account.rpt')

WinWaitActive("Crystal Reports - [Account.rpt]","")

Send("{F5}")

WinWaitActive("Refresh Report Data","")

Send("{TAB}{TAB}{DOWN}{ENTER}")

WinWait("Enter Parameter Values","")

WinWait("ODBC (RDO)","")

WinWaitActive("ODBC (RDO)","")

Send("{TAB 8}{DEL}username{TAB}password{ENTER}")

WinWait("Crystal Reports - [Account.rpt]")

WinWaitActive("Crystal Reports - [Account.rpt]")

Send("{ALT}")

Send("{F}")

Send("{E}")

WinWait("Export")

WinWaitActive("Export")

Send("{ENTER}")

WinWait("Export Options")

WinWaitActive("Export Options")

Send("{ENTER}")

WinWait("Choose export file")

WinWaitActive("Choose export file")

Send("{TAB 5}")

Send("{SPACE}")

Send("{DEL}")

Send("C:\%USERPROFILE%\Desktop\Reports\");where file is being saved

Send("{ENTER}")

WinWait("Choose export file")

WinWaitActive("Choose export file")

Send("!S");saves file

WinWait("Crystal Reports - [Account.rpt]")

WinWaitActive("Crystal Reports - [Account.rpt]")

Send("{ALT}");send to default printer step1

Send("{F}");send to default printer step2

Send("{P}");send to default printer step3

Send("{P}");send to default printer step4

Send("{ENTER}") ;send to default printer step5

WinWait("Crystal Reports - [Account.rpt]")

WinWaitActive("Crystal Reports - [Account.rpt]")

Send("{ALT}")

Send("{F}")

Send("{X}")

WinWait("Crystal Reports")

WinWaitActive("Crystal Reports")

Send("{TAB 1}")

Send("{ENTER}")

forum_code.au3

Link to comment
Share on other sites

System. DSN from moxy (MoxyDSN32) - When you refresh, the user is prompted for the username and password to connect to our Moxy server for the connection.

What puzzled me is that I cannot run the script that I created in my session on other's sessions. Makes no sense to me.

Thank you for the reply!

Link to comment
Share on other sites

Partially resolved. Not sure why this is happening within Terminal Services.

I created new code as a typical user within the terminal services session. I able to run this from other users sessions now. However, Im still having a few quirks here and there. All this time I though code was code. Guess I will look at my permission settings per file?

Anyone else have experience with using AutoIt within a terminal services environment / crystal reports?

The forum said something about only allowed 3 posts. Hopefully this will change if I need to respond.

Thanks in advance for all responses.

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