Sign in to follow this  
Followers 0
Paulie

Not Working

15 posts in this topic

Why is this not working? I can not figure this out, I keep getting a badly formated func statement error

;~~~Declare Variables~~~
Global $on = 1
;~~~

;~~~Running Text Editor~~~
Run("notepad.exe")
;~~~

;~~Required Function~~~
While $on = 0
ToolTip(0,0, "Binary Is not On")
Sleep(1)
Wend

While $on = 1
ToolTip(0,0, "Binary Is On")
Sleep(1)
Wend
;~~~

;~~Declare Hotkeys~~~
HotkeySet("{HOME}", "On")
HotkeySet("{END}", "Off")
HotkeySet("1", "1")
HotkeySet("2", "2")
HotkeySet("3", "3")
HotkeySet("4", "4")
HotkeySet("5", "5")
HotkeySet("6", "6")
HotkeySet("7", "7")
HotkeySet("8", "8")
HotkeySet("9", "9")
HotkeySet("0", "0")
HotkeySet("a", "a")
HotkeySet("b", "b")
HotkeySet("c", "c")
HotkeySet("d", "d")
HotkeySet("e", "e")
HotkeySet("f", "f")
HotkeySet("g", "g")
HotkeySet("h", "h")
HotkeySet("i", "i")
HotkeySet("j", "j")
HotkeySet("k", "k")
HotkeySet("l", "l")
HotkeySet("m", "m")
HotkeySet("n", "n")
HotkeySet("o", "o")
HotkeySet("p", "p")
HotkeySet("q", "q")
HotkeySet("r", "r")
HotkeySet("s", "s")
HotkeySet("t", "t")
HotkeySet("u", "u")
HotkeySet("v", "v")
HotkeySet("w", "w")
HotkeySet("x", "x")
HotkeySet("y", "y")
HotkeySet("z", "z")
;~~~Set Fuctions~~~
Func On()
If $on = 0 then
   $on = 1
EndIf
EndFunc
;~~~
Func Off()
If $on = 1 then
   $on = 0
EndIf
EndFunc
;~~~
Func 1()
Send("0001")
EndFunc
;~~~
Func 2()
Send("0010")
EndFunc
;~~~
Func 3()
Send("0011")
EndFunc
;~~~
Func 4()
Send("0100")
EndFunc
;~~~
Func 5()
Send("0101")
EndFunc
;~~~
Func 6()
Send("0110")
EndFunc
;~~~
Func 7()
Send("0111")
EndFunc
;~~~
Func 8()
Send("1000")
EndFunc
;~~~
Func 9()
Send("1001")
EndFunc
;~~~
Func 0()
Send("1011")
EndFunc
;~~~

theres more, but the "1()" comes up bad

Share this post


Link to post
Share on other sites



cuz u cant have just a number as a fucntion must have somethign else in there i woud recomend an _ , and why do you have stuff turning on and off ? its not even doing anything cuz when your sending with functions its not even check if anythings on or off

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

cuz u cant have just a number as a fucntion must have somethign else in there i woud recomend an _ , and why do you have stuff turning on and off ? its not even doing anything cuz when your sending with functions its not even check if anythings on or off

Okay i changed all the number hotkeys and functions to have a" _" in front, but now, i get no error, but when i push the buton, it just types normally as opposed to sending the binary :think:

wats wrong with it?

Edited by Paulie

Share this post


Link to post
Share on other sites

Think a little... You are trying to make a program, what sends numbers 0 and 1, but 0 and 1 are hotkeys, so them functions are called. In 0 and 1 functions are some 0 and 1 too, so...

Share this post


Link to post
Share on other sites

Try disabling the hotkeys, sending, and then reenabeling them.


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Think a little... You are trying to make a program, what sends numbers 0 and 1, but 0 and 1 are hotkeys, so them functions are called. In 0 and 1 functions are some 0 and 1 too, so...

Sorry, but I don't understand :think:

Try disabling the hotkeys, sending, and then reenabeling them.

how do you disable hotkeys? that doesn't make any sense to me

Personally i don't like like the way i have this layed out, because binary numbers/letters are represented individualy, there is no way to make a 2 digit number with this program, but how wold i make it work? because 15 is differnt than 1&5 so maybe i should just use a formula to do it, but whats the formula. and then i would need a diferent box to type in like the enryptor example that come with autoit.

This is really ard and i need help

Does anyne have any ideas?

Edited by Paulie

