Jump to content

Excel cell not copying,,,,,,,,Give the value 0


vetold
 Share

Go to solution Solved by vetold,

Recommended Posts

#include <Date.au3>
#include <GUIConstants.au3>
#include <Excel.au3>

Global $Paused

HotKeySet("{ESC}", "Terminate")

Func Terminate()
Exit 0
EndFunc

$oExcel = ObjGet("C:\Users\tvois\Desktop\Start\Start.xlsx\", "Excel.Application") 
WinActivate("Start.xlsx - Excel", "")

 
For $i= 1 To 120 
$sCellValue = _Excel_RangeRead($oExcel, "A" & $i)

Opt("MouseCoordMode",0)
MouseClick("left" ,154, 345)
MouseClick("left" ,101, 378)
MouseClick("left" ,250, 144)

_Excel_RangeWrite($oExcel, "1", "B"&$i) 

Next

 

Link to comment
Share on other sites

#include <Date.au3>
#include <GUIConstants.au3>
#include <Excel.au3>

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Local $oExcel = _Excel_Open()
Local $sWorkbook = "C:\Users\tvois\Desktop\Start\Start.xlsx"
Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)

WinWaitActive("Start.xlsx", "", 10)


For $i = 1 To 120
    Local $sCellValue = _Excel_RangeRead($oWorkbook, Default, "A" & $i)

    Opt("MouseCoordMode", 0)
    MouseClick("left", 154, 345)
    MouseClick("left", 101, 378)
    MouseClick("left", 250, 144)

    _Excel_RangeWrite($oWorkbook, Default, $sCellValue, "B" & $i)
Next

 

Edited by SkysLastChance

You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott

Link to comment
Share on other sites

Check the value of @error and @extended after each _Excel_* function call.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...
On 17.09.2022 at 00:40, water said:

Проверяйте значение @error и @extended после каждого вызова функции _Excel_*.

 

On 16.09.2022 at 23:16, SkysLastChance said:
#include <Date.au3> 
#include <GUIConstants.au3> 
#include <Excel.au3>

HotKeySet ( "{ESC}" ,  "Завершить" )

Func Terminate ( ) 
    Exit  0 
EndFunc    ;==>Terminate

Локальный  $oExcel  =  _Excel_Open ( ) 
Локальный  $sWorkbook  =  "C:\Users\tvois\Desktop\Start\Start.xlsx" 
Локальный  $oWorkbook  =  _Excel_BookOpen ( $oExcel ,  $sWorkbook )

WinWaitActive ( "Start.xlsx" ,  "" ,  10 )


Для  $i  = от  1  до  120 
    Local  $sCellValue  =  _Excel_RangeRead ( $oWorkbook , по  умолчанию ,  "A"  и  $i )

    Opt ( "MouseCoordMode" ,  0 ) 
    MouseClick ( "влево" ,  154 ,  345 ) 
    MouseClick ( "влево" ,  101 ,  378 ) 
    MouseClick ( "влево" ,  250 ,  144 )

    _Excel_RangeWrite ( $oWorkbook , по  умолчанию ,  $sCellValue ,  "B"  и  $i ) 
Далее

 

_Excel_RangeWrite ( $oWorkbook , по  умолчанию ,  $sCellValue ,  "B"  и  $i ) 
How to make it paste data from the clipboard (copied) in a loop
Link to comment
Share on other sites

#include <Date.au3>
#include <GUIConstants.au3>
#include <Excel.au3>

Global $Paused

HotKeySet("{ESC}", "Terminate")

Func Terminate()
Exit 0
EndFunc

Local $oExcel = _Excel_Open()
Local $sWorkbook = "C:\Users\tvois\Desktop\Start\Start.xlsx"
Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)

WinWaitActive("Start.xlsx", "", 10)


For $i = 1 To 120
    Local $sCellValue = _Excel_RangeRead($oWorkbook, Default, "A" & $i)

MsgBox(4096, "", "Значение ячейки " & "A" & $i & ":" & @CRLF & $sCellValue, 2)
Sleep(2000)

if ProcessExists("chrome.exe") > 0 then
    ;MsgBox(0,"Chrome","esiste")
    Opt("WinTitleMatchMode", -2)
    WinActivate("Google Chrome")
    Opt("WinTitleMatchMode", 1)
Else
    MsgBox(0,"Chrome","non esiste")
endif

Opt("MouseCoordMode",0)
MouseClick("left" , 103, 376) 
Sleep(1000)
MouseClick("left" , 196 , 148) 
Sleep(500)
Send("{Delete 10}") 
Send($sCellValue,1) 
Sleep(1000)
Opt("MouseCoordMode",0)
MouseClick("left" ,1328, 716) 
Sleep(500)
MouseClick("left" , 397, 267, 2, 100) 
Sleep(1000)
MouseClick("left" , 379, 301, 1, 50) 
Sleep(2000)
MouseClick("left" , 462, 427, 2, 500) 
Sleep(1000)
MouseClick("left" , 192, 237, 2, 500) 
Sleep(1000)


Send("^{INSERT}")

Sleep(500)
MouseClick("left" , 1354, 117, 1, 500) 
Sleep(500)
MouseClick("left" , 497, 123, 1, 50)
Sleep(500)
MouseClick("left" , 365, 125, 1, 50)
Sleep(500)


Do
Sleep(10) ;ждать пока курсор нестанет стрелкой
Until MouseGetCursor( ) = 2
_Excel_RangeWrite($oWorkbook, Default, $sCellValue, "B" & $i = (ClipGet ( ))

Next
HERE is the whole code
It's in a loop
Edited by vetold
Link to comment
Share on other sites

2 hours ago, SkysLastChance said:

Я оставлю это на ваше усмотрение. У вас есть все необходимое в этой теме, чтобы сделать это самостоятельно. 

Suggest where to go?
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...