티스토리 뷰

import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;


public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Start");
		Thread.sleep(2000);		
		Runtime rt=Runtime.getRuntime();
		//IE 실행
		String ie="C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
		Process pro=null;
		try {
			pro=rt.exec(ie);
			pro.waitFor();
		}catch(Exception e) {
			e.printStackTrace();
		}
		Thread.sleep(200);
		Robot robot=new Robot();
		
		//화면최대화
        /*
		robot.keyPress(KeyEvent.VK_WINDOWS);
		robot.keyPress(KeyEvent.VK_UP);
		Thread.sleep(500);
		robot.keyRelease(KeyEvent.VK_WINDOWS);
		robot.keyRelease(KeyEvent.VK_UP);
		robot.delay(1000);
*/

		
		//주소창 클릭
		robot.mouseMove(471,58);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(500);
		
		String str="";
		str="naver.com";
		//클립보드로 복사
		StringSelection data=new StringSelection(str);
		Clipboard clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
		Thread.sleep(200);
		
		//붙여넣기
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_V);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.delay(200);
		
		//엔터버튼 클릭
		robot.keyPress(KeyEvent.VK_ENTER);
		robot.keyRelease(KeyEvent.VK_ENTER);
		robot.delay(2000); //네트워크 시간 고려
        
		
		//로그인 버튼 클릭
		robot.mouseMove(1347,380);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(200);
		
		str="jung945";
		//클립보드로 복사
		data=new StringSelection(str);
		clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
		Thread.sleep(200);
		
		//붙여넣기
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_V);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.delay(200);
		
		//탭버튼 클릭
		robot.keyPress(KeyEvent.VK_TAB);
		robot.keyRelease(KeyEvent.VK_TAB);
		robot.delay(200);
		
		str="pass";
		//클립보드로 복사
		data=new StringSelection(str);
		clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
		Thread.sleep(500);
		//붙여넣기
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_V);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.delay(500);
		
		//로그인 버튼 클릭
		robot.mouseMove(970,559);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(1000);
		
		//주소창 클릭
		robot.mouseMove(471,58);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(200);
		
		str="https://cafe.naver.com/ca-fe/cafes/10050146/articles/write?boardType=L";
		//클립보드로 복사
		data=new StringSelection(str);
		clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
		Thread.sleep(200);
		
		//붙여넣기
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_V);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.delay(200);
		
		//엔터버튼 클릭
		robot.keyPress(KeyEvent.VK_ENTER);
		robot.keyRelease(KeyEvent.VK_ENTER);
		robot.delay(5000);
		
		
		//게시판을 선택해주세요 클릭
		robot.mouseMove(506,458);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(500);
		
		//중고나라 무료나눔 클릭
		robot.mouseMove(489,509);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(1000);
		
		//제목을 입력해주세요 클릭
		robot.mouseMove(515,528);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(500);
				
		str="무료나눔";
		//클립보드로 복사
		data=new StringSelection(str);
		clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
		Thread.sleep(200);
		
		//붙여넣기
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_V);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.delay(200);
		
		//본문클릭
		robot.mouseMove(537,922);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(200);
		
		//전체선택 및 삭제
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_A);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.keyPress(KeyEvent.VK_DELETE);
		robot.keyRelease(KeyEvent.VK_DELETE);
		robot.delay(200);

		
		str="무료나눔합니다.";
		//클립보드로 복사
		data=new StringSelection(str);
		clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
		clipboard.setContents(data, data);
		Thread.sleep(200);
		
		//붙여넣기
		robot.keyPress(KeyEvent.VK_CONTROL);
		robot.keyPress(KeyEvent.VK_V);
		robot.keyRelease(KeyEvent.VK_CONTROL);
		robot.keyRelease(KeyEvent.VK_V);
		robot.delay(200);
		
		//등록버튼 클릭
		robot.mouseMove(1456,145);
		robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); //왼쪽 누르기
		robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); //떼기
		robot.delay(200);
		
/*
        */
		
    }
}

'네이버게시판 자동 글쓰기' 카테고리의 다른 글

네이버 게시판 자동 글쓰기  (0) 2025.02.11
자바 좌표값 얻기  (0) 2025.02.11
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
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
글 보관함