Jump to content

functions with parameters in OnEvent and HotKeys


martin
 Share

Recommended Posts

I haven't ever tried using Obfuscator untill now. I tried something which compiled ok but it doesn't run so I'm working on it.

The error I get is with Eval and not Call though. My first attempt at a fix stopped any errors but also seems to have stopped the script working.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I tried stopping the whole UDF from being obfuscated and added all the udf functions to a list of functions to ignore, added all the defined variable in the udf to a list of variables to ignore and replaced gobal constants in the udf with actual values.

It compiles fine but the exe doesn't work.

I don't want to spend any more time on this so I think you need to post a question in the obfuscator thread or in general help so that someone with more knowledge with obfuscator can help.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I added all of the functions in UDF to #Obfuscator_Ignore_Funcs but it doesn't work.

Thanks your time.

AutoIt really need this function native, it just hurts.

D4RKON,

I think the problem is the use of Eval and Call which translate string names to variable names. But the strings will be incorrect representations/copies of the variable names after obfuscating so I assume you would have to .ensure that all variables dealt with by these functions are not obscured.

If you turn obfuscator off for some section then you have to be sure that that section doesn't use any udf which has been obscured,doesn't use any global variables and so it goes on.

I spent some more time and still got nowhere; various 'succesful' compiles always produced programs which could only be killed using Task Manager.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 2 years later...

Hey, Martin!

I stumbled upon some problems using your UDF, while testing that example function

First one.    Setting hotkey works fine, but when it comes to removing - func works only a half way: it sweeps off that hotkey, but the key remains diasbled untill scropt is terminated.

SetOnEventA("e", "MyHK", $paramByVal, 34, $paramByRef, "$rrdd")

If $a > 100 Then SetOnEvent("e", "");remove hotkey

17.05. Update: By using standart autoit func HotkeySet("e") I was able to brush off previously set hotkey without consequences.

Second one.    As I understod, clcking on test1 it trey shoud show massedge box, but it just checks that option with no other effect.

TrayCreateItem("Test1")
TRaySetOnEventA(-1, "TrayIt1")

Func TrayIt1()
    MsgBox(262144, "Tray event", "ok")
EndFunc   ;==>TrayIt1

And the last one.   When $rrdd is local it dosn't pass the paramer

#AutoIt3Wrapper_Add_Constants=n
#include <GUIConstantsEx.au3>
#include "OnEventFunc.au3"; assuming the udf is in the script dir
HotkeySet("q", "Ter")
HotkeySet("w", "ffunc")

While 1
    Sleep(20)
 WEnd

 Func Ter()
    Exit
 EndFunc

Func Ffunc()
    Local $rrdd = 99
    SetOnEventA("e", "MyHK", $paramByVal, 34, $paramByRef, "$rrdd")
EndFunc

Func MyHK($p1, Byref $p2)
    SetOnEvent("e", "")
    ConsoleWrite('You have ' & $p1 & "and also " & $p2 &@lf)
    $p2 += 40
EndFunc   ;==>MyHK

The output I get is "You have 34and also". Am I missing something?

Maybe you could help me to sort out this issues, if you have time? Your help would be much appreciated :)

Edited by PsiLink
Link to comment
Share on other sites

  • 3 months later...

I'll look at these first 2 problems.

The last problem means you didn't read the first post of this thread. Read the section headed "Limitations".

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I've fixed those 2 problems.

I hadn't allowed for clearing a function for any gui or item.

I hadn't allowed for using SetOnEvent without using any parameters, even though I gave an example of doing that! Of course using SetInEvent without parameters means the UDF is not needed.

Thanks to PsiLink for pointing out these errors.

For the moment the latest version is attached but I will correct the link in post #1 in a few days.

onEventFunc.au3

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 year later...
On 8/30/2014 at 4:26 PM, martin said:

I've fixed those 2 problems.

I hadn't allowed for clearing a function for any gui or item.

I hadn't allowed for using SetOnEvent without using any parameters, even though I gave an example of doing that! Of course using SetInEvent without parameters means the UDF is not needed.

Thanks to PsiLink for pointing out these errors.

For the moment the latest version is attached but I will correct the link in post #1 in a few days.

onEventFunc.au3

Hi,

i'm very like your UDF, tks for sharing ^^

but i think we need a little change in your UDF

Line 144

For $n = 1 To $CtrlLib[0][0][0]
        If $CtrlLib[$n][1][0] = $iCtrl Then
            $item = $n;we are replacing previous settings
            ExitLoop
        EndIf
    Next

Change

If $CtrlLib[$n][1][0] = $iCtrl Then
; to
If $CtrlLib[$n][1][0] = $iCtrl And $iCtrl <> $GUI_EVENT_RESIZED And ....... Then

Because I think if I have many GUI, and I set event to all GUI not one ^^

Tks

p.s: sr for my eng :'(

Link to comment
Share on other sites

  • 8 months later...

You have a $ in front of the function name.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

You're asking people to solve a problem for you based on 4 lines of non-runnable code and an ambiguous "Not working!". Why don't you help us help you and post the entire script...

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...