Search the Community
Showing results for tags 'Paste'.
-
Hi, I have 5 notepad files with lot of data in each of it. The data are arranged in lines and i wish to get it pasted/copied into excel. Say, i need to read notepad1 and paste the contents into sheet1 of excel and notepad2 to sheet2 and so on. If i read the notepad and paste it line by line, it is taking lot of time. Is there a way by which i can paste the whole of notepad file into excel sheet(and get it pasted line by line as shown in the attached excel), instead of using code to write it line by line?.. I was using Filewriteline(data, line i) initially to write to excel. The 'i' value was incremented with for loop and the excel was updated, but this takes lot of time. The expected excel format is attached here. any help is appreciated. thanks Tmp.xls
-
question about send function - (Moved)
nacerbaaziz posted a topic in AutoIt General Help and Support
hello autoit group please i've a question i had make a function that put some thing into the clipBoard and paste it using the send function e.g ClipPut("hello") send("^v") when the keyboard is english all things work fine but when the keyboard is arabic the send command write the ltr v insted of the text in clipboard i was tryed to use send("{ctrldown}v{ctrlUp}") but the same please can any one help me -
HI! ... this is a big one (at least for me) You guys previously helped me copy the used range in column A and paste them into a Website one at a time in a loop. Cool! Now, for another function, I have 2 columns, A and B, and two input boxes in the Website. I'm having a hard time replicating the loop for the 2 columns. This is how I'm opening the Excel workbook (copied from the previous function that only had 1 column). I need to also get the used range in column B. Func OpenExcelForCopy() Global $aBBTableData Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, $ChosenFileName, Default, True, True) $oExcel.Sheets("CopyCourses").Activate ;~ Get all used cells in column A:A Global $aSearchItems = _Excel_RangeRead($oWorkbook, 1, $oWorkbook.Sheets("CopyCourses").Usedrange.Columns("A:A")) ;~ Duplicate the $aSearchItems Array Global $aSearchResult = $aSearchItems ;~ Loop through the array starting at 0 until the end of the array which is (Ubound($aSearchItems) - 1) For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = SearchCourseForCopy($aSearchItems[$i]) Next _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") Finished() EndFunc ;==>OpenExcelForCopy Then we eventually get here. I don't think anything needs to change here but I'm not sure. This is where I paste the data from Column A into an input field (which is a search tool in a website). If the search is good, then we get to the tricky part... ;~ OK, we logged in and we searched for a course. Lets COPY it! Func CopyCourseBegin() Local $sResult $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then ;~ MsgBox(4096, "Search Error", "Item not found") $sResult = "Source Not Found" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") ;~ Now go back to the Excel sheet and search for the next one. ;~ If the course was found, begin the COPY process. Else For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = CopyCourseNow($aSearchItems[$i]) Next $sResult = "Copied" _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "C1") EndIf Return $sResult EndFunc ;==>CopyCourseBegin This is the "tricky part" where I'm confused. I can copy and paste what's in column A just fine, but I can't manage to replicate it for column B. I need to paste whats in Column B into "destinationCourseId" ;~ The course search was successful. COPY the course now. Func CopyCourseNow($_sSearchResult) ;~ Navigate to the course copy page. _IENavigate($oIE, $urlBBCourseCopy) ;~ Copy the SOURCE course ID from the Excel sheet ;~ Paste whats copied from column A into the Source Course ID text box Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "sourceCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Paste whats copied from column B into the Destination Course ID text box ?!?!?!?! Local $oForm = _IEGetObjByName($oIE, "selectCourse") Local $oSearchString = _IEFormElementGetObjByName($oForm, "destinationCourseId") _IEFormElementSetValue($oSearchString, $_sSearchResult) ;~ Just exit cause im stuck :( _Exit() EndFunc ;==>CopyCourseNow After I paste the data from column A into "sourceCourseId" and column B into "destinationCourseId", I'll make it do some stuff. Then I need it to loop around until the used ranges in column A & B is finished. Does the entire code need to change now that there's two columns?
-
Hi! I want to get the signal in this website: https://binary-signal.com/pt/chart/eurusd I have tried using _IEBodyReadText and some _StringBetween. What happens is that the text are being update every tick and _IEBodyReadText doesn't. To perform the update I used _IEAction($oIE, "refresh") but it's not good because the website block me after some time due too many requests.. Is there any other way to get this text every tick? PS: The text I want to get is WAIT, CALL or PUT. Here is the code: global $oIE = _IECreate ('https://binary-signal.com/pt/chart/eurusd', 0, 1 , 1 , 0) Local $sText = _IEBodyReadText($oIE) $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA') ;MsgBox ( 0, "asf", $result[0]) $espera=StringInStr($result[0], "WAIT") $compra=StringInStr($result[0], "CALL") $venda=StringInStr($result[0], "PUT") ;MsgBox($MB_SYSTEMMODAL, "", $espera) $n=0 $c=0 Captar() Func Captar() ;_IENavigate($oIE, "https://binary-signal.com/pt/chart/eurusd") ;MsgBox($MB_SYSTEMMODAL, "", $n) Local $sText = _IEBodyReadText($oIE) $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA') If (Not $compra=0) And $n=0 Then MsgBox($MB_SYSTEMMODAL, "", "COMPRE") $n=1 $c=$c+1 ;_IEAction($oIE, "refresh") Sleep(60000) Captar() ElseIf (Not $venda=0) And $n=0 Then MsgBox($MB_SYSTEMMODAL, "", "VENDA") $c=$c+1 $n=1 ;_IEAction($oIE, "refresh") ;MsgBox($MB_SYSTEMMODAL, "", $n) Sleep(60000) Captar() ElseIf (Not $venda=0) And $n=1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada") $n=1 ;MsgBox($MB_SYSTEMMODAL, "", $n) ;_IEAction($oIE, "refresh") Sleep(60000) Captar() ElseIf (Not $venda=0) And $n=1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Esperando próxima rodada") $n=1 ;MsgBox($MB_SYSTEMMODAL, "", $n) ;_IEAction($oIE, "refresh") Sleep(60000) Captar() Else ;MsgBox("", "", "ESPERE") $n=0 Sleep(1000) ;_IEAction($oIE, "refresh") Local $sText = _IEBodyReadText($oIE) $result = _StringBetween ( $sText , 'PUTEUR/USD on Binary-signal.com', 'sinal está PRONTA') Captar() EndIf EndFunc
-
Hello to you, dear developers! Could you please tell me if there is an easy way to determine if the information was pasted from the clipboard? Without any variation of the insertion via Ctrl+V, or through the context menu. I revised the Help and many forum topics, but found nothing suitable. Can there be any WinAPI system events that determine this event?
-
Hi, Wondering what I'm doing wrong. as per my script, I activate an external program, copy data from it and I want to paste it into excel, after I clear the current sheet that is there. It is some sort of an array as when I manually paste it into excel it expands across rows and down columns (number of which varies). This repeats for Xno. of program instances, and consequently I would want it to cycle through x sheets. So far I have the following, noting that I dont have the sheet clearing thing detailed yet, but I get the following error: "Error copying cells. @error = 4, @extended = -2147352567" func Primary() For $i=0 to ubound($term)-1 WinActivate($term[$i]) sleep(500) MouseClick("left",$OptX,$opty) Clipput("") sleep(500) send("!a") sleep(100) Do sleep(100) until Clipget() ;activates sheet no. specified by $i+ 1, removes data from sheet and pastes new data, cycles to the next sheet ;function to clear sheet _Excel_RangeCopyPaste($oWorkbook1.Worksheets($i+1), Default , "A1") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 2", "Error copying cells." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 2", "Range 'A1' from workbook _Excel3.xls successfully copied to 'G15'.") Next EndFunc Any help would be great.
-
Here's a short UDF that will, at least in most cases, detect whether a window can be copied from or pasted to programmatically--for example, by Send()ing ctl-c, ctl-v. This is often disabled when programs (like your AutoIt script) run at a lower UAC integrity level than the application they are trying to operate on. #include <WinAPI.au3> Func _WindowIsPasteable($handle) ;accepts window handle; returns true or false whether a window will accept Ctl-C, Ctl-V Local $bCanPaste = True Local $hTestWindowPID = 0 Local $hTestWindowTID = _WinAPI_GetWindowThreadProcessId($handle, $hTestWindowPID) _WinAPI_AttachThreadInput(_WinAPI_GetCurrentThreadId(), $hTestWindowTID, True);attach to window we want to paste into $bCanPaste = _WinAPI_GetFocus() ;Test whether window is paste-able--returns False if it is not _WinAPI_AttachThreadInput(_WinAPI_GetCurrentThreadId, $hTestWindowTID, False);detach from window thread Return $bCanPaste EndFunc Pass it a window handle; it returns true or false whether a window will accept programmatic pasting. The function may not work on the CMD window, since it handles the clipboard uniquely. This function works by attaching to the program thread of the window whose handle it receives, then attempting to perform a GetFocus on that thread. In most cases, the attempt will fail if the window will not accept programmatic copy-paste.
-
Hi All, Could someone please PLEASE tell me what I'm doing wrong here? I feel like I'm close to figuring this out, I think I've identified what is causing the issue. Whenever I try to use the hotkey CTRL+SHIFT+T (or any other letter other than T for that matter) to paste the text to notepad, my CTRL and SHIFT keys are held down *IF* I release them *WHILE* the raw text is being written. It seems to be that if I release the CTRL+SHIFT keys: Before the Send Raw text starts to write to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good During the Send Raw text being written to the screen: the CTRL and SHIFT keys ARE held down perpetually until I physically press them on the keyboard, this is bad After the Send Raw text has written all text to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good This is also the case if I were to use the Windows Key as the hot key instead of the CTRL+SHIFT, I would need to tap the WIN key physically on my keyboard if I released it while the raw tet was being sent to the screen (eg, WIN+T). This issue also happens no matter which program I try to write the text to. Here's some example code: (I've put a bunch of "a's" in there to give enough time to test releasing the CTRL+SHIFT before/during/after the writing of them) HotKeySet("^+t", "WriteTxt") Func WriteTxt() WinWaitActive("Untitled - Notepad") $var = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" send($var, 1) EndFunc While 1 Sleep(500) WEnd Thanks guys!
-
Hi All I have used my script to paste a string ($TestCSVGenerator) onto the clipboard - it has text seperated by tabs and at certain intervals there are CRLF. I am certain that this is a valid string because after I run my script (and it fails to do what I need) I can then manually 'Paste' the string into Excel using CTRL v and Excel puts the text in rows separated by the tab position and starts a new row of cells after a CRLF. (I make sure that the clipboard was empty before running my program). All I need is a command that pastes the string into a certain cell and in theory the above should happen but it doesn't! First I tried the following: _Excel_RangeWrite ($oWorkbook, 1, $TestCSVGenerator, "C18", False, True) This pastes, but everything goes in one cell! I've tried all the combinations of True/false Next I tried: _Excel_RangeCopyPaste($oWorkbook.ActiveSheet, Default, "C18") This pastes nothing at all (gives @error =4 ), if I define a range of cells Excel does highlight them. Any ideas or alternative methods? I guess I could paste the text painfully cell by cell but Excel seems to understand what I have on the clipboard if I paste it manually - it's the automation that is flooring me! Cheers James
-
Hello Autoit community I started using Autoit about 2 weeks ago and have found myself lost looking for information. Majority of the Help options are very easy to understand but I think that my general lack of knowledge about programming has slowed my progress. I tried very hard to not be that guy asking annoying questions on the forum but I’m afraid I’m out of options… The steps below are my attempt to explain my scenario Step 1: open excel file Step 2: Read range of Excel column “A1” – “A???”) The range of rows will vary from sheet to sheet. Step 3: take the values (one cell at a time) and place one value into my web browser ran program. Step 4: if that value has been added before (indicated by the PixelSearch) than delete (represented by the mouse click) and start the loop over moving onto the next cell. Step 5: if that value is new then submit the value (represented by the 2 mouse clicks at the end of the (if function) The code listed below is as far as I got. I hope this explanation will suffice and I look forward to any help I can get. (From WinActive(“Paste Too”) down is working as intended.)
-
Hi all, I've been copying a lot of text from PDF files and other documents. Problem is, this text appears badly mangled when pasted again, causing formatting issues. I've been trying to write a script that would automatically reformat the copied string: #include <Clipboard.au3> #include <Misc.au3> If _Singleton("PasteModify", 1) = 0 Then MsgBox(0, "NOPE.", "Already Running.") Exit EndIf #NoTrayIcon Opt("TrayMenuMode", 1) $AboutTrayItem = TrayCreateItem("About") TrayCreateItem("") $ExitTrayItem = TrayCreateItem("Exit") TraySetState() $hDLL = DllOpen("user32.dll") Beep(1100,300) While 1 While _IsPressed("11",$hDLL) If _IsPressed("43",$hDLL) Then Beep(1300,150) ;Sleep(750) ;fixes the issue, but not very elegantly. $OriginalClipboardData = ClipGet() $ClipGetError = @error $RegexClipboardData = StringRegExpReplace($OriginalClipboardData, '[\r\n\t]+', ' ') $StripWSClipboardData = StringStripWS($RegexClipboardData,4) ClipPut($StripWSClipboardData) MsgBox(0,$ClipGetError,"ORIGINAL: " & $OriginalClipboardData & @CRLF & @CRLF & "POST-REGEX APPLIED: " & StringRegExpReplace($OriginalClipboardData, '[\r\n\t]+', ' ') & @CRLF & @CRLF & "STRIPWS APPLIED: " & $StripWSClipboardData & @CRLF & @CRLF & "END RESULT: " & ClipGet()) While _IsPressed("43",$hDLL) Sleep(250) WEnd EndIf WEnd Local $msg = TrayGetMsg() Select Case $msg = $AboutTrayItem MsgBox(64, "About", "When CTRL+C is pressed, a reformatted version of the string that has thereby been copied, without any newline characters, should be placed on the clipboard.") Case $msg = $ExitTrayItem ExitLoop EndSelect WEnd DllClose($hDLL) Beep(600,300) However, every now and then it seems like there's a conflict between this script Windows' access to the clipboard. If I don't include a long enough sleep (see script), ClipGet() will return that my clipboard is empty, even though it wasn't empty before and I have only selected new text and pressed Ctrl+C since. Any suggestions? Could I check for clipboard access perhaps...?
-
Evening, I've been copying a lot of text from PDF files and other documents. Problem is, this text appears badly mangled when pasted again, causing formatting issues. I've been trying to write a script that would automatically reformat the copied string: #include #include #NoTrayIcon Opt("TrayMenuMode", 1) $AboutTrayItem = TrayCreateItem("About") TrayCreateItem("") $ExitTrayItem = TrayCreateItem("Exit") TraySetState() $hDLL = DllOpen("user32.dll") Beep(1100,300) While 1 While _IsPressed("11",$hDLL) If _IsPressed("43",$hDLL) Then ClipPut(StringStripWS(StringReplace(StringReplace(_ClipBoard_GetData(),@lf," "),@cr," "),4)) Beep(1300,150) While _IsPressed("43",$hDLL) Sleep(250) WEnd EndIf WEnd Local $msg = TrayGetMsg() Select Case $msg = $AboutTrayItem MsgBox(64, "About", "When CTRL+C is pressed, a reformatted version of the string that has thereby been copied, without any newline characters, should be placed on the clipboard.") Case $msg = $ExitTrayItem ExitLoop EndSelect WEnd DllClose($hDLL) Beep(600,300) So far, it's working for some of my sources. Others, like this two-column book, I still can't nicely copy from. How do I get out all line breaks, newlines, carriage returns etc. out of a string? Thanks in advance!
- 2 replies
-
- string
- formatting
- (and 6 more)
-
I wonder if it would be possible for autoit to obtain data from clipboard and compare it with a "notepad file" or something. And if there is a match then it must replace the word with the other word that is behind the = mark. Example: 1. I copy: "car accident" 2. The program must read this. 3. Search through a database. DATABASE(notepad?): car accident = dial 1124. Match? then copy data behind the = mark to clipboard.copy dial 112 to clipboard in this example5. Then if you perform the windows PASTE function then "dial 112" must appear. Thanks in advance, Jeanpierre
-
Sorry guys for for the inconvenience, but i need a little help #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> $GUIText = GUICreate("test", 311, 444, -1, -1) $EditBase = GUICtrlCreateEdit("", 32, 24, 249, 161) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Copy", 200, 192, 73, 25) $Button2 = GUICtrlCreateButton("Paste", 121, 189, 73, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ClipPut(GUICtrlRead($EditBase)) Case $Button2 GUICtrlSetData($EditBase, Clipget()) EndSwitch WEnd The paste button don't work, but i set the GUICtrlSetData to the same of ClipPut. Someone can tell me where i'm doing wrong? Thanks for all
-
Hey everyone, I am making a program which acts like a clipboard, but it also does a number of alterations to the data, like removing certain elements from HTML that has been copied. One problem I have come up against, is that I cannot send the keystroke CTRL+V when hotkeyset is specifying that that hotkey points to the paste function. The only way I have found around this (Other than using another hotkey for pasting, Ctrl+Shift+V which pastes straight from the windows clipboard anyway), is to input the data with the send command. The problem with this however, is that as I am sending thousands of letters at a time, it is taking forever to type it all out. Does anybody know a way around this? I am aware that there is a Hotkey UDF. Does anybody know if this addresses this problem? Thanks.