Script works well on Win8 not working on Win10 Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35
Facebook: olaniyan opemiposi
Google: olaniyan opemiposi

Script works well on Win8 not working on Win10

24 May 2018, 20:41

^m::
send, !a
send, !{tab}
clpbrd := Clipboard
ArrayOfText := StrSplit(clpbrd , "`r")
Clipboard :=
LineIndex := ArrayOfText._MaxIndex()
for index, value in ArrayOfText
ArrayOfText[index] := Trim(value, "`n")
Loop
{
if (LineIndex<>1)
{
Clipboard .= ArrayOfText[LineIndex] . "`r`n"
}
else
{
Clipboard .= ArrayOfText[LineIndex]
}
LineIndex--
} Until LineIndex = 0
Loop, Parse, Clipboard, `n, `r
{
NewWord := A_LoopField
New := True
Loop, %Number%
{
If (OldWords%A_Index% = NewWord)
{
New := False
Break
}
}
If New
{
Number++
OldWords%Number% := NewWord
Send, %NewWord%`n
}
}
Return

Code: Select all

.



This script above works well with my clipboard while was still using windows 8.1 and now I've changed to windows 10 and the script isn't working well on it, it will rather show run-time error 521 can't open clipboard and the rest functions in the script wont go through, pls how can I make my windows to be compatible and work well with my ahk script?
Last edited by legend maxfreak on 27 May 2018, 05:55, edited 1 time in total.
AHKStudent
Posts: 308
Joined: 05 May 2018, 12:23

Re: Script works well on Win8 not working on Win10

25 May 2018, 01:09

try running it as admin
swagfag
Posts: 1244
Joined: 11 Jan 2017, 17:59

Re: Script works well on Win8 not working on Win10  Topic is solved

25 May 2018, 06:08

Clipboard := i wouldnt recommend doing that, even if youre running #NoEnv, change it to Clipboard := ""

instead of appending to the clipboard Clipboard .=, try doing that with a variable, which you will assign to the clipboard once the loop is done. I dont know if this will make a difference, just throwing it out there, but i cant imagine accessing the clipboard for writing in a loop as being the "healthy" thing to do
User avatar
legend maxfreak
Posts: 73
Joined: 03 Sep 2017, 04:35
Facebook: olaniyan opemiposi
Google: olaniyan opemiposi

Re: Script works well on Win8 not working on Win10

26 May 2018, 11:43

Problem solved, thank you all, ran it with admin and make changes to #NoEnv and clipboard

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], g0ss, JoeWinograd, truekefir and 28 guests