Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Is it possible to script an auto login to a software program?

  • 04-01-2016 6:55pm
    #1
    Moderators, Motoring & Transport Moderators, Music Moderators Posts: 12,781 Mod ✭✭✭✭


    I'm not a coder at all but I read about programmers 'scripting' to automate everyday things they do to save them a few click etc. I have a program that I have to run often and when I run it, I have to click the mouse in the box, type in the password and then click OK. Its not very well designed so you can't even type or hit enter.

    I have zero idea how this might work or if its even possible but can anyone enlighted me as to if this is possible and point me in the right direction of how?


Comments

  • Registered Users, Registered Users 2 Posts: 772 ✭✭✭maki


    If you could login to the application using the keyboard alone it's fairly trivial with VBScript, but it gets a lot trickier when you need to simulate mouse clicks.

    AutoHotKey should do what you want though.


  • Registered Users, Registered Users 2 Posts: 9,605 ✭✭✭gctest50


    Zascar wrote: »
    I'm not a coder at all but I read about programmers 'scripting' to automate everyday things they do to save them a few click etc. I have a program that I have to run often and when I run it, I have to click the mouse in the box, type in the password and then click OK. Its not very well designed so you can't even type or hit enter.

    I have zero idea how this might work or if its even possible but can anyone enlighted me as to if this is possible and point me in the right direction of how?

    what does the program do (roughly) ?

    if you can't replace it this yoke might help :


    AutoIt

    AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

    AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect

    https://www.autoitscript.com/site/autoit/


  • Moderators, Motoring & Transport Moderators, Music Moderators Posts: 12,781 Mod ✭✭✭✭Zascar


    Thanks for that lads. It's connecting to a VPN and The reason i want to automate this is every time you close the lid etc you have to reconnect.
    maki wrote: »
    If you could login to the application using the keyboard alone it's fairly trivial with VBScript, but it gets a lot trickier when you need to simulate mouse clicks.

    I just tried it again there and actually you can tab around to make it work.
    So it's click to run program (It's connecting to a vpn)
    Tab twice to hit and hit Enter on the connect button
    Wait for it to connect, password box pops up and you type in the password, plus Enter.

    That's it. What program would be easiest for me to automate this - me not being technical?

    Thanks


  • Registered Users, Registered Users 2 Posts: 9,605 ✭✭✭gctest50


    https://www.autoitscript.com/site/autoit/

    just has scripts like this, good few examples :
    #include <Constants.au3>

    ;
    ; AutoIt Version: 3.0
    ; Language: English
    ; Platform: Win9x/NT
    ; Author: Jonathan Bennett (jon at autoitscript dot com)
    ;
    ; Script Function:
    ; Opens Notepad, types in some text and then quits the application.
    ;



    ; Run Notepad
    Run("notepad.exe")

    ; Wait for the Notepad to become active. The classname "Notepad" is monitored instead of the window title
    WinWaitActive("[CLASS:Notepad]")

    ; Now that the Notepad window is active type some text
    Send("Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")
    Sleep(500)
    Send("+{UP 2}")
    Sleep(500)

    ; Now quit by pressing Alt-F and then scrolling down (simulating the down arrow being pressed six times) to the Exit menu
    Send("!f")
    Sleep(1000)
    Send("{DOWN 6}{ENTER}")

    ; Now a screen will pop up and ask to save the changes, the classname of the window is called
    ; "#32770" and simulating the "TAB" key to move to the second button in which the "ENTER" is simulated to not "save the file"
    WinWaitActive("[CLASS:#32770]")
    Sleep(500)
    Send("{TAB}{ENTER}")

    ; Now wait for Notepad to close before continuing
    WinWaitClose("[CLASS:Notepad]")

    ; Finished!


  • Closed Accounts Posts: 5,824 ✭✭✭RoyalMarine


    autoIT is the way to go.

    I've written a few in the past, in fact, I wrote one for connecting to VPN's.

    I'll have a dig around on my computer when I get home and see if I can find it.
    Drop me a PM so I remember if you want OP.


  • Advertisement
  • Moderators, Motoring & Transport Moderators, Music Moderators Posts: 12,781 Mod ✭✭✭✭Zascar


    Thanks RoyalMarine that would be great.

    So I downloaded the two above and had a play - you may laugh but I've no idea what I'm doing and get totally lost. I was hoping that it would be as simple as 'press record - do the actions - and it would save it into a script'. Unfortunately it seems you have to hand code it and it does not seem simple to me.

    Is there a way I can get my head around?


  • Registered Users, Registered Users 2 Posts: 9,605 ✭✭✭gctest50


    Zascar wrote: »

    Is there a way I can get my head around?

    yip,

    run the thing called Au3Info , then click on the "Finder Tool " crosshairs thing on the right hand side of it


    zdnbaS4.jpg


  • Registered Users, Registered Users 2 Posts: 36,170 ✭✭✭✭ED E


    I use Keepass 2 as my pw manager and it should do exactly what you need. You can set macros on a per entry basis to login to anything you'd like.


Advertisement