Jump to content
Sign in to follow this  
SkysLastChance

Formating Question - Notepad [Solved]

Recommended Posts

Run("notepad.exe")

GLOBAL $One = ('Line1' & _
    'Line2' & _
    'Line3' & _
    'Line4' & _
    'Line5')



      ClipPut($One)

      $Notepad = WinWait("[CLASS:Notepad]", "", 10)
      ControlSend("Untitled - Notepad", "", "", ("^v"))

Instead of having this paste as Line1Line2Line3Line4Line5

How can I make it paste it into notepad as (without double spacing.)

Line1

Line2

Line3

Line4

Line5

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites

Thank you for the quick response. 

Run("notepad.exe")

GLOBAL $One = ('Line1' & _
      @CRLF
    'Line2' & _
      @CRLF
    'Line3' & _
      @CRLF
    'Line4' & _
      @CRLF
    'Line5')



      ClipPut($One)

      $Notepad = WinWait("[CLASS:Notepad]", "", 10)
      ControlSend("Untitled - Notepad", "", "", ("^v"))

Like this?

I am getting this error. 

>"J:\Temporary Files\\AutoIt\AutoIt\AutoIt\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Users\\Desktop\test.au3"    
"C:\Users\\Desktop\test.au3" (3) : ==> Missing right bracket ')' in expression.:
GLOBAL $One = ('Line1' & @CRLF
GLOBAL $One = ^ ERROR
>Exit code: 1    Time: 0.2167

 


Life's simple. You make choices and you don't look back.

Share this post


Link to post
Share on other sites

That did the trick thank you!

 

Run("notepad.exe")

GLOBAL $One = ('Line1' & @CRLF & _
    'Line2' & @CRLF & _
    'Line3' & @CRLF & _
    'Line4' & @CRLF & _
    'Line5')



      ClipPut($One)

      $Notepad = WinWait("[CLASS:Notepad]", "", 10)
      ControlSend("Untitled - Notepad", "", "", ("^v"))

 


Life's simple. You make choices and you don't look back.

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
Sign in to follow this  

  • Similar Content

    • By Ronster
      I would like to create an auto login program using mouseclicks, controlclicks only, or whatever is required to send characters from Windows 10 On-Screen Keyboard to a User/Password login form. I thought I would start with OSK to NotePad. Using mouseclicks to enter ID/Password seems more secure than typing plain text. Seems like if I can get that to work I should be able to send the characters to any login form. I have tried many things but cannot send a character(s) from OSK to Notepad. Of course manually works great. Here is some code I have tried:
      ControlGetFocus ("Untitled - Notepad")
          ; go to Notepad window
          MouseMove(649, 206 , 0)  ;move to Notepad, then click below
          Sleep (1000)
          MouseClick($MOUSE_CLICK_LEFT,"left")
          ControlGetFocus ("On-Screen Keyboard")
          ; go to OSK window then click on a character key
          MouseMove(642, 807 , 0) ;letter - t
          Sleep (1000)
          MouseClick($MOUSE_CLICK_LEFT,"left")
      OR
      ControlClick("On-Screen Keyboard","","[CLASS:OSKMainClass]","left","",642, 807)
      The above move to the correct position and appear to click but focus is lost to Notepad. Any help would be appreciated.
    • By XinYoung
      Hello all!   I'm stuck at a seemingly simple part of my script. Using IE, I'm filling out a web form that involves clicking a "Browse" button and selecting a file. Once the file explorer dialog opens, however, I am unable to control it.
      I have a string, which is the name of the file I want, and I'm trying to insert it into the 'File name:' text box in the dialog (which already has focus), but it doesn't get inserted. I've tried ClipPut and Send. 

      What's even more concerning is, when I close the dialog, the string is then pasted into the very next window that has focus, which is often SciTE. It's like that Browse's file open dialog halts all processes. Once it's closed, the script continues.
      ;~ Open a IE window and navigate to the login page. Global $oIE = _IECreate($urlBBLogin) _IELoadWait($oIE) ;~ Recognize the form on this page (login input boxes). Local $oForm = _IEFormGetObjByName($oIE, "login") Local $oTextLogin = _IEFormElementGetObjByName($oForm, "user_id") Local $oTextPass = _IEFormElementGetObjByName($oForm, "password") ;~ Enter the Automation user credentials into the form. _IEFormElementSetValue($oTextLogin, $bbUsername) _IEFormElementSetValue($oTextPass, $bbPassword) ;~ Click the Login button. _IEFormSubmit($oForm) _IELoadWait($oIE) ;~ Navigate to the feedfile upload page. _IENavigate($oIE, $urlUpload) _IELoadWait($oIE) ;~ Click the Browse button Local $Browse = _IEGetObjById($oIE, "feedFile_chooseLocalFile") _IEAction($Browse, "Click") Local $Browse = WinWait("Choose File to Upload") ;~ Open the file we created. WinActivate($Browse) Send($finalFile) Has anyone else experienced this problem? Any ideas to get around it? Am I approaching this the wrong way?
      Any support is greatly appreciated.
      Thank you.
    • By Htps
      1. How do I make a multiple minimized windows at once believe I am holding down a key for like 5 seconds?
      I know I can send minimized windows a key press with ControlSend.
      What hat would be the way to simulate a 'humanly' held down key to a few minimized windows? 
       
      2. How come: if I compare a handle's hexa value and the actual handler, I get false
      For example: when the Notepad's handler value is 0x00000000000CFFFF, I always get the message box.
       
      if(NOT(0x00000000000C0664 == WinGetHandle("Untitled - Notepad"))) Then MsgBox(0,"swi","0x00000000000CFFFF" & @CRLF & "lmao" & @CRLF & WinGetHandle("Untitled - Notepad")) EndIf  
      Why does that happen? also I can't use hexadecimal value as a handler when I use the ControlSend function.
    • By SkysLastChance
      I must be missing something. I have had this problem multiple times. Why does F6 key not send 6 times?  
      Not working 
      ControlSend("[CLASS:#32770]", "", "", ("{F6 6}")) Working
      ControlSend("[CLASS:#32770]", "", "", ("{F6}")) ControlSend("[CLASS:#32770]", "", "", ("{F6}")) ControlSend("[CLASS:#32770]", "", "", ("{F6}")) ControlSend("[CLASS:#32770]", "", "", ("{F6}")) ControlSend("[CLASS:#32770]", "", "", ("{F6}")) ControlSend("[CLASS:#32770]", "", "", ("{F6}"))  
    • By faustf
      hi guys
      i have a script  like this,  in windows 7 work perfect , in windows 10 not  work  , some one can explain me  why ??'
      #include <Array.au3> #include <MsgBoxConstants.au3> Global $aGPathFoto= FileReadToArray (@ScriptDir & "\TEMP\PathFoto.txt") Local $ctrl = 0 While 1 Local $hWnd = WinWait("[CLASS:#32770]", "", 10) If WinExists("[CLASS:#32770]") Then If $ctrl < 2 Then ControlSend($hWnd, "Choose File to Upload", "[CLASS:Edit; INSTANCE:1]", $aGPathFoto[0]&"{Enter}") Exit $ctrl += 1 Else ExitLoop EndIf EndIf WEnd $aGpathfoto = C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg
×
×
  • Create New...