#174762 - 2007-03-19 10:56 PM
SendKeys for Shift not working
|
Publius
Lurker
Registered: 2007-03-19
Posts: 3
|
we are calling SendKeys("^+{END}" to select from the cursor to end of file and the cursor goes to end of file without selecting (Behaves as pressing CTRL+END) When we use SendKeys("+{END}" the cursor goes to the end of line without selecting (Behaves as pressing END)
Any help is appreciated
|
Top
|
|
|
|
#174780 - 2007-03-20 02:17 PM
Re: SendKeys for Shift not working
[Re: Witto]
|
Publius
Lurker
Registered: 2007-03-19
Posts: 3
|
I have a word document that has the first part in english and second half is french , and where the french start I have a text "FRENCH STARTS HERE".
So I want to search for the text and then select the text to the end to create a new file with the french text ,and select the top part to create a english doc.
What I am doing now is search for the text and then I want to do Ctrl+Shift+End to select everything to the end of file and copy to clipbooard.
Thank you all for the help
|
Top
|
|
|
|
#174793 - 2007-03-20 09:25 PM
Re: SendKeys for Shift not working
[Re: Witto]
|
Publius
Lurker
Registered: 2007-03-19
Posts: 3
|
Thank you all for all your help I will use a combination of the code from Gargoyle and the suggestion from Witto.
Thank you again
|
Top
|
|
|
|
#174797 - 2007-03-21 12:02 AM
Re: SendKeys for Shift not working
[Re: Publius]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Oh well Something to get you started
;************************************************************************* ; Script Name: ; Author: Publius ; Date: 20/03/2007 ; Description: Find "FRENCH STARTS HERE" ;*************************************************************************
;Script Opions If NOT @LOGONMODE Break On Else Break Off EndIf Dim $RC $RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") $RC = SetOption("WrapAtEOL", "On")
;Declare variables Dim $objWord, $strWordFile, $strFind $strWordFile = "\\Server\Share\Deeper\YourFile.doc" $strFind = "FRENCH STARTS HERE"
;Create Word object $objWord = CreateObject("Word.Application") If @ERROR ? "Error creating Word object" ? "Error " + @ERROR + ": " + @SERROR Quit @ERROR EndIf
;Open Word document ;Maybe you can do everything invisible and comment the next line $objWord.Visible = 1 $RC = $objWord.Documents.Open($strWordFile) $objWord.Selection.Find.Text = $strFind $RC = $objWord.Selection.Find.Execute
; Other stuff ; Complete your script
;Do not forget to close word if working invisible $RC = $objWord.Application.Quit |
The File/Open and the Find are easy to recreate if you just play a while with your macro recorder in Word. Just give it a try.
|
Top
|
|
|
|
#174820 - 2007-03-21 02:26 PM
Re: SendKeys for Shift not working
[Re: Richard H.]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Richard prolly just forgot about this but there is a solution with KiX, all you have to do is turn the numlock off and the shift+end ("+{END}) will work. in this example i am using Word to determain if the numlock is on:
$WordShell = CreateObject("Word.Application")
$NumLock = $WordShell.NumLock
Run "notepad.exe"
$ = SetFocus("Untitled - Notepad")
Sleep 1
$Key = SendKeys("abcdefg")
Sleep 1
$Key = SendKeys("{ENTER}")
Sleep 1
$Key = SendKeys("{UP}")
Sleep 1
If $NumLock = -1
$Key = SendKeys("{NUMLOCK}")
Sleep 1
$Key = SendKeys("+{END}")
Sleep 1
$Key = SendKeys("{NUMLOCK}")
Sleep 1
Else
$Key = SendKeys("+{END}")
Sleep 1
EndIf
|
Top
|
|
|
|
#174828 - 2007-03-21 05:20 PM
Re: SendKeys for Shift not working
[Re: Benny69]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Whow, a NumLock bug. Anyway, I would rely more on COM scripting, because the line$ = SetFocus("Untitled - Notepad") is depending on the language of the operating system
|
Top
|
|
|
|
#174829 - 2007-03-21 05:21 PM
Re: SendKeys for Shift not working
[Re: Witto]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
well that was just as an example to show that it works if the numlock is off.
Edited by Benny69 (2007-03-21 05:23 PM)
|
Top
|
|
|
|
#174835 - 2007-03-21 07:32 PM
Re: SendKeys for Shift not working
[Re: Allen]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
My Kung-Fu is strong
|
Top
|
|
|
|
#174840 - 2007-03-21 09:02 PM
Re: SendKeys for Shift not working
[Re: Benny69]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
ahhh... so that's what you call that smell.
|
Top
|
|
|
|
#174843 - 2007-03-21 11:57 PM
Re: SendKeys for Shift not working
[Re: Allen]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 515 anonymous users online.
|
|
|