Jump to content

Obfuscation Error: Found HotKeySet() statement using unsolvable Func,


taurus905
 Share

Recommended Posts

The following code runs fine unless it is obfuscated. I would appreciate any help in finding a work-around for this since the obfuscator is one of the best features of AutoIt. And that is saying a lot since AutoIt is so fantastic.

Thanks for any suggestions.

taurus905

; Variable Function Name - Hotkey Example.au3
; Use variable as function name to set hotkey

Dim $HKey[4] = ["", "One", "Two", "Three" ] ; Variable

For $i = 1 To 3
    HotKeySet("{" & "F" & $i & "}", $HKey[$i]) ; Set f-key (1 to 3) as hotkey
Next

While 1
    Sleep(10)
WEnd

Exit

Func One()
    MsgBox(0, "You Pressed", "F1" & " Key", 1)
EndFunc   ;==>One

Func Two()
    MsgBox(0, "You Pressed", "F2" & " Key", 1)
EndFunc   ;==>Two

Func Three()
    MsgBox(0, "You Pressed", "F3" & " Key", 1)
EndFunc   ;==>Three

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

What is your exact problem with the obfuscated code? It worked fine for me :)

Bert,

Could you please post your obfuscated code of the above example so I can run it? I am using the latest AutoIt and SciTE, but when I obfuscate the scirpt, I get the error that is in the title of this post. Maybe something is corrupted.

Thanks for taking the time.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
Share on other sites

Bert,

Could you please post your obfuscated code of the above example so I can run it? I am using the latest AutoIt and SciTE, but when I obfuscate the scirpt, I get the error that is in the title of this post. Maybe something is corrupted.

Thanks for taking the time.

taurus905

Ok... When i last posted, it ran. I think. It appears yes, it is corrupt. The creater will know the answer. He knows all :)
Link to comment
Share on other sites

I think the problem is, that the way obfuscator works, can't determanite the parameters in the HotKeySet..

The same problem that does, that you cant use Call

From the forum

Warn you about the use of these AutoIt3 Functions and in which File/Func/line they are used and the Parameter contains an Ampersand (&), since they will cripple the functioning of the script when used:

* adlibenable()

* call()

* eval()

* guiregistermsg()

* guisetonevent()

* guictrlsetonevent()

* hotkeyset()

* isdeclared()

* trayitemsetonevent()

* objevent()

* Opt("OnExitFunc","OnAutoItExit")

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

  • Developers

The issue is that Obfuscator will rename the FUNCnames to some random name after which they don't match with the Array values anymore.

The only solution I have is to do it this way:

Dim $HKey[4] = ["", "One", "Two", "Three" ]; Variable

For $i = 1 To 3
    HotKeySet("{" & "F" & $i & "}", $HKey[$i]); Set f-key (1 to 3) as hotkey
Next

While 1
    Sleep(10)
WEnd

Exit

#Obfuscator_off
Func One()
#Obfuscator_on
    MsgBox(0, "You Pressed", "F1" & " Key", 1)
EndFunc;==>One

#Obfuscator_off
Func Two()
#Obfuscator_on
    MsgBox(0, "You Pressed", "F2" & " Key", 1)
EndFunc;==>Two

#Obfuscator_off
Func Three()
#Obfuscator_on
    MsgBox(0, "You Pressed", "F3" & " Key", 1)
EndFunc;==>Three

The Obfuscator Warnings will remain because it will never be able to figure out if the script is vald or not.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The issue is that Obfuscator will rename the FUNCnames to some random name after which they don't match with the Array values anymore.

The only solution I have is to do it this way:

Dim $HKey[4] = ["", "One", "Two", "Three" ]; Variable

For $i = 1 To 3
    HotKeySet("{" & "F" & $i & "}", $HKey[$i]); Set f-key (1 to 3) as hotkey
Next

While 1
    Sleep(10)
WEnd

Exit

#Obfuscator_off
Func One()
#Obfuscator_on
    MsgBox(0, "You Pressed", "F1" & " Key", 1)
EndFunc;==>One

#Obfuscator_off
Func Two()
#Obfuscator_on
    MsgBox(0, "You Pressed", "F2" & " Key", 1)
EndFunc;==>Two

#Obfuscator_off
Func Three()
#Obfuscator_on
    MsgBox(0, "You Pressed", "F3" & " Key", 1)
EndFunc;==>Three

The Obfuscator Warnings will remain because it will never be able to figure out if the script is vald or not.

'

JdeB,

Thank you for the solution.

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...