-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How I can use the repo to type some command in a Python environment? #6
Comments
Hi,
Instead of
"UIDA_Document text_doc =
engine.GetTopLevel("Anaconda Prompt (Anaconda3)").Document("Text Area");
text_doc.SendKeys("dir");"
you can try:
UIDA_Window window = engine.GetTopLevel("Anaconda Prompt*");
window.SendKeys("dir");
If you want to press Enter after writing "dir" you can do this afterwards:
window.KeyPress(VirtualKeys.Enter);
Best regards.
În mie., 30 mar. 2022 la 18:40, zydjohnHotmail ***@***.***> a
scris:
… Hello:
Now, I have to run some Python command in a very specific Python
environment.
Message ID: ***@***.***>
|
Hi,
Where can I get that command window from?
Best regards.
În joi, 31 mar. 2022 la 00:13, zydjohnHotmail ***@***.***> a
scris:
… Hello:
I waited, the C# program finished without any error, but the command "dir"
did NOT appear on the screen.
Message ID: ***@***.***
com>
|
Hello: |
Hi,
What happens if you write something like this?
UIDA_Window type_window = engine.GetTopLevel("Anaconda Prompt*");
*type_window.BringToForeground();*
*type_window.Highlight();*
*type_window.Sleep(1000);*
type_window.SendKeys("dir");
type_window.KeyPress(VirtualKeys.Enter);
Does it bring the command window in front of the other windows? Does it
highlight the command window?
Best regards.
În joi, 31 mar. 2022 la 11:24, zydjohnHotmail ***@***.***> a
scris:
… Hello:
You have to install python (my version is 3.9.7) in Windows 10.
Then install anaconda (my version is 2021.11).
Message ID: ***@***.***
com>
|
Hi,
You can also try something like this:
UIDA_Window type_window = engine.GetTopLevel("Anaconda Prompt*");
type_window.BringToForeground();
engine.Sleep(1000);
type_window.KeyPress(VirtualKeys.D);
type_window.KeyPress(VirtualKeys.I);
type_window.KeyPress(VirtualKeys.R);
type_window.KeyPress(VirtualKeys.Enter);
Best regards.
În joi, 31 mar. 2022 la 00:13, zydjohnHotmail ***@***.***> a
scris:
… Hello:
Thanks for your reply, I have now changed my code, so it looks like this:
Engine engine = new Engine();
UIDA_Window type_window = engine.GetTopLevel("Anaconda Prompt*");
type_window.SendKeys("dir");
type_window.KeyPress(VirtualKeys.Enter);
Message ID: ***@***.***
com>
|
Hello: But none of them worked. |
Did the code bring the command prompt window in foreground?
|
Hi,
Did it work with a click before the SendKeys?
...
type_window.Click();
type_window.SendKeys("dir");
...
Best regards.
În vin., 1 apr. 2022 la 14:05, zydjohnHotmail ***@***.***> a
scris:
… Hello:
This I don't know, when I run my code, I simply click on the command
prompt window, so it is already in foreground.
But if I don't click on the command prompt, the command prompt did NOT
come to foreground.
So, I don't think the code works.
The picture shows when I clicked on command prompt, the same image when I
didn't click on command prompt.
Message ID: ***@***.***
com>
|
Hello: But it didn't work. |
Hi,
Can I reproduce the environment on Windows 7 32 bit?
Do I need to install Python too or Anaconda is enough to test the issue?
Best regards.
|
Hello: |
Try this:
UIDA_Window type_window = engine.GetTopLevel("Anaconda Prompt*");
type_window.BringToForeground();
engine.Sleep(500);
*type_window.Click();*
type_window.SendKeys("dir");
type_window.KeyPress(VirtualKeys.Enter);
Best regards.
|
I have Windows 7. I installed Anaconda and gave me an error about a missing
dll.
Best regards.
În vin., 1 apr. 2022 la 13:42, zydjohnHotmail ***@***.***> a
scris:
… Hello:
I have tried the both ways:But none of them worked.
If you can set up such environment, you can try and let me know which one
works in your environment.
Message ID: ***@***.***
com>
|
Hi,
Can we make a Team Viewer session to show me the command prompt window?
Best regards.
|
Hello: |
Hi,
I don't think having different versions of Windows will be a problem. I
have the last version of TeamViewer: 15.34.4
Best regards.
În mar., 11 oct. 2022 la 12:42, zydjohnHotmail ***@***.***> a
scris:
… Hello:
What Team Viewer you are using, which version?
By the way, I am using Windows 10, you are using Windows 7.
There could be some kind of issues.
Message ID: ***@***.***
com>
|
Hello: |
How about in one hour, 20:00 GMT+3 ? I don't know your time zone.
I need your ID which is on the first screen of Team Viewer and your
password.
If you don't agree with the hour you can choose another hour and let me
know.
Best regards.
În mar., 11 oct. 2022 la 15:39, zydjohnHotmail ***@***.***> a
scris:
… Hello:
I have just installed the same version for Window 10.
We can try to have a session later on.
What information is necessary for one session?
|
Hello: |
It's kind of difficult to automate Telegram Desktop because is not a
regular Windows application, it has special controls.
You can try to automate it (or any other application) with this tool:
http://uideskautomationstudio.epizy.com/
I managed to export the contents of one channel using this tool (by
creating an automated task). The idea is to pick an UI element from screen
then pick an action to perform on it, then another UI element and another
action and so on. You can check the examples.
It's kind of difficult to iterate through all the channels. To select one
channel in the left list I clicked the container (which contains all
channels) at a specified relative position.
Best regards.
În mar., 11 oct. 2022 la 19:17, zydjohnHotmail ***@***.***> a
scris:
… Hello:
I think the time is OK, but I didn't realize that you are talking about
old issue with Python, which I decied to give up, as Python is not good to
run for Windows 10, too many packages dependencies. However, I still want
to use the SPY tools to automate export public channel contents with
Telegram desktop.
If you know how to do this via SPY tools, let me know.
Message ID: ***@***.***
com>
|
Hello:
Now, I have to run some Python command in a very specific Python environment.
To launch this environment is rather complicated, but it is way more complicated to set it up.
However, after setting up the environment, I only need to run some Python command in the environment.
But I want to use the repo to run some command, for the simplest one is: dir
However, I can’t find which automation item I can use to sendkeys like: dir.
The following is my C# code:
using System;
using System.Threading.Tasks;
using UIDeskAutomationLib;
namespace RunCondaStyleGAN3Test
{
public class Program
{
static async Task Main(string[] args)
{
await Task.Delay(10000);
int return_code = 0;
if (args.Length == 0)
{
Console.WriteLine("Please enter at least one command");
return -1;
}
else
{
Engine engine = new Engine();
UIDA_Document text_doc =
engine.GetTopLevel("Anaconda Prompt (Anaconda3)").Document("Text Area");
text_doc.SendKeys("dir");
}
Console.WriteLine("Done");
return return_code;
}
}
}
However, my code didn’t work.
Please refer to the Spy screenshot and let me know how I can run a simple command, like “dir”
Thanks,
The text was updated successfully, but these errors were encountered: