Untitled conversation

Hello & Thanks ,
Windows 10
Coming from another basic :

I am having trouble getting focus into Notepad’s FIND function .
It works fine until
Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}v{CONTROLUP}") ; Paste.

BUT it can’t Paste into FIND box .
It always pastes into the text area .

Anyone know how to gain Focus and entry to the FIND box ?
I tried all kinds of combinations , but no go .
Thanks

; line = comment

RunProgram("c:notepad.exe","","",0) 
w$="Untitled - Notepad" ; Specifies target window name. 
Delay(1000) : SendKeys(0,w$,"This is a test!") ; Type some dummy text. 
Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}a{CONTROLUP}") ; Select it all. 
Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}c{CONTROLUP}") ; Copy. 
Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}f{CONTROLUP}") ; Find. 
Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}v{CONTROLUP}") ; Paste. 
;Delay(1000) : SendKeys(0,w$,"{DELETE}")      ; Delete it. 

;Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}p{CONTROLUP}") 
;Delay(1000) : SendKeys(0,w$,"This is a test!") ; Type some dummy text. 
;Delay(1000) : SendKeys(0,w$,"{ALTDOWN}{F4}") ; Close the Notepad Window

Vernon… you do know this is a forum for XOJO, not for VB right?

since none of the code you posted follows any XOJO syntax

If you have XOJO code that you would like help with, paste it here instead

[quote]Windows 10
Coming from another basic :[/quote]
Look at the Windows Functionality Suite. It has a VB SendKeys equivalent.

And whats the point of this code?
Open Notepad, put in some text of your own, then do a find and replace in it?
if thats really what you want to do,

create a text variable
Put your text in that
Use ReplaceAll() on the text
then save it as a text file.

What is it that you really want to do?

You should probably use a tab or two to get the cursor inside the search box.

[quote=438547:@Jeff Tullin]And whats the point of this code?
Open Notepad, put in some text of your own, then do a find and replace in it?
if thats really what you want to do,

create a text variable
Put your text in that
Use ReplaceAll() on the text
then save it as a text file.

What is it that you really want to do?[/quote]
He wants to perform a search on the existing text in notepad, but in the example he’s setting the text as a test, I believe.

But it’s a text file.
Surely it is easier to open the text file and operate on that, than try to automate Notepad to do the job?

[quote=438555:@Jeff Tullin]But it’s a text file.
Surely it is easier to open the text file and operate on that, than try to automate Notepad to do the job?[/quote]
Sure, but he may need the SendKeys for something else, or there may be a project-specific reason why he has to do it this way. We don’t have enough information beyond his specific request.

I would like to see how easily this can be done in xojo .
Anyone have a working xojo example ?
Thanks

Once you include WFS in your project, from what I recall, you just do something like the following:

VB.AppActivate( "Notepad" ) VB.SendKeys( "Test" ) VB.SendKeys( "~" )

Note that’s not tested, but should give you an idea of what you’re looking at. You’ll need to inspect the module to learn more as I haven’t looked at that code in ages.

Actually I am usiing PureBasic :
I would like to see how easily this can be done in xojo .
Anyone have a working xojo example ?
Thanks

Do you really need this in Xojo or do you just want us to figure out your PB issue because you’re asking the same question on the PB forum ? :slight_smile:

You have it all there, just change

Delay(1000) : SendKeys(0,w$,"{CONTROLDOWN}v{CONTROLUP}") ; Paste.

to

Delay(1000) : SendKeys(0,“Find",”{CONTROLDOWN}v{CONTROLUP}") ; Paste.

As you’re still sending keys to w$ which is your main notepad window.

I was frustrated at my poor results
so thought I would look around for other solutions , hence xojo & autoit .
And yes I did finally figure it out .
Thanks for your input .