Share this post


Link to post
Share on other sites

Disableing: HotKeySet("0") ;disables 0

Share this post


Link to post
Share on other sites

ur hotkeys have have a 0 and a 1, so if u press for example 1 then it sends , 1000 or whatever, but ur hotkeys are also contain a 0 and 1, so when it sends 1000 in binary , its going to call function 1 then 0 then 0 then 0

Share this post


Link to post
Share on other sites

ur hotkeys have have a 0 and a 1, so if u press for example 1 then it sends , 1000 or whatever, but ur hotkeys are also contain a 0 and 1, so when it sends 1000 in binary , its going to call function 1 then 0 then 0 then 0

Oh i understand now,

But thats not whas hapening

when i press 2 is types 2 not a continous streem of 000 and 001: i want it to type 010 though

Share this post


Link to post
Share on other sites

Alright, i've have come to a decision,

im trashing this code and actually making one in GUI that when you type in, it enrypts and derypts what you type.

the hotkey thing in this one wasn't working out for me, it was just getting harder and harder as i went farther, and having to change 70 hotkeys and functions was getting old

sorry if you actualy contributed help and ideas to tis code, but i dont think its going to work(if you can make it work PLZ post the code)

Now i have one question (there will most definatly be more for this program, as it is one of my first complicated not "hello world" GUIs)

Queston:

You have a string of numbers like the following

;(This is "2 2 2 2" in binary)

0010 0010 0010 0010

How can I have autoit read the string and find and identify the occureces of the 1s in it, and what place they're in so it can convert it to english?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Didnt look like u were doing it correctly

Binary Code
A
    
01000001
B
    
01000010
C
    
01000011
D
    
01000100
E
    
01000101
F
    
01000110
G
    
01000111
H
    
01001000
I
    
01001001
J
    
01001010
K
    
01001011
L
    
01001100
M
    
01001101
N
    
01001110
O
    
01001111
P
    
01010000
Q
    
01010001
R
    
01010010
S
    
01010011
T
    
01010100
U
    
01010101
V
    
01010110
W
    
01010111
X
    
01011000
Y
    
01011001
Z
    
01011010
    

    

Letter
    

Binary Code
a
    
01100001
b
    
01100010
c
    
01100011
d
    
01100100
e
    
01100101
f
    
01100110
g
    
01100111
h
    
01101000
i
    
01101001
j
    
01101010
k
    
01101011
l
    
01101100
m
    
01101101
n
    
01101110
o
    
01101111
p
    
01110000
q
    
01110001
r
    
01110010
s
    
01110011
t
    
01110100
u
    
01110101
v
    
01110110
w
    
01110111
x
    
01111000
y
    
01111001
z
    
01111010
Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Took 5 minutes:

;~~~Declare Variables~~~
Global $on = 1
;~~~

;~~~Running Text Editor~~~
Run("notepad.exe")
;~~~

;~~Declare Hotkeys~~~
HotkeySet("{HOME}", "On")
HotkeySet("{END}", "Off")
HotkeySet("1", "_1")
HotkeySet("2", "_2")
HotkeySet("3", "_3")
HotkeySet("4", "_4")
HotkeySet("5", "_5")
HotkeySet("6", "_6")
HotkeySet("7", "_7")
HotkeySet("8", "_8")
HotkeySet("9", "_9")
HotkeySet("0", "_0")
#cs
HotkeySet("a", "a")
HotkeySet("b", "b")
HotkeySet("c", "c")
HotkeySet("d", "d")
HotkeySet("e", "e")
HotkeySet("f", "f")
HotkeySet("g", "g")
HotkeySet("h", "h")
HotkeySet("i", "i")
HotkeySet("j", "j")
HotkeySet("k", "k")
HotkeySet("l", "l")
HotkeySet("m", "m")
HotkeySet("n", "n")
HotkeySet("o", "o")
HotkeySet("p", "p")
HotkeySet("q", "q")
HotkeySet("r", "r")
HotkeySet("s", "s")
HotkeySet("t", "t")
HotkeySet("u", "u")
HotkeySet("v", "v")
HotkeySet("w", "w")
HotkeySet("x", "x")
HotkeySet("y", "y")
HotkeySet("z", "z")
#ce
;~~~Set Fuctions~~~
;~~Required Function~~~
While 1
    If $on = 1 Then
ToolTip("Binary Is On", 0, 0)
Else
    ToolTip("Binary Is Off", 0, 0)
