ppt以位图粘贴图片的几种方法:vba、autohotkey

vba:
Sub tt()
'CommandBars("Menu Bar").FindControl(Id:=109, Visible:=True, Recursive:=True).Execute
'Application.CommandBars.FindControl(Id:=109).Execute
 On Error GoTo ErrorHandler
  ActiveWindow.View.PasteSpecial DataType:=ppPasteBitmap, DisplayAsIcon:=msoTrue, IconLabel:="New Bitmap Image"
  SendKeys "%hg", True
 Exit Sub
ErrorHandler:     MsgBox "选择性粘贴性失败,请先Copy图片再执行本功能", vbOKOnly + vbCritical, "选择性粘贴"
End Sub
-----------------------------------------------------------------------------------------
 
autohotkey:
#p::
Send ^!v
WinWaitActive 选择性粘贴 
;sleep 3000
;Control, Choose, 3, REListBox20W1, 选择性粘贴
Control, ChooseString,位图, REListBox20W1, 选择性粘贴
Send {alt}+{h}+{g}
Send {k}
--------------------------------------------------------------------------------------------
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments.  They are not executed.
; This script has a special filename and path because it is automatically
; launched when you run the program directly.  Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it.  You can have as many .ahk
; files as you want, located in any folder.  You can also run more than
; one .ahk file simultaneously and each will get its own tray icon.
; SAMPLE HOTKEYS: Below are two sample hotkeys.  The first is Win+Z and it
; launches a web site in the default browser.  The second is Control+Alt+N
; and it launches a new Notepad window (or activates an existing one).  To
; try out these hotkeys, run AutoHotkey again, which will load this file.
#z::Run www.autohotkey.com
^!n::
IfWinExist Untitled - Notepad
 WinActivate
else
 Run Notepad
return
#m::
MsgBox, 4,?,Yes or No? 
ifMsgBox Yes      
 MsgBox You Said Yes! 
else     
 MsgBox You Said No?
return
SetTitleMatchMode 2 
#tab:: 
ifWinNOtExist,Ho 
{      
 MsgBox GVIM is not running
; return  
} 
IfWinNotActive,GVIM
{
 MsgBox GVIM is  notactive     
 WinActivate,GVIM  
}
else      
 run,Notepad  
return
#c::
SetTitleMatchMode 2  
Loop, 2  
{     
Random, x, 0, 50      
Random, y, 0, 50      
WinMove,GVIM,, %x%, %y%      
WinHide,GVIM      Sleep, 100      
WinShow,GVIM  
}
SetTitleMatchMode 2  
SetKeyDelay 50  
Words = WARNING {!} DO NOT OPERATE MY COMPUTER{!}
KeyWait, LButton, D  
run,Notepad YouAreUnderMonitored,,Max  
WinWait,YouAreUnderMonitored  
Send i%Words%{Esc}
  
#d::
;run explore D:
Run, Notepad, , , ThisPID    ;先获得运行的记事本程序的进程ID  
WinWait, 无标题 - 记事本 ahk_pid %ThisPID%    ;等待该进程窗口的出现  
WinGet, ThisHWND, ID, 无标题 - 记事本 ahk_pid %ThisPID%   ;获得窗口句柄  
WinActivate, ahk_id %ThisHWND% ;这里的ahk_id表明跟在后面的变量是窗口句柄  
WinWaitActive, ahk_id %ThisHWND%  
Sleep, 3000  
WinClose, ahk_id %ThisHWND%  
WinWaitClose, ahk_id %ThisHWND% 
return
#b::
;AHK: ControlClick [, 目标控件或坐标位置, 窗口标题, 窗口文本, 鼠标按钮, 点击次数, 选项,排除标题, 排除文本] 
; 对AHK而言,“目标控件”参数是指要点击的控件的类别名(ClassNN)或控件文本,
;另外还可以使用控件句柄(若用的是控件句柄则第一个参数需留空,并在第二个参数中使用ahk_id %控件句柄%)。 
Run, Sysdm.cpl  
WinWait, 系统属性  
WinActivate, 系统属性  
WinWaitActive, 系统属性 
ControlClick, 确定, 系统属性,,R
;ControlClick, Button2, 系统属性
;AHK: ControlSetText [, 目标控件, 新文本, 窗口标题, 窗口文本, 排除标题, 排除文本]
#x::
ControlSetText,edit1,oooo,打开
#a::
;send !fs
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
MouseClick,r,1567 ,1030
return
#q::
;1、选中和取消选中单选框和复选框项目
;如何保证选中所需项目并取消某些项目呢? 
;下面先来介绍AHK中用来对控件进行各种属性设置的命令/函数: 
;AHK: Control [, 命令, 值, 目标控件, 窗口标题, 窗口文本, 排除标题, 排除文本] 
;其中,“命令”就是让我们指定要进行何种设置的参数。对这些单选框/复选框按钮来说,
;适用的命令是“Check”和“UnCheck”。 
;假设这个窗口的标题是为Setup foobar,我们打算进行下来操作: 
;选中它的“桌面”复选框(Button5)、取消选中“快速启动栏”复选框(Button7); 
;选中“0.7x”单选框(Button14)。
Control, Check, , Button2,Compute属性
Control, UnCheck, , Button3, Compute属性
#w::
;2、选择下拉列表的项目
;答案仍是使用上面提到的命令/函数。
;对这种控件而言,AHK适用的命令是“Choose, N”和“ChooseString, String”,
;分别表示选中第N个项目和选中与字符串String匹配的项目。
Control, Choose, 1, ComboBox1, Compute属性 
Control, ChooseString,Windows 95, ComboBox1, Compute属性
;;;;;;;;;;;; For PPT use  ;;;;;;;;;;;;;
#down::
Send {alt}+{h}+{g}+{b}
return
#up::
Send {alt}+{h}+{g}+{f}
return
#!l::
Send {alt}+{h}+{g}+{a}+{l}
return
#!c::
Send {alt}+{h}+{g}+{a}+{c}
return
#!r::
Send {alt}+{h}+{g}+{a}+{r}
return
#!t::
Send {alt}+{h}+{g}+{a}+{t}
return
#!m::
Send {alt}+{h}+{g}+{a}+{m}
return
#!b::
Send {alt}+{h}+{g}+{a}+{b}
return
#!h::
Send {alt}+{h}+{g}+{a}+{h}
return
#!v::
Send {alt}+{h}+{g}+{a}+{v}
return
#p::
Send ^!v
WinWaitActive 选择性粘贴 
;sleep 3000
;Control, Choose, 3, REListBox20W1, 选择性粘贴
Control, ChooseString,位图, REListBox20W1, 选择性粘贴
Send {alt}+{h}+{g}
Send {k}
;;;;;;;;;;;; For PPT use  ;;;;;;;;;;;;;

; Note: From now on whenever you run AutoHotkey directly, this script
; Please read the QUICK-START TUTORIAL near the top of the help file.
; It explains how to perform common automation tasks such as sending
; keystrokes and mouse clicks.  It also explains more about hotkeys.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值