Jump to content

<Please Delete! Solved> - Send keys to cmd.exe only working if already open


Recommended Posts

I wrote a script to auto login to Macola. I have to run a .bat, send the keys to the cmd.exe window.

Problem im having is the script will run the .bat.....but it seems the keys arent sent.....unless I already have the same .bat running!! 

So I have 2 instances of the batch file going.... 

The commented out lines are all the things ive tried...some just flash the batch on screen and then it closes....what is not commented out does work, but only if I run the batch file first then run the script...also the ######### is the password blocked out for obvious reasons!

Any clues after searching the forums, help, goggle?

Thanks in advance!

#include <AutoItConstants.au3>

;Local $iPID = Run("C:\Users\cwright\Desktop\Frd-macolatest Macola.bat", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

Run("C:\Users\cwright\Desktop\Frd-macolatest Macola.bat", @DesktopCommonDir)
;WinWait("[Class:ConsoleWindowClass]", 3)
;ControlSend("C:\windows\system32\cmd.exe", "", "", "#############" & @CR)
;ControlSend("classname=ConsoleWindowClass", "", "", "#############" & @CRLF)

WinActivate("[Class:ConsoleWindowClass]")


ControlSend("C:\windows\system32\cmd.exe", "", "", "#############" & @CR, 1)

;StdInWrite($iPID, "###############" & @CRLF)

 

Edited by Fractured
Link to comment
Share on other sites

  • Moderators

@Fractured as a rule we do not deleted threads. We have all had that experience where we post a question and then 2 minutes later figure it out ourselves. If you post a detailed explanation of what you did to resolve the issue, it may help someone down the road looking at the same problem.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@Fractured erm... Are you french ? 

 

This issue is interesting me, could you PM me please ? I am asking myself about testing that with admin dos-consoles

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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