EndIf
Sleep(10)
Wend
;~~~
Func On()
   $on = 1
EndFunc
;~~~
Func Off()
   $on = 0
EndFunc
;~~~
Func _1()
    HotKeySet("0")
    HotKeySet("1")
Send("0001")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _2()
    HotKeySet("0")
    HotKeySet("1")
Send("0010")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _3()
    HotKeySet("0")
    HotKeySet("1")
Send("0011")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _4()
    HotKeySet("0")
    HotKeySet("1")
Send("0100")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _5()
    HotKeySet("0")
    HotKeySet("1")
Send("0101")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _6()
    HotKeySet("0")
    HotKeySet("1")
Send("0110")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _7()
    HotKeySet("0")
    HotKeySet("1")
Send("0111")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _8()
    HotKeySet("0")
    HotKeySet("1")
Send("1000")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _9()
    HotKeySet("0")
    HotKeySet("1")
Send("1001")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~
Func _0()
    HotKeySet("0")
    HotKeySet("1")
Send("1011")
HotKeySet("0", "_0")
HotKeySet("1", "_1")
EndFunc
;~~~

Worked on me...

Edited by poisonkiller

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I would think it would look more like this:

;~~~Declare Variables~~~
Global $on = 1, $BinarySetting = 1
;~~~

;~~~Running Text Editor~~~
Run("notepad.exe")
;~~~

;~~Declare Hotkeys~~~
HotkeySet("{HOME}", "On_Off")
For $i = 0 To 9
    HotkeySet($i, "_" & $i)
Next
#cs 
;a to z
For $x = 97 To 122
    $Insert = Chr($x)
    HotkeySet($Insert, $Insert)
Next
#ce
While 1
    If $on Then
        ToolTip("Binary Is On", 0, 0)
        If Not $BinarySetting Then
            _ActivateAllHotKeys()
            $BinarySetting = Not $BinarySetting
        EndIf
    ElseIf Not $on And $BinarySetting Then
        ToolTip("Binary Is Off", 0, 0)
        _TurnOffAllHotkeys()
        $BinarySetting = Not $BinarySetting
    EndIf
    Sleep(10)
Wend
;~~~
Func On_Off()
   $on = Not $on
EndFunc
;~~~
Func _TurnOffAllHotkeys()
    For $i = 0 To 9
        HotKeySet($i)
    Next
EndFunc

Func _ActivateAllHotkeys()
    For $i = 0 To 9
        HotkeySet($i, "_" & $i)
    Next
EndFunc

Func _TurnOffHotkey_0_1()
    HotKeySet("0")
    HotKeySet("1")
EndFunc

Func _ActivateHotkey_0_1()
    HotKeySet("0", "_0")
    HotKeySet("1", "_1")
EndFunc
    
Func _1()
    _TurnOffHotkey_0_1()
    Send("0001")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _2()
    _TurnOffHotkey_0_1()
    Send("0010")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _3()
    _TurnOffHotkey_0_1()
    Send("0011")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _4()
    _TurnOffHotkey_0_1()
    Send("0100")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _5()
    _TurnOffHotkey_0_1()
    Send("0101")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _6()
    _TurnOffHotkey_0_1()
    Send("0110")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _7()
    _TurnOffHotkey_0_1()
    Send("0111")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _8()
    _TurnOffHotkey_0_1()
    Send("1000")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _9()
    _TurnOffHotkey_0_1()
    Send("1001")
    _ActivateHotkey_0_1()
EndFunc
;~~~
Func _0()
    _TurnOffHotkey_0_1()
    Send("1011")
    _ActivateHotkey_0_1()
EndFunc
;~~~

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

For $x = 97 To 122

$Insert = Chr($x)

HotkeySet($Insert, $Insert)

Next

Incredible, Well I learned somthing today :think::(

Anyway,

WOW!, these scripts are genious, I am SO glad i belong to this forum :)

Thanks very much everyone,now i understand.

Share this post


Link to post
Share on other sites

Incredible, Well I learned somthing today :think::(

Anyway,

WOW!, these scripts are genious, I am SO glad i belong to this forum :)

Thanks very much everyone,now i understand.

Just FYI, the 97 to 122 was one way to do it. If your lazy and don't feel like looking it up, then you can always do:
For $x = Asc('a') To Asc('z')
    $Insert = Chr($x)
    HotkeySet($Insert, $Insert)
Next

I find sometimes I do that when in a rush.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0