WinClip.ahk not working or user error?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
magicinmath
Posts: 162
Joined: 12 Apr 2017, 23:03

WinClip.ahk not working or user error?

29 Dec 2017, 09:54

Trying to use example 4b:
https://autohotkey.com/boards/viewtopic.php?f=7&t=8977

Got WinClip here:
https://autohotkey.com/board/topic/7467 ... pulations/

Placed the two WinClip ahk files on my desktop along with the rtf.rtf file I'd like to have pasted somewhere.

The code I'm using:

Code: Select all

#singleinstance force
#NoEnv  

#include C:\users\user.name\desktop\WinClipAPI.ahk
#include C:\users\user.name\desktop\WinClip.ahk

!m::
WinClip.Clear()
rtf := FileOpen("C:\users\user.name\desktop\rtf.rtf", "r").read()
WinClip.SetRTF(rtf)
WinClip.Paste()
Return
However, its not working, not sure if I'm doing something wrong or I cant use this with my current AHK: Version 1.1.25.01

Thanks for your time.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: WinClip.ahk not working or user error?

29 Dec 2017, 11:38

Hmm.
Even as a looser of tricky bullshit education regulations, I see the using of the "object oriented way" or however it's called.
"#include C:\users\user.name\desktop\WinClipAPI.ahk"
Am I wrong, or has user.name to be declared before using?
Try:

Code: Select all

#include C:\users\%A_UserName%\desktop\WinClipAPI.ahk
...
rtf := FileOpen("C:\users\" A_UserName "\desktop\rtf.rtf", "r").read()
Einfach nur ein toller Typ. :mrgreen:
magicinmath
Posts: 162
Joined: 12 Apr 2017, 23:03

Re: WinClip.ahk not working or user error?

29 Dec 2017, 12:25

divanebaba wrote:Hmm.
Even as a looser of tricky bullshit education regulations, I see the using of the "object oriented way" or however it's called.

This is purely to hide my username, not a variable.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: WinClip.ahk not working or user error?

29 Dec 2017, 12:48

magicinmath wrote:This is purely to hide my username, not a variable.
This makes support very easy. Using user.name is much more selfexplaining than using something like MyUserName, or insering a note into comments.
I don't see any other possibilities, that could cause your errors.
Maybe you have to include WinClip.ahk prior to WinClipAPI.ahk
divanebaba wrote:... This makes support very easy. ...
You will know, that is just a joke?
Last edited by divanebaba on 11 Jan 2018, 04:40, edited 1 time in total.
Einfach nur ein toller Typ. :mrgreen:
Guest

Re: WinClip.ahk not working or user error?

29 Dec 2017, 13:50

It should work with that version of AHK too (I've been using it for years), so my guess is that your application doesn't accept RTF.

1. what happens if you use HTML? OR
2. the filepath to your RTF isn't correct so nothing is being read into the rtf variable as such, double check that
3. How did you make the RTF file? (I use write/wordpad/libreoffice and MS Word and they all work)
User avatar
Maasq
Posts: 10
Joined: 09 Jun 2017, 14:36
Contact:

Re: WinClip.ahk not working or user error?

04 Jan 2018, 19:14

magicinmath wrote:The code I'm using:

Code: Select all

#singleinstance force
#NoEnv  

#include C:\users\user.name\desktop\WinClipAPI.ahk
#include C:\users\user.name\desktop\WinClip.ahk

!m::
WinClip.Clear()
rtf := FileOpen("C:\users\user.name\desktop\rtf.rtf", "r").read()
WinClip.SetRTF(rtf)
WinClip.Paste()
Return
I think it might be something quite simple. You need

Code: Select all

wc := new WinClip
Early in your code - just after your includes would do.

See how that goes for you.

Maasq
Maasq
Author of Engineer Suite (Written in AHK)
www.masq.net

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww and 321 guests