Good coders gone wild!

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
User avatar
tidbit
Posts: 1167
Joined: 29 Sep 2013, 17:15
Location: USA

Good coders gone wild!

03 Dec 2019, 17:36

(an expansion from discord fun)
Try to write working code using as much bad practices as possible.
poor indenting, ahk quirks, generally frowned upon practices, do it all in one script!
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
AHKStudent
Posts: 858
Joined: 05 May 2018, 12:23

Re: Good coders gone wild!

09 Dec 2019, 05:25

How do I protect this code? MPRESS is not enough, is MCode good? Should I just watch the intellectual property webinar? I tried learning c++ but its very buggy, I went to change the STD:: hotkey to Q:: and my program broke. :thumbdown:

Code: Select all


SetBatchLines, -1 ; for great things
DetectHiddenText, on ; for optimal things
#NoEnv ; for amazing things
Global yourName ; avoid function headaches, make everything global
Global removeQuotes
Global TidBit
Global Hello
Global CountSomething
TimeNow := A_Now
TimeLate := A_TickCount
Greeting = "Hello" ; bug in ahk it should know only to look on the text in the quotes, maybe in V3 it will be fixed
yourName = "TidBit"
Sleep, 60 ; to protect the mouse from running too fast
Clipboard := RemoveQuotes(greeting) " " RemoveQuotes(yourName) ; store it in clipboard in case you need it later
ClipWait, 2 ; always wait a little 
MsgBox, % clipboard " The Date and Time now is " 
. TimeNow 
. " + " 
. (A_TickCount - TimeLate) 
. " MS."
if greeting = "Hello" 
if yourName = "Tidbit"
{
SetTimer, CountSomething, 200 ; start the loop
}
else
ExitApp
return


CountSomething:
Loop,
{
if A_index = 6
{
Settimer, CountSomething, Off  ; stop the timer
ToolTip ; turn off the tooptip or it can remain stuck until you remove the battery on your motherboard 
		ExitApp
break
}
toolTip, % A_Now
Sleep, 300 ; always add a sleep or the machine could overheat 
}
return

ExitApp

RemoveQuotes(Name) ; bug workaround 
{
{
removeQuotes := strreplace(Name, """") ; cleans up the data 0000.1 seconds faster than regex, took me a month to figure this out
	}
return removeQuotes
	}
	
User avatar
hoppfrosch
Posts: 405
Joined: 07 Oct 2013, 04:05
GitHub: hoppfrosch
Location: Rhine-Maine-Area, Hesse, Germany
Contact:

Re: Good coders gone wild!

09 Dec 2019, 05:39

I would prefer the other way round: bad coders writing perfect code!
This would make more sense - and is surely a much bigger challenge! :lol:
SOTE
Posts: 1021
Joined: 15 Jun 2015, 06:21

Re: Good coders gone wild!

09 Dec 2019, 05:41

AHKStudent wrote:
09 Dec 2019, 05:25
How do I protect this code? MPRESS is not enough, is MCode good? Should I just watch the intellectual property webinar? I tried learning c++ but its very buggy, I went to change the STD:: hotkey to Q:: and my program broke. :thumbdown:
LOL! Why can't people try AutoHotkey_H or FeiYue's Encryptor for AutoHotkey_L first, before worrying about if they are getting enough "protection". Let's make the new unreadable and unbreakable AutoHotkey coded script.
User avatar
Hellbent
Posts: 1057
Joined: 23 Sep 2017, 13:34

Re: Good coders gone wild!

09 Dec 2019, 10:34

I humbly submit every script I've ever written.


@AHKStudent

lol, you had me going for half a second there. :thumbup:
DRocks
Posts: 559
Joined: 08 May 2018, 10:20

Re: Good coders gone wild!

24 Jan 2020, 17:43

Code: Select all

myautohotkeyscript

messagebox "Hello"
return
The docs say to use MsgBox to display message but when I use it (messagebox "Hello") it doesnt work wtf ?
Also why does my comment on top "myautohotkeyscript" is preventing to compile ? isnt it obvious that its plain text ?
User avatar
Masonjar13
Posts: 1514
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Good coders gone wild!

17 May 2020, 13:19

Hey guys, I wrote a showcase script for AHKs best features! Hope you like it :shifty:
Btw, any way to avoid the join? Lmk.

Code: Select all

h
(join
o
t
k
e
y
)
,
(
a
)
,
(
a
)
s
(join
e
n
d
)
,
(
a
)
r
(join
e
t
u
r
n
)
a
(
:
)
m
(join
s
g
b
o
x
)
,
,
(join
K
i
l
l
%
a
_
s
p
a
c
e
%
M
e
)
,
(join
T
h
i
s
%
a
_
s
p
a
c
e
%
h
o
t
k
e
y
%
a
_
s
p
a
c
e
%
i
s
%
a
_
s
p
a
c
e
%
%
a
_
t
h
i
s
H
o
t
k
e
y
%
.
)
e
(join
x
i
t
A
p
p
)
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
Masonjar13
Posts: 1514
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Good coders gone wild!

17 Jun 2020, 17:57

Hey everyone, just wanted to share this new loop I designed! I call it RegLoad. Ha, get it? c:

Code: Select all

x:="hkcu\Software\ahkdumb",y:="Hello, AHK.."
regRead,a,% x
if errorlevel{
	regWrite,reg_sz,% x,,% a:=1
	run,notepad
	winWait,ahk_exe notepad.exe
}else if !a{
	exitApp
}
send,% subStr(y,a,1)
if (a=strLen(y)){
	regDelete,% x
	exitApp
}else{
	regWrite,reg_sz,% x,,% ++a
	reload
}
Spoiler
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests