I was try to delete a background image from a pdf using an editor. It was difficult to do the same task for more then 100 pages.
Bingo! AutoIt is in handy to complete the task in few seconds... ok in less then 3 Minutes,
here it goes the script to select the page and delete the background.
Sleep(10000) ; To choose the application, script it is paused for 10 seconds
For $i = 1 to 600 ; Start page 1 to 600
Send ("!n") ;Send Alt +n
MouseClick("left", X, Y, 1) ;To Select background object, it is repeated object in pdf
send("{DEL}") ; To delete the object
Next
--------------------------------------------------------------------------------
new addition.
; Sleep for 5 seconds.
Sleep(5000)
For $i = 1 To 815 Step +1
Sleep(500)
MouseClick("left", 1371, 759, 1)
send ("{DEL}")
MouseClick("left", 1614, 1037, 1)
Next
----------------------------------------------------------------
Well the MouseClick function is used in the above script is to select a particular repeated object in the PDF.
You must the x and y coordinate of mouse and replace it in the script.
How to find the Mouse Coordinate of the repeated object....
Again you can use the AutoIt Script.
Sleep (15000)
$MousePos = MouseGetPos()
$MousePos[0] ; Mouse X position
$MousePos[1] ; Mouse Y position
msgbox(0,"Debug","Cursor located at " & $MousePos[0] & "," & $MousePos[1])
Note: Using the above script may delete the necessary objects in the document. Take a copy and use the script for delete the unnecessary repeating object in the same position.
Bingo! AutoIt is in handy to complete the task in few seconds... ok in less then 3 Minutes,
here it goes the script to select the page and delete the background.
Sleep(10000) ; To choose the application, script it is paused for 10 seconds
For $i = 1 to 600 ; Start page 1 to 600
Send ("!n") ;Send Alt +n
MouseClick("left", X, Y, 1) ;To Select background object, it is repeated object in pdf
send("{DEL}") ; To delete the object
Next
--------------------------------------------------------------------------------
new addition.
; Sleep for 5 seconds.
Sleep(5000)
For $i = 1 To 815 Step +1
Sleep(500)
MouseClick("left", 1371, 759, 1)
send ("{DEL}")
MouseClick("left", 1614, 1037, 1)
Next
----------------------------------------------------------------
Well the MouseClick function is used in the above script is to select a particular repeated object in the PDF.
You must the x and y coordinate of mouse and replace it in the script.
How to find the Mouse Coordinate of the repeated object....
Again you can use the AutoIt Script.
Sleep (15000)
$MousePos = MouseGetPos()
$MousePos[0] ; Mouse X position
$MousePos[1] ; Mouse Y position
msgbox(0,"Debug","Cursor located at " & $MousePos[0] & "," & $MousePos[1])
Note: Using the above script may delete the necessary objects in the document. Take a copy and use the script for delete the unnecessary repeating object in the same position.
No comments:
Post a Comment