Page 1 of 1

Good coders gone wild!

Posted: 03 Dec 2019, 17:36
by tidbit
(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!

Re: Good coders gone wild!

Posted: 09 Dec 2019, 05:25
by AHKStudent
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
	}
	

Re: Good coders gone wild!

Posted: 09 Dec 2019, 05:39
by hoppfrosch
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:

Re: Good coders gone wild!

Posted: 09 Dec 2019, 05:41
by SOTE
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.

Re: Good coders gone wild!

Posted: 09 Dec 2019, 10:34
by Hellbent
I humbly submit every script I've ever written.


@AHKStudent

lol, you had me going for half a second there. :thumbup:

Re: Good coders gone wild!

Posted: 24 Jan 2020, 17:43
by DRocks

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 ?

Re: Good coders gone wild!

Posted: 17 May 2020, 13:19
by Masonjar13
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
)

Re: Good coders gone wild!

Posted: 17 Jun 2020, 17:57
by Masonjar13
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

Re: Good coders gone wild!

Posted: 29 Jul 2020, 23:51
by ShambleS1980
just a simple autoclicker.


Code: Select all

#MaxThreadsPerHotkey 2
setbatchlines, -1 
while GetKeyState("xbutton1","T")
xbutton1::
toggle := !toggle
If (!Toggle)
    goto, stop
If (Toggle)
    goto, canyou
return
omg:
loop
{
click
}
return
ffs:
reload
return
canyou:
goto, really
return
seriously:
SoundBeep , 750, 500
goto, ffs
return
stop:
msgbox, pointless message here too
goto, seriously
return
really:
msgbox, Pointless message here
SoundBeep , 300, 600
goto, omg
return

p.s
i am not a good coder, Just decided to make a script to annoy the people who saw it..

p.p.s

I decided the above was too useful..
so here we go

Code: Select all

while GetKeyState("xbutton1","T")
$*xbutton1::
toggle := !toggle
If (!Toggle)
    goto, 111111
If (Toggle)
    goto, 1111111
return
11111:
send, {xbutton1}
SoundBeep , %11111%, %IIIII%
return
11111111:
send, {xbutton1}
SoundBeep , %11111%, %IIIII%
goto, 1111III
return
111111111:
loop
{
GetKeyState("capslock","T")
send, {xbutton1}
while GetKeyState("lshift","T")
send, {xbutton1}
while GetKeyState("rshift","T")
send, {xbutton1}
while GetKeyState("a","T")
send, {xbutton1}
while GetKeyState("b","T")
send, {xbutton1}
while GetKeyState("c","T")
send, {xbutton1}
reload
}
return

1111111:
SoundBeep , %11111%, %IIIII%
goto, IIIIIIII
return
IIIIIIIIII:
SoundBeep , %11111%, %IIIII%
goto, 11111111
return

111111:
msgbox, pointless message here too
SoundBeep , %11111%, %IIIII%
goto, IIIIIIIIII
return
IIIIIIII:
msgbox, Pointless message here
SoundBeep , %11111%, %IIIII%
goto, 11111
return
1111III:
reload
return
esc::exitapp


Re: Good coders gone wild!

Posted: 30 Sep 2021, 17:44
by ShambleS1980
Actually gave some one this dogs breakfast as code today..

"in my defence they pinged me for some un known reason, and i nad to put the kids to bed"

Code: Select all

$*a::
vara := 1
send, {blind}a
return
$*a up::
vara := 0
settimer, aspam, off
return

*$b::
varb := 1
send, {blind}b
return
$*b up::
varb := 0
settimer, bspam, off
return

#if vara
*a up::
vara := 0
settimer, aspam, off
return
*b up::
settimer, aspam, 20
return
#if

#if varb
$*b up::
varb := 0
settimer, bspam, off
return
a up::
settimer, bspam, 20
return
#if

