sourabh343

How to rite a code to launch notepad and the click on Edit and then again click on paste

7 posts in this topic

Hi,

Can some please help me out to write a code to launh notepad and then click on Edit and then click on paste as i am new to the coding.

Run("notepad.exe")

Regards,

Sourabh

Share this post


Link to post
Share on other sites



Run("notepad.exe")                  ; <-- run notepad
WinWaitActive("Untitled - Notepad") ; <-- wait until a window called "Untitled - Notepad" is active
Send("^v")                          ; <-- send keystroke ctrl-v (much easier and faster than clicking around)

That should do it.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

@sourabh343, SadBunny's solution will definitely work. As another suggestion, since it sounds like you are pasting in something you have already copied to the clipboard, perhaps something like this. It removes having to manipulate the notepad GUI:

;assumes you have already copied the lorem ipsum text to the clipboard
$sMyText = ClipGet()
FileWrite(@DesktopDir & "\Output.txt", $sMyText)

Also, I notice you created two accounts. Please stick to the one; as you hadn't posted anything under the @sourabh moniker, I have closed that account.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Thanks 

11 hours ago, JLogan3o13 said:

@sourabh343, SadBunny's solution will definitely work. As another suggestion, since it sounds like you are pasting in something you have already copied to the clipboard, perhaps something like this. It removes having to manipulate the notepad GUI:

;assumes you have already copied the lorem ipsum text to the clipboard
$sMyText = ClipGet()
FileWrite(@DesktopDir & "\Output.txt", $sMyText)

Also, I notice you created two accounts. Please stick to the one; as you hadn't posted anything under the @sourabh moniker, I have closed that account.

Hi Logan, thanks for helping me out

Share this post


Link to post
Share on other sites
13 hours ago, SadBunny said:
Run("notepad.exe")                  ; <-- run notepad
WinWaitActive("Untitled - Notepad") ; <-- wait until a window called "Untitled - Notepad" is active
Send("^v")                          ; <-- send keystroke ctrl-v (much easier and faster than clicking around)

That should do it.

Thanks for helping me out

Share this post


Link to post
Share on other sites

I have one more question that is i have to write a code to launch and exe and go to tools menu and select one of the option from the menu.

Could you please help me with it

Share this post


Link to post
Share on other sites

Sure, look at Run and ShellExecute in the help file, then look at WinMenuSelectItem. Try the example scripts, then try to modify them for your needs.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now