ptrex Posted November 4, 2005 Share Posted November 4, 2005 Let' s say you make a script with all the availabel #includes in it. And a small GUI with a Control on it.When this is compiled, does AutoIT incorporate all the functions defined in the #Includes. Even if they are not called the script elsewhere ?If not, my question stops here. If yes. Then it gets interesting.When all the functions are incorporated, would it not be very interesting to be able to access (call) these functions. In a kind of special Function Control (and or syntax). Because then these functions would become dynamically.Let me try to give some example:Lets suppose that this Special function control is the Quote, and that in the script I have a $var = "1". I could define a dynamic function like this.$var &= 10Where the result would be "111". This is dynamically because I can change the string "10" in the control without having to change it hard coded and recompile it again.This is of course a very simplistic example. But it can be very interesting if this Special Function Control recognizes all the functions in the #includes.Maybe it doesn't not need to be a special control, but rather a special syntax like this,#StringMid( "string", 2, 3) #& "Just an example"Everything that starts with a # is recognised as function, instead of just normal text.Even better is when the outcome of this special control is stored in a variable, Like $Function = GUICtrlCreateFunctionIf that GUICtrlFunction contains something like : #Sqrt(2) + 1, $Function would be 2.4142135623731But you could change this dynamically in the GUI to #Sqrt(20) + 15 and use the $Funtion variable somewhere in the script.All the date, time, math, string, ... functions woud be available.Of course the example are symplistic, but it' s just to illustrate the concept.I' ll hear from you all wether this is day dreaming or realistic Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 of course you could do it by now as well you just have to know all the functions then you can programm your code around it while 1 if guigetmsg() = $button then if stringleft(guictrlread($input), 11) = "#stringleft" then $replace = stringreplace(guictrlread($input), "#stringleft(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringleft ($split[1], $split[2]) msgbox (0, "test", $function) endif endif wend should be possible, but needs loads of programming (by now) my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 wow this really works (just tried it) my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
ptrex Posted November 4, 2005 Author Share Posted November 4, 2005 @Nuffilein805 That' s just my point not do to all the programming. But just take advantage of everything what's already there. We only need a standard way of accessing it !! Nice example, not tested it yet ! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 well, you just need to do the programming once for each function about 5 lines should be possible to do this in about 1 or 2 days , but as i don't need it i'm not so foolish doing the job maybe i do 1 function a day, but that will take for ages till i'm finished we could do the programming in a group if someone needs it my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 while 1 if guigetmsg() = $button then select case stringleft(guictrlread($input), 11) = "#stringleft" $replace = stringreplace(guictrlread($input), "#stringleft(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringleft ($split[1], $split[2]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 12) = "#stringright" $replace = stringreplace(guictrlread($input), "#stringright(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringright ($split[1], $split[2]) msgbox (0, "test", $function) endselect endif wend added stringright my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 ok here is some more #include <guiconstants.au3> #include <string.au3> GUICreate("Main", 300, 200) $input = GUICtrlCreateInput ("", 10, 10, 200) $button = GUICtrlCreateButton ("BUtton", 10, 40) GUISetState() while 1 if guigetmsg() = $GUI_EVENT_CLOSE then Exit if guigetmsg() = $button then select case stringleft(guictrlread($input), 11) = "#stringleft" $replace = stringreplace(guictrlread($input), "#stringleft(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringleft ($split[1], $split[2]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 12) = "#stringright" $replace = stringreplace(guictrlread($input), "#stringright(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringright ($split[1], $split[2]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 14) = "#stringencrypt" $replace = stringreplace(guictrlread($input), "#stringencrypt(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = _stringencrypt ($split[1], $split[2], $split[3]) msgbox (0, "test", $function) endselect endif wend +_stringencrypt omg am i bored my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
ptrex Posted November 4, 2005 Author Share Posted November 4, 2005 @Nuffilein805 Thanks for the effort, but this is not the correct approach. Because specifying #include ... in the beginning of every script means that everything is INCLUDED. So no need to reprogram araound it. Only find a way to access it. Don' t work hard be smart is what goes here. The only thing is, is it technically possible to access it ? Not without the help of the developers, that's for sure. Because there is no function control that exists yet, or no syntax is available to recognize the included functions. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 hm, ok, but it's funny to write these little 5-liners one more expandcollapse popup#include <guiconstants.au3> #include <string.au3> GUICreate("Main", 300, 200) $input = GUICtrlCreateInput ("", 10, 10, 200) $button = GUICtrlCreateButton ("BUtton", 10, 40) GUISetState() while 1 if guigetmsg() = $GUI_EVENT_CLOSE then Exit if guigetmsg() = $button then select case stringleft(guictrlread($input), 11) = "#stringleft" $replace = stringreplace(guictrlread($input), "#stringleft(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringleft ($split[1], $split[2]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 12) = "#stringright" $replace = stringreplace(guictrlread($input), "#stringright(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = stringright ($split[1], $split[2]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 14) = "#stringencrypt" $replace = stringreplace(guictrlread($input), "#stringencrypt(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") if $split[0] = 3 then $function = _stringencrypt ($split[1], $split[2], $split[3]) if $split[0] = 4 then $function = _stringencrypt ($split[1], $split[2], $split[3], $split[4]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 10) = "#stringlen" $replace = stringreplace(guictrlread($input), "#stringlen(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = StringLen ($split[1]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 12) = "#stringlower" $replace = stringreplace(guictrlread($input), "#stringlower(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") $function = StringLower ($split[1]) msgbox (0, "test", $function) case stringleft(guictrlread($input), 10) = "#stringmid" $replace = stringreplace(guictrlread($input), "#stringmid(", "") $replace = stringreplace($replace, ")", "") $split = stringsplit($replace, ",") if $split[0] = 3 Then $function = StringMid ($split[1], $split[2], $split[3]) if $split[0] = 2 then $function = StringMid ($split[1], $split[2]) msgbox (0, "test", $function) endselect endif wend you gotta know all the functions and you're not allowed to use " but its a funny thing to do maybe i do all the functions 1 day my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
ptrex Posted November 4, 2005 Author Share Posted November 4, 2005 Thanks both for the attention. @Nuffilein805 Nice job so far. Maybe make a standard function of it. Then we can #include it. But this will be an include of an include I will follow this thread if something new comes up. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted November 4, 2005 Author Share Posted November 4, 2005 The example works only for 1 function, like #stringmid("testitagain,6,2) #& "test" Retuns "it" but it should read all the way down and return "ittest" Ofcourse I understand your Gui was just an example, and doesn't include all the functions yet. But I mean coding it like this might make it hard to proceed, when using combination of functions in 1 Control. Isn' t it ? Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Valik Posted November 4, 2005 Share Posted November 4, 2005 Am I missing something? Aren't you just making a poor implementation of the Execute() function? Link to comment Share on other sites More sharing options...
ptrex Posted November 4, 2005 Author Share Posted November 4, 2005 @Valik Hi. I looked in the helpfile for the function execute(). And indead it goes in that direction; But how do you see that in combination with a Gui control like shown in Nuffilein805 example ? Than again I could not read from the helpfile if the execute() understands all the math, date, time, .. functions and or combinations of it. But it sure goes in that direction, good noticing of you !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Valik Posted November 4, 2005 Share Posted November 4, 2005 First of all, the code as posted above is retarded. Calling GUIGetMsg() twice like that will cause messages to be lost. Call it once and store the return value, then do conditional checks on that value. If you do not believe me, open the GUI and then immediately press the close button. If it closes, congratulations, try again. I had to click it 3 times at one point because the message kept getting lost. Execute() is limited. You can talk to JP about why that is. However, it looks to me like using Execute() instead of the Case structure will work. The best way is to just play with the function. <rant> I do not condone the use of Execute(). Executing dynamic code, particularly from user input is a bad idea. "Dynamic Code" sounds cool on paper but it is almost always a sign of a poor idea or a poor solution to a problem. >/rant> Link to comment Share on other sites More sharing options...
ptrex Posted November 4, 2005 Author Share Posted November 4, 2005 @ValikI agree that the sample code provided isn' t working perfectly. But it's rather the concept what is important.I don' t agree with your last statementExecuting dynamic code, particularly from user input is a bad idea ...almost always a sign of a poor idea or a poor solution to a problemBecause this is what Excel is about. Excel is 1 container full of dynamic functions, like=CHAR(35) returns "#"I think that it opens more possibilties for creative usaged and less coding.There are a lot of applications and programming languages which support dynamic functions.I would say that all Excel users show a sign of poor ideas or solutions !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Valik Posted November 4, 2005 Share Posted November 4, 2005 Because this is what Excel is about. Excel is 1 container full of dynamic functions, like=CHAR(35) returns "#"The last time I checked, Excel wasn't a language. I see no relevance to Excel and the discussion of dynamically generated code.I think that it opens more possibilties for creative usaged and less coding.No, understanding the language you are using and how to use its conventional features open the door for creative usage and less coding. There are small, niche uses for functions like Execute(), however, those are few and far between. Execute() will be used incorrectly a significant number of times more than it will be used correctly because people are looking for what they perceive to be the cheap, easy solution instead of trying to find a more correct solution. Look at Call() for example. It allows for the execution of run-time determined user-defined functions. However, in its current incarnation, its about 99% useless but people are posting scripts using it (incorrectly) at least twice a month.There are a lot of applications and programming languages which support dynamic functions. Supporting them and having a genuine, legitimate use for them are two entirely different things. There are very few uses for dynamic code in a language as structured as AutoIt. Link to comment Share on other sites More sharing options...
ptrex Posted November 7, 2005 Author Share Posted November 7, 2005 @ValikI don' t think we are talking the same language here.I am not going to arm wrestle with you, about wether Excel is a language are not. It was not the point anyway.Here is a working example of what I meant.http://www.autoitscript.com/forum/index.php?showtopic=17728But I can't still agree why this is a bad idea or poor solution.Executing dynamic code, particularly from user input is a bad idea ...almost always a sign of a poor idea or a poor solution to a problemThanks anyjow to put me on the right track. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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