NeverGiveUp Posted November 10, 2010 Share Posted November 10, 2010 Using the resource UDF i am trying to use data for a function but i have seemed to fail. This is really important for me please help. Below is the way i was trying to do but i dont think you can use a variable for a funtion normally. #AutoIt3Wrapper_Res_File_Add=Text.txt, 10, data #include <resources.au3> $Text = _ResourceGetAsString("data") $Test Func $Test $Text EndFunc $Text conatains the function data Understand? Link to comment Share on other sites More sharing options...
enaiman Posted November 10, 2010 Share Posted November 10, 2010 Understand?No But what I can tell you:- function names never start with "$" ("Func $Test" is completely wrong - I could be "Func Test()") - "$" tells AutoIt that the following part is a variable (not a function)- having only a variable in the function content -> that function does absolutely nothing My advice - stay away from functions until you understand them better. Read more about functions, variables then try again (maybe do some tutorials...?) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
NeverGiveUp Posted November 10, 2010 Author Share Posted November 10, 2010 That was a typo What i mean is, for example $Text contained autoit code, how would i use this. Link to comment Share on other sites More sharing options...
enaiman Posted November 10, 2010 Share Posted November 10, 2010 "Execute" - see the help file. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
NeverGiveUp Posted November 10, 2010 Author Share Posted November 10, 2010 "Execute" - see the help file.Thanks man the help file is in fact something i have been using ever since.But there is a slight problem.$Text contains a function so execute wont work. Link to comment Share on other sites More sharing options...
NeverGiveUp Posted November 10, 2010 Author Share Posted November 10, 2010 (edited) I think the "Eval" function might work ill have a try. Gah i dont think there is any way for the actual contents of the function to be stored or used in anyway other than the normal way. Isnt there any genious that can solve my problem? Extract function from resource and store as variable > DONE Use this data for a function > FAIL ...? Edited November 10, 2010 by NeverGiveUp Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 10, 2010 Share Posted November 10, 2010 (edited) Functions are not dynamic that way, they must be defined at "compile-time" (before running). The nearest to what you want would be to put the extra stuff in includes and then rewrite and rerun the main-script. Edit: reworded first sentence. Edited November 10, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
NeverGiveUp Posted November 11, 2010 Author Share Posted November 11, 2010 Thanks. Although the whole point of me wanting to do this is because i have a small peice of code which is detected by 2 AV's. Dont ask what this code is although the point of this is to Encrypt/Hide this raw code which is a function and decrypt/unhide it at runtime. Any ideas? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 11, 2010 Share Posted November 11, 2010 The AV could just be looking at the text in the script, you could try encrypting parts of it. Like this: #Include <String.au3> Execute(_StringEncrypt(0, 'D90D4709198C6E79DD9AC97687635C3CDD577F135623E180EDD13BCB8DE13E08FAAF89FA2A96775F09317D1E8260DCC343D3E88C79F84E55F339295C2EB8195B28CA8C7A273063BC8539C21232B0C787259EBFAC6110320663BF1F83E4A8CF0E692194A7EFDE52347B8EC7FEBDA84756DCB70DBA284377F62BB6DD92D8B2272B92F8', 123)) I got that string from: #Include <String.au3> ConsoleWrite(_StringEncrypt(1, 'MsgBox(0, "Some title", "This text is not visible in the script")', 123) & @CRLF) Or read from an external file FileRead/IniRead .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
taietel Posted November 11, 2010 Share Posted November 11, 2010 This might be a way:#AutoIt3Wrapper_Res_File_Add=test.txt, rt_rcdata, txtdata #include "resources.au3" $string = _ResourceGetAsString("txtdata") $line=StringSplit($string,"|") $gui = GUICreate("I'm just an empty GUI",400,400) GUISetState(@SW_SHOW) MsgBox(0, "This is not from the resource", "We will execute the following simple functions from the resource test.txt:"&@CRLF&@CRLF&"1: "&$line[1]&@CRLF&"2: "&$line[2]&@CRLF&"3: "&$line[3]) _Test1() Sleep(200) _Test2() Sleep(200) _Test3() While 1 Sleep(10) Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd Func _Test1() Execute($line[1]) EndFunc Func _Test2() Execute($line[2]) EndFunc Func _Test3() Execute($line[3]) EndFuncPut this:Run("Notepad.exe")|GuiSetBkColor(0x990000)|MsgBox(0,"I am...","... From the resource!...") in test.txt, for testing.Compile the script after that. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now