Jump to content

MouseClick not working with run as administrator application - (Moved)


Recommended Posts

Hi experts!

I am still a newbie in AUTOIT. I intend to automate a 15 mins burn in test application to test on industrial PC. The application is limited to 15 mins due to free evaluation mode. 

Problem: Mouseclick is unable to function in this application. However, when I test it on Notepad, it works. I believe it is due to "run as administrator " limitation. I tried implementing the RunAs command, however the error says "unknown function name".

Could somebody kindly help to point out what has gone wrong?

Below is the script I used. 

#include <AutoItConstants.au3>
Dim $ChipRunFileName


AutoItSetOption("MouseCoordMode",1)
Opt("WinTitleMatchMode", 3)

;$maincycles = 3
$trailingchipnumber = 0

; Change the username and password to the appropriate values for your system.
Local $sUserName = "Chewy"
Local $sPassword = "12345678"

; Run Notepad with the window maximized. Notepad is run under the user previously specified.
Local $iPID = RunAs($sUserName, Chewy, $sPassword, $RUN_LOGON_PROFILE, "bit.exe")

RunTestCycle(100)


Func RunTestCycle($noOfTimes)

    For $i = 1 to $noOfTimes Step 1

        Sleep(4000)

        MouseClick("left",771,10)

        Sleep(1000)

        ;click Go
        MouseClick("left",40,135)


          Sleep(1000)

        ;wait 15.5 mins
        Sleep(930000)

        ; Click save
        MouseClick("left",1398,93)

        ; select text box
        MouseClick("left", 854, 353)

        ControlSetText ( "Save results report", "", 1000, "")

         ; select text box
        MouseClick("left", 854, 353)

        ;put manual barcode
        $trailingchipnumber = $trailingchipnumber + 1
        Send("D:\Programs\BurnInTest\BurnInTestLog" & $trailingchipnumber)
        MouseClick("left", 839, 406)     ; select log
        Sleep(1000)

        ; select Save
        MouseClick("left", 688, 502)

        Sleep(1000)

        ; select Reset
        MouseClick("left", 52, 129)

        Sleep(1000)

        ; select OK
        MouseClick("left", 765, 494)

        Sleep(1000)

    Next

    ; Quit Application
    MouseClick("left",1514,16)

    Sleep(1000)

    ProcessClose($iPID)


EndFunc

 

Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

VanessaWen,

Welcome to the AutoIt forums. I have moved your thread to the appropriate forum.

When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation.

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Developers
7 minutes ago, VanessaWen said:

Problem: Mouseclick is unable to function in this application. However, when I test it on Notepad, it works. I believe it is due to "run as administrator " limitation. I tried implementing the RunAs command, however the error says "unknown function name".

Make sure you run the script with the same credentials at the same level as the shelled program or else it will be hard to automate that shelled script.
Normally added @requireAdmin at the top will do the job as your script is then (re)shelled as Administrator after you clicked the UAC prompt.

Jos 

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

Hi Jos,

Hmm, it is not I am looking for. What I meant is, the BurnInTest Application is run with administrator right. The Autoit script mouse click is not working with BurnInTest app. 

 

requireAdmin is meant for allowing only administrator to run the script right? 

I dont need administrator right to run the script, but letting the script to have the administrator right to run the BurnInTest.

 

Link to comment
Share on other sites

  • Developers
16 minutes ago, VanessaWen said:

requireAdmin is meant for allowing only administrator to run the script right? 

No ....  it will force the script to be run with Administration rights...  Maybe reread my previous post which does explain why I proposed it? ;) 

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

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