1
2
3
4
5
6
7
8
9
10
import xlrd
 
book = xlrd.open_workbook('sample.xlsx')
sheet = book.sheet_by_name('Sheet1')
 
 
print(sheet.cell_value(1,0))
 
print(int(sheet.cell_value(2,2)))
 

cs


3행 엑셀파일 불러오기

4행 sheet1 불러오기


7행 텍스트 셀값 불러오기

9행 수 셀값 불러오기


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import xlrd
 
book = xlrd.open_workbook('sample.xlsx')
sheet = book.sheet_by_name('Sheet1')
 
mail = []
for i in range(1,sheet.nrows):
    a_col = sheet.cell_value(i,0)
    mail.append(a_col)
 
name = []
for i in range(1,sheet.nrows):
    b_col = sheet.cell_value(i,1)
    name.append(b_col)
 
turn = []
for i in range(1,sheet.nrows):
    c_col = int(sheet.cell_value(i,2))
    turn.append(c_col)
 
print(mail) 
print(name) 
print(turn)
 
cs


6행 mail 리스트만들기

7~9행 A열값 한 줄씩 불러와 mail 리스트에 추가하기


11행 name 리스트만들기

12~14행 B열값 한 줄씩 불러와 name 리스트에 추가하기


16행 turn 리스트만들기

17~19행 B열값 한 줄씩 불러와 turn 리스트에 추가하기 (숫자부분이라 정수형으로 만들어줌 int)

naver_mail.zip


파이썬으로 엑셀파일을 읽어 메일주소, 사람이름등을 바꿔가며 보내주는 프로그램입니다.


즉 메일머지 기능입니다. <<cell_b>>, <<cell_c>>,<<cell_d>>가 변화되는 부분입니다.






SMTP로 발송하면 네이버 발송메일함에 안들어가나 봅니다.


마지막에는 자기의 메일 주소를 넣어서 제대로 갔는 지 확인합시다


한 번 테스트 해보시면 바로 이해하실 껍니다.




너무 많이 보내면 네이버에서 스팸으로 취급해서 차단할 수도 있다고 합니다.


찾아봤는데 1시간에 X통 1일 x통이라고 하는데 정확히 모르겠습니다.


제가 예전에 확인 했을 때는 1번에 50통이 들어가던데...



한 번에 몇 백통씩 쏘는 게 아니면 괜찮은건지....


아마 하루에 얼마까지라는 리밋도 있긴 할 껀데...



소모임 발송용으로 사용하는데는 문제 없을꺼 같습니다.





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from tkinter import *
from tkinter import ttk
from pynput import mouse
import pyautogui
 
root = Tk()
root.title("마우스 좌표 찾기")
root.geometry("350x100")
 
########################################
label1 = Label(root, text = "X좌표")
label1.grid(row=1, column=1)
 
entry1 = Entry(root, width=10 )
entry1.grid(row=1, column=2)
 
label2 = Label(root, text = "Y좌표")
label2.grid(row=1, column=3)
 
entry2 = Entry(root, width=10 )
entry2.grid(row=1, column=4)
 
button1 = Button(root, text="마우스위치", command = lambda:aaa())
button1.grid(row=1, column=5)
 
############################################
 
label3 = Label(root, text = "반복횟수")
label3.grid(row=2, column=1)
 
entry3 = Entry(root, width=10)
entry3.grid(row=2, column=2)
entry3.insert('end','100')
###########################################
 
button2 = Button(root, text="클릭 시작", command = lambda:click_m())
button2.grid(row=3, column=3)
 
########################################  
def aaa():
    with mouse.Listener(
        on_click=bbb
        ) as listener:
        listener.join()
    entry1.insert("end",x1)
    entry2.insert("end",y1)
 
def bbb(x, y, button, pressed):
    if pressed:
        global x1
        global y1
        x1 = x
        y1 = y
        
    if not pressed :
        return False
 
def ccc():
    entry1.insert("end",x1)
    entry2.insert("end",y1)
 
 
def click_m():
    click_num = int(entry3.get())
 
    ##반복시작
    for a in range(0,click_num):
        pyautogui.click(x1,y1)
        
root.mainloop()
 
cs


간략 설명 : 원하는 구역을 마우스로 클릭해서 좌표를 입력하고 그 좌표를 마우스가 자동으로 반복 클릭하는 오토마우스


1.[마우스위치] 버튼을 클릭해서 함수를 작동시킨다.


2.pynput 를 사용해서 윈도우 전체화면에서 마우스의 좌표를 찾는다.

(with mouse.Listener)


3.전체화면에서 반복 클릭하고 싶은 곳에 마우스를 클릭하면 Entry에 마우스의 x값과 y값을 넣는다. (entry.insert)


4.반복 횟수를 정한다 


5.[클릭시작] 버튼을 눌러서 x,y위치에 반복횟수반큼 클릭을 시작한다.

pyautogui


https://drive.google.com/drive/folders/1Xiw6XoFzP3ILq2ZSmHzG60dKIKnm3RWh?usp=sharing



mouse event in Python tkinter 

python mouse click cursor position using pynput with tkinter

pyautogui click


윈도우10. 파이썬3.6

pynput 1.4

pyautogui 0.9.38



V앱이나 인스타라이브 같은거 반복적으로 하트 누를 때 사용하면 좋을듯



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from tkinter import *
from tkinter import ttk
from pynput import mouse #마우스, 키보드 모니터링 라이브러리
 
root = Tk()
root.title("마우스 좌표 찾기")
root.geometry("300x300")
 
########################################
entry1 = ttk.Entry(root, width=10 )
entry1.grid(row=0, column=1)
 
entry2 = ttk.Entry(root, width=10 )
entry2.grid(row=0, column=2)
 
button1 = ttk.Button(root, text="마우스위치", command = lambda:aaa())
button1.grid(row=0, column=3)
 
########################################  
def aaa():
    with mouse.Listener( #마우스 모니터링 
        on_click=bbb
        ) as listener:
        listener.join()
    ccc()    
 
def bbb(x, y, button, pressed):
    if pressed:
        global x1
        global y1
        x1 = x
        y1 = y
        
    if not pressed :
        return False
 
def ccc():
    entry1.delete(0,"end"#처음부터 끝까지 삭
    entry2.delete(0,"end")
    entry1.insert("end",x1) #끝에 입력
    entry2.insert(0,y1)     #처음에 입력
 
root.mainloop()
 
cs







+ Recent posts