Alodar Posted June 16, 2009 Posted June 16, 2009 So, I'm in the middle of making a hotkey set-up for some people at work (no idea why, they just wanted it, so I said ok), but one of the items they want is, instead of a text-string, a file. A word document to be exact. Is there a way to put a file on the clipboard in autoit? I've looked at the Clipboard management UDF (specifically the _ClipBoard_SetData function) as well as the ClipGet and ClipPut functions, but I'm not really sure how that would work, if at all. Any help? The current code is below. It's sloppy, I know, but I have problems with pasting data if I don't check it this way because these office computers aren't so great, and I'm kind of a hack and slash programmer. If you know a better way, I'm open to learning. expandcollapse popupHotKeySet("^=", "Terminate") HotKeySet("!1", "Paste1") HotKeySet("!2", "Paste2") HotKeySet("!3", "Paste3") HotKeySet("!4", "Paste4") $String1 = "Hotkey String 1" $String2 = "Hotkey String 2" $String3 = "Hotkey String 3" $String4 = "Hotkey String 4" While 1 Sleep(10) WEnd ;========================================== Func Paste1() Paste($String1) Sleep(500) EndFunc ;==>Paste1 Func Paste2() Paste($String2) Sleep(500) EndFunc ;==>Paste2 Func Paste3() Paste($String3) Sleep(500) EndFunc ;==>Paste2 Func Paste4() Paste($String4) Sleep(500) EndFunc ;==>Paste2 ;========================================== Func Terminate() Exit 0 EndFunc ;==>Terminate ;========================================== Func Paste($PasteItem) If $PasteItem = "" Or $PasteItem = Chr(0) Then Return (0) EndIf ClipPut($PasteItem) Local $temp = ClipGet() If $temp <> $PasteItem Then While $temp <> $PasteItem Sleep(50) ClipPut($PasteItem) Sleep(50) $temp = ClipGet() Sleep(50) WEnd EndIf Sleep(200) Send("^v") Sleep(500) EndFunc ;==>Paste
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now