This question already has answers here:
Control-Alt-Delete from python or command line
(7 answers)
Closed 7 years ago.
I am trying to generate a python script command line for the shortcut in ctrl alt del or go directly in "change a password", Or any executable file for that shortcut in windows 8.
I already refer to this question but its not working for me.
.NET Simulate Ctrl+Alt+Del Sendkeys
My target is create an app or way directly to change a password in windows 8 or ctrl alt del and then click change a password
Any suggestion/comments, thanks in advance.
As all of the answers on that question state, its very unlikely that you will be able to send this specific key combination.
Crtl+Alt+Del is a privileged key combination in Windows, and I'd guess any rudimentary attempt to simulate it won't be acknowledged by Windows - for a good reason.
Most answers I've seen suggest you'll need to either use the win32com library or ctypes in Python. I won't link to them, but they are searchable using "python simulate crtl alt del".
In either case, you still need to run the app at elevated privileges which still negates the ease of use.
I'd strongly recommend that you don't do this.
Related
This question already has answers here:
Open web in new tab Selenium + Python
(21 answers)
How to open multiple webpages in separate tabs within a browser using selenium-webdriver and python
(1 answer)
What is the fastest way to open urls in new tabs via Selenium - Python?
(2 answers)
Closed 2 years ago.
I'm just trying to open a new tab, but it never happens. I don't receive any error messages either. I've tried the following methods.
driver.find_element_by_tag_name("body").send_keys(Keys.CONTROL + 't')
ActionChains(driver).send_keys(Keys.CONTROL, 't').perform()
ActionChains(driver).key_down(Keys.CONTROL).send_keys('t').key_up(Keys.CONTROL).perform()
I've also tried adding "driver.find_element_by_tag_name('body').click()" in front of each to force Selenium to focus on the window. I would greatly appreciate help with this.
Thank you.
P.S. This applies for ALL Keyboard shortcuts. I just used Ctrl+T as an example.
This question already has an answer here:
python IDLE shell appears not to handle some escapes correctly
(1 answer)
Closed 3 years ago.
I'm a Raspberry Pi using Thonny Python's IDE to code, and whenever I try to use a backspace in the form of '\b', it outputs as a check mark:
Like this one
I've already looked at some articles on here and only a few mention a GUI bug within Tkinter, but since I'm not using that I'm not sure what's going on. I've also tested it with a simple print('a\b') command in the IDLE, but it still comes out with the check mark following the a.
For reference, I'm using code from this answer: https://stackoverflow.com/a/39504463/11357553
It's specifically this part that produces the oddity:
sys.stdout.write('\b')
sys.stdout.flush()
I'm simply looking to complete the provided function by deleting the most recent character printed to the spinning cursor. I'm rather new and have been able to solve most of my problems, but this one leaves me stuck.
IDLE does not implement a terminal. It does not process either control characters or escape sequences. Run your program in an actual terminal emulator and not via IDLE.
IDLE uses tkinter to implement its GUI. It uses two TK text areas to form the editor and console parts of its windows.
This question already has answers here:
PyQt - how to detect and close UI if it's already running?
(3 answers)
Closed 7 years ago.
I have created a pyqt4 app and I want to make it so only one instance (of QApplication) is allowed to run.
The program reads and writes audio files, and if more than 1 instance is running, Windows (linux is fine) throws errors that 2 programs are trying to access the same files. I see a lot of java and C apps that will display a simple dialog if the program is already running, I just want to know how to do this in pyqt4.
A little help?
This kind of programming pattern is called a "singleton" instance or a "singleton application".
Usually it is done with a global mutex or by locking a file early in the life of the program.
And when you program launches, if the file handle is already locked, then you exit.
Qt Solutions has it here: http://doc.qt.digia.com/solutions/4/qtsingleapplication/qtsingleapplication.html
https://qt.gitorious.org/qt-solutions/qt-solutions/source/841982ceec9d30a7ab7324979a0fd5c9c36fd121:qtsingleapplication
It would probably take a bit of work to get those global mutexes/locks to work in pyqt, since pyqt doesn't have the qt-solutions part in it yet as far as I could tell.
Here is an alternative that uses a cross platform python script:
Python: single instance of program
Hope that helps.
Thanks. I Used https://gitorious.org/qsingleapplication/qsingleapplication/source/ca13324b0f5bdfcaf4e379a78108f0bd85fed98a:qSingleApplication.py#L66 And Called QSingleApplication On My MainWindow And Works Fine
This question already has answers here:
How to download image using requests
(17 answers)
Closed 3 years ago.
I have a link say, "http://www.prt-inc.com/forecast.csv"
I use this code to open the link
import webbrowser
webbrowser.open('http://www.prt-inc.com/forecast.csv')
Now this link opens a 'File Download' popup. The popup has 'open' 'save' 'cancel' on it.
I would like to write code that would 'click' on open or save and work with the file. But also I wouldn't want the link to physically open up in a browswer, just do it all in the background if possible. So I'm not sure if using 'webbrowser' is the proper thing to use.
I am a beginner in python and not sure at all where to start or if there is different libraries to use to do this type of thing.
If I could get some hints or tips, or get pointed in the right direction that would be great.
If you need to work with the file I think you'd be better off using the urllib2 library
import urllib2
urllib2.urlopen("http://google.com").read()
This is assuming you have python 2.x. Python 3.x has some slight variations
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Key Presses in Python
I want to know if there is a easy way to make python act as a keyboard. I have a CNC mill that runs off a windows machine using Mach 3.
I want to create a python script that will jog the mill for me. To jog the mill you just press buttons on a keyboard to move normally.
So is there a python library that will act as a keyboard in a different program?
If you must use python, try pywinauto or AutoPy.
I prefer AutoIt or AutoHotKey.