aspam:
send, {blind}a
if !getkeystate("a","p")
{
settimer, aspam, off
vara := 0
}
return

bspam:
send, {blind}b
if !getkeystate("b","p")
{
settimer, bspam, off
varb := 0
}
return

Re: Good coders gone wild!

Posted: 18 May 2022, 22:41
by ShambleS1980
BEHOLD MY CREATION!

Code: Select all

#persistent
settitlematchmode 2
DetectHiddenWindows On

f2::
WinGet, count, list, ahk_class AutoHotkey
WinGet, title, ID, tester.ahk ahk_class AutoHotkey

loop % count
{
countvar%a_index% := count%a_index%
}
var := countvar1 " " . countvar2 " " . countvar3 " " . countvar4 " " . countvar5 " " . countvar6 " " .  countvar7 " " . countvar8 " " . countvar9 " " . countvar10 " " . countvar11 " "

output := StrReplace(var, title, ".")
array := StrSplit(output, A_Space, ".")


Loop % array.MaxIndex()
{
 PostMessage, 0x111, 65307,,, % "ahk_id" array[a_index]
}

reload ; comment this out, and uncomment "exitapp" if you wantto exit the script instead 
sleep 100
; exitapp "uncomment this if you want to close this script, and remember to comment out reload"
return
this works as intended, and i had to bend over backwards not to use a real array in this one.

Re: Good coders gone wild!

Posted: 12 Jun 2022, 19:39
by ShambleS1980
Ok this 1 im annoyed about..
some one refuzed to use

Code: Select all

:?*:nn::ñ
So I had to write this!

Code: Select all

~n::
doExtraStuff10++
settimer, clearvar, -200
if !getkeystate("capslock","t")
setTimer, extraStuffTimer10, -140
else
seTtimer, extrastuffdifferent, -140
return

~+n::
doExtraStuff10++
settimer, clearvar, -200
if getkeystate("capslock","t")  ; This time we want this timer to trigger IF caps lock is on
setTimer, extraStuffTimer10, -140
else
seTtimer, extrastuffdifferent, -140
return

extraStuffTimer10:
if (doExtraStuff10 == 2) {
    Send {Blind}{BackSpace}
    Send {Blind}{BackSpace}
    Send ñ
}
return

extrastuffdifferent:
if (doExtraStuff10 == 2) {
    Send {Blind}{BackSpace}
    Send {Blind}{BackSpace}
send Ñ
}
return

clearvar:
doExtraStuff10 := 0
return

Re: Good coders gone wild!

Posted: 13 Jun 2022, 15:47
by tidbit
I weep for you

Re: Good coders gone wild!

Posted: 15 Jun 2022, 03:06
by Delta Pythagorean
Forgive me father for I have sinned.

Code: Select all

name=  ;//Enter your name here!!!

email=  ;//Enter your email here!!!

password=  ;//Enter your password here, don't tell anyone!!!

setBatchLines,100 ;// Add 100 milliseconds in between each command.

goTo,AutoExecSection ;// Go to the AutoExecSection label.


;// Auto exec section

AutoExecSection:

msgBox,0,Best Hacker Script Ever!!,Thanks for downloading this script! It's the best hacker script ever!!, 5 ;// Display a message box.

formatTime,time,,HH:mm:ss tt ;//Get the current time.

toolTip,The Time is: %time% ;//Display the current time in a tool tip.

return ;//Close out of the auto exec section


;// Bunny hop when you hold spacebar!

Space::

getKeyState,space_keyPress,Space,P ;//Check if the spacebar is pressed.

ifEqual,space_keyPress,1,setTimer,BunnyHop,100 ;//If the spacebar is pressed, execute the BunnyHop label.

else

setTimer,BunnyHop,off ;//If the spacebar is not pressed, turn off the timer.

return


;// Bunny hop code
BunnyHop:

send,{Space} ;//Press the spacebar.

return ;//Close out of the BunnyHop label.