Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72461 > unrolled thread
| Started by | Jaydeep Patil <patil.jay2009@gmail.com> |
|---|---|
| First post | 2014-06-02 21:28 -0700 |
| Last post | 2014-06-04 22:04 -0400 |
| Articles | 14 — 5 participants |
Back to article view | Back to comp.lang.python
Lock Windows Screen GUI using python Jaydeep Patil <patil.jay2009@gmail.com> - 2014-06-02 21:28 -0700
Re: Lock Windows Screen GUI using python Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-02 23:09 -0600
Re: Lock Windows Screen GUI using python Jaydeep Patil <patil.jay2009@gmail.com> - 2014-06-02 23:40 -0700
Re: Lock Windows Screen GUI using python Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-03 01:09 -0600
Re: Lock Windows Screen GUI using python Jaydeep Patil <patil.jay2009@gmail.com> - 2014-06-03 00:53 -0700
Re: Lock Windows Screen GUI using python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-03 09:05 +0100
Re: Lock Windows Screen GUI using python Chris Angelico <rosuav@gmail.com> - 2014-06-03 19:11 +1000
Re: Lock Windows Screen GUI using python Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-03 09:27 -0600
Re: Lock Windows Screen GUI using python Jaydeep Patil <patil.jay2009@gmail.com> - 2014-06-03 20:55 -0700
Re: Lock Windows Screen GUI using python Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-03 22:58 -0600
Re: Lock Windows Screen GUI using python Jaydeep Patil <patil.jay2009@gmail.com> - 2014-06-03 22:44 -0700
Re: Lock Windows Screen GUI using python Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-04 00:02 -0600
Re: Lock Windows Screen GUI using python Chris Angelico <rosuav@gmail.com> - 2014-06-04 21:21 +1000
Re: Lock Windows Screen GUI using python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-04 22:04 -0400
| From | Jaydeep Patil <patil.jay2009@gmail.com> |
|---|---|
| Date | 2014-06-02 21:28 -0700 |
| Subject | Lock Windows Screen GUI using python |
| Message-ID | <0d04724b-d800-407f-9614-1a86c4a58769@googlegroups.com> |
Dear all, Can we Lock Windows Screen GUI till program runs & unlock screen GUI when program finishes? Regards Jaydeep Paril
[toc] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-06-02 23:09 -0600 |
| Message-ID | <mailman.10590.1401772221.18130.python-list@python.org> |
| In reply to | #72461 |
On Mon, Jun 2, 2014 at 10:28 PM, Jaydeep Patil <patil.jay2009@gmail.com> wrote: > Dear all, > Can we Lock Windows Screen GUI till program runs & unlock screen GUI when program finishes? If you mean can you programmatically bring up the Windows lock screen, then you can do this: import ctypes ctypes.windll.user32.LockWorkStation() The only way to unlock it is for the user to log in. If you mean something else, you'll have to be more specific.
[toc] | [prev] | [next] | [standalone]
| From | Jaydeep Patil <patil.jay2009@gmail.com> |
|---|---|
| Date | 2014-06-02 23:40 -0700 |
| Message-ID | <a0ff3687-7d33-4748-8666-359a694cacd4@googlegroups.com> |
| In reply to | #72467 |
On Tuesday, 3 June 2014 10:39:31 UTC+5:30, Ian wrote: > On Mon, Jun 2, 2014 at 10:28 PM, Jaydeep Patil <patil.jay2009@gmail.com> wrote: > > > Dear all, > > > Can we Lock Windows Screen GUI till program runs & unlock screen GUI when program finishes? > > > > If you mean can you programmatically bring up the Windows lock screen, > > then you can do this: > > > > import ctypes > > ctypes.windll.user32.LockWorkStation() > > > > The only way to unlock it is for the user to log in. > > > > If you mean something else, you'll have to be more specific. Hi Lan, Currently I am doing some automation in python excel. It read the data & plots number of graphs. It took more than 20 minutes. So while running my python program if user clicks on excel, error came. So just i want to lock GUI not workstation. I hope you understand this. Let me know if you have any idea about it. Regards Jaydeep Patil
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-06-03 01:09 -0600 |
| Message-ID | <mailman.10599.1401779421.18130.python-list@python.org> |
| In reply to | #72482 |
On Tue, Jun 3, 2014 at 12:40 AM, Jaydeep Patil <patil.jay2009@gmail.com> wrote:
> Hi Lan,
>
> Currently I am doing some automation in python excel. It read the data & plots number of graphs. It took more than 20 minutes. So while running my python program if user clicks on excel, error came.
>
> So just i want to lock GUI not workstation.
>
> I hope you understand this.
>
> Let me know if you have any idea about it.
You can set the Application.Interactive property on Excel to block user input:
http://msdn.microsoft.com/en-us/library/office/ff841248(v=office.15).aspx
Example:
excel_app = win32com.client.Dispatch("Excel.Application")
excel_app.Interactive = False
try:
# Do some automation...
finally:
excel_app.Interactive = True
[toc] | [prev] | [next] | [standalone]
| From | Jaydeep Patil <patil.jay2009@gmail.com> |
|---|---|
| Date | 2014-06-03 00:53 -0700 |
| Message-ID | <bf3b983f-81bd-420d-9296-962591608717@googlegroups.com> |
| In reply to | #72483 |
On Tuesday, 3 June 2014 12:39:38 UTC+5:30, Ian wrote:
> On Tue, Jun 3, 2014 at 12:40 AM, Jaydeep Patil <patil.jay2009@gmail.com> wrote:
>
> > Hi Lan,
>
> >
>
> > Currently I am doing some automation in python excel. It read the data & plots number of graphs. It took more than 20 minutes. So while running my python program if user clicks on excel, error came.
>
> >
>
> > So just i want to lock GUI not workstation.
>
> >
>
> > I hope you understand this.
>
> >
>
> > Let me know if you have any idea about it.
>
>
>
> You can set the Application.Interactive property on Excel to block user input:
>
> http://msdn.microsoft.com/en-us/library/office/ff841248(v=office.15).aspx
>
>
>
> Example:
>
>
>
> excel_app = win32com.client.Dispatch("Excel.Application")
>
> excel_app.Interactive = False
>
> try:
>
> # Do some automation...
>
> finally:
>
> excel_app.Interactive = True
Hi Lan,
Thanks for sharing valuable info.
I have another query.
We can now block user inputs. But in my automation three is copy & paste work going on continuously in Excel before plotting the graphs.
During copy paste of excel data, if user by mistake doing some copy & paste operation outside excel(for e.g. doing copy paste in outlook mails, firefox browser etc), it may be cause for the another error.
How i can control this?
Thanks & Regards
Jaydeep Patil
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-06-03 09:05 +0100 |
| Message-ID | <mailman.10603.1401783005.18130.python-list@python.org> |
| In reply to | #72485 |
On 03/06/2014 08:53, Jaydeep Patil wrote: Would you please use the mailing list https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-06-03 19:11 +1000 |
| Message-ID | <mailman.10608.1401786665.18130.python-list@python.org> |
| In reply to | #72485 |
On Tue, Jun 3, 2014 at 5:53 PM, Jaydeep Patil <patil.jay2009@gmail.com> wrote: > > During copy paste of excel data, if user by mistake doing some copy & paste operation outside excel(for e.g. doing copy paste in outlook mails, firefox browser etc), it may be cause for the another error. > > How i can control this? Suggestion: Don't. If you really need this level of control of the workstation, you are going about things wrongly. This is a recipe for fragility and horrific usability problems. There are two simple solutions: 1) Make it really obvious that you're controlling the computer, by putting something big across the screen - a splash screen, of sorts - which is set to Always On Top and gives a message. And then just trust that the user won't do anything, because you've done everything reasonable. No further control needed. 2) Automate your code by moving stuff around on the disk, *not* by actually working through Excel. Twenty minutes of Excel automation should probably become a proper application that reads in some data and generates some graphs. And it'd probably be faster, too (even if Excel's performance is stellar, which I very much doubt, it's always slower to work through a GUI than to do the work directly). Figure out what you're really trying to do, and do that directly. Also, please follow Mark's advice. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-06-03 09:27 -0600 |
| Message-ID | <mailman.10630.1401809255.18130.python-list@python.org> |
| In reply to | #72485 |
[Multipart message — attachments visible in raw view] — view raw
On Jun 3, 2014 1:56 AM, "Jaydeep Patil" <patil.jay2009@gmail.com> wrote: > I have another query. > > We can now block user inputs. But in my automation three is copy & paste work going on continuously in Excel before plotting the graphs. > > During copy paste of excel data, if user by mistake doing some copy & paste operation outside excel(for e.g. doing copy paste in outlook mails, firefox browser etc), it may be cause for the another error. > > How i can control this? Do you really need to use the system clipboard for this automation? Why not just store the data in script variables and write them back from the?
[toc] | [prev] | [next] | [standalone]
| From | Jaydeep Patil <patil.jay2009@gmail.com> |
|---|---|
| Date | 2014-06-03 20:55 -0700 |
| Message-ID | <fee30f59-a010-4a05-b42f-2bfb60c51712@googlegroups.com> |
| In reply to | #72526 |
On Tuesday, 3 June 2014 20:57:32 UTC+5:30, Ian wrote: > On Jun 3, 2014 1:56 AM, "Jaydeep Patil" <patil....@gmail.com> wrote: > > > I have another query. > > > > > > We can now block user inputs. But in my automation three is copy & paste work going on continuously in Excel before plotting the graphs. > > > > > > During copy paste of excel data, if user by mistake doing some copy & paste operation outside excel(for e.g. doing copy paste in outlook mails, firefox browser etc), it may be cause for the another error. > > > > > > How i can control this? > > Do you really need to use the system clipboard for this automation? Why not just store the data in script variables and write them back from the? Hi lan, For plotting one graph, I need to use four to five excel files. Currently I am reading excel files one by one and copy data of excel files to another single master excel file. This master excel file consists of all data from all input excel files. So this is the reason i am using system clipboard. Regards Jay
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-06-03 22:58 -0600 |
| Message-ID | <mailman.10676.1401857956.18130.python-list@python.org> |
| In reply to | #72584 |
On Tue, Jun 3, 2014 at 9:55 PM, Jaydeep Patil <patil.jay2009@gmail.com> wrote:
> Hi lan,
>
> For plotting one graph, I need to use four to five excel files. Currently I am reading excel files one by one and copy data of excel files to another single master excel file. This master excel file consists of all data from all input excel files. So this is the reason i am using system clipboard.
I don't currently have Excel around to test with, but I think you
could do something like this:
wb1.Sheets(1).Range("A1:F100").Value = wb2.Sheets(1).Range("A1:F100").Value
Not sure how efficient this is -- I envision it serializing an entire
array of data to send over COM to Python, only to send it right back
again at the other side. But then, the clipboard would be doing more
or less the same thing. It might be more efficient to implement the
above as a macro in Excel and then just call the macro.
[toc] | [prev] | [next] | [standalone]
| From | Jaydeep Patil <patil.jay2009@gmail.com> |
|---|---|
| Date | 2014-06-03 22:44 -0700 |
| Message-ID | <eeff73a0-56b9-47a2-aa8a-a49d9ee4bc82@googlegroups.com> |
| In reply to | #72591 |
On Wednesday, 4 June 2014 10:28:28 UTC+5:30, Ian wrote:
> On Tue, Jun 3, 2014 at 9:55 PM, Jaydeep Patil <patil.jay2009@gmail.com> wrote:
>
> > Hi lan,
>
> >
>
> > For plotting one graph, I need to use four to five excel files. Currently I am reading excel files one by one and copy data of excel files to another single master excel file. This master excel file consists of all data from all input excel files. So this is the reason i am using system clipboard.
>
>
>
> I don't currently have Excel around to test with, but I think you
>
> could do something like this:
>
>
>
> wb1.Sheets(1).Range("A1:F100").Value = wb2.Sheets(1).Range("A1:F100").Value
>
>
>
> Not sure how efficient this is -- I envision it serializing an entire
>
> array of data to send over COM to Python, only to send it right back
>
> again at the other side. But then, the clipboard would be doing more
>
> or less the same thing. It might be more efficient to implement the
>
> above as a macro in Excel and then just call the macro.
Hi lan,
Below is the sample function which doing copy paste in my case.
I am copying data directly by column, not reading each & every value.
Data is too big in heavy.
def copyPaste(self,ws):
# todo
self.ws = ws
startRowPaste = self.headerRow
self.col = self.getColToPaste(ws)
rngPaste = ws.Cells( startRowPaste, self.col)
self.datafile.openDataFile()
self.datafile.ws.Activate()
rngCopy = self.datafile.ws.Cells(self.datafile.headerRow,self.colCopy)
rngCopy = self.datafile.ws.Range(rngCopy,rngCopy.End(util.Xl.xlDown))
rngCopy.Copy()
ws.Activate()
ws.Paste(Destination=rngPaste)
self.dataRange = self.getDataRange()
self.datafile.closeDataFile()
pass
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2014-06-04 00:02 -0600 |
| Message-ID | <mailman.10680.1401861758.18130.python-list@python.org> |
| In reply to | #72598 |
[Multipart message — attachments visible in raw view] — view raw
On Jun 3, 2014 11:46 PM, "Jaydeep Patil" <patil.jay2009@gmail.com> wrote: > Below is the sample function which doing copy paste in my case. > I am copying data directly by column, not reading each & every value. > Data is too big in heavy. The approach I suggested also operates on ranges, not individual cells.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-06-04 21:21 +1000 |
| Message-ID | <mailman.10698.1401880915.18130.python-list@python.org> |
| In reply to | #72584 |
On Wed, Jun 4, 2014 at 1:55 PM, Jaydeep Patil <patil.jay2009@gmail.com> wrote: > For plotting one graph, I need to use four to five excel files. Currently I am reading excel files one by one and copy data of excel files to another single master excel file. This master excel file consists of all data from all input excel files. So this is the reason i am using system clipboard. > Strong recommendation: Either avoid using actual Excel and the system clipboard (and work with files on the disk), or get a dedicated VM that you can take full control of without interfering with the human on the workstation. With clipboard sharing disabled and the window minimized, there'll be very little interaction between the VM and the host. Additional strong recommendation: Get off Google Groups, sign up for the mailing list https://mail.python.org/mailman/listinfo/python-list instead. Your posts are coming through mis-wrapped and double-spaced. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2014-06-04 22:04 -0400 |
| Message-ID | <mailman.10718.1401933907.18130.python-list@python.org> |
| In reply to | #72584 |
On Tue, 3 Jun 2014 20:55:56 -0700 (PDT), Jaydeep Patil
<patil.jay2009@gmail.com> declaimed the following:
>For plotting one graph, I need to use four to five excel files. Currently I am reading excel files one by one and copy data of excel files to another single master excel file. This master excel file consists of all data from all input excel files. So this is the reason i am using system clipboard.
If they are similar data (or even if they aren't), I'd probably suggest
writing the data to something like SQLite3, and then generating the final
plot from THAT...
Especially since it sounds very much as if your input Excel files are
just being used as a form of relation (in database theory, a "table" is
called a "relation" as there is typically some column [or combination of
columns] which serves as a key to which the other data columns are
"related"... "relational" does not specify the joins between "tables").
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web