UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post

Link to post

Share on other sites

DirtDBaK 0

DirtDBaK 0

If I don't understand how to use it then how will I be able to provide you an example...

Mabye if you read ALL of my post you would know what I want it to do

But heres the only thing I can come up with

$String = 'GuiCreate("Test",800,600,34,23)'
MsgBox(0,'',TestString($String))
$String = 'GuiCreate("Test",800,600)'
MsgBox(0,'',TestString($String))
Func TestString($STR);tests to see if the sting has a valid autoit script format for command GuiCreate
If $STR <> correct syntax ;NEED HELP TO DETERMINE THIS
Return 0
Else
Retrun an array with each parameter of the command
Endif
EndFunc

So \w+\[ simply means Find any word characters that appears up to and including an open [ bracket.

\w+\s would mean Find any word characters that appear up to and including any whitespace.

These are basic rudimentary examples and they serve only as tiny examples. And I'm sure there are better ways to check against a string, or rather better filters to use. Again, just giving you a rough idea of the syntax.

You simply combine the filtering, understand how the groups work together when combined, play around a little bit and you'll get the hang of it.

Share this post

Link to post

Share on other sites

SmOke_N 203

SmOke_N 203

You'd probably do better to see how the Au3Check does it (if it hasn't been re-written)... Anyway it was interesting all the same (If you are doing every function... though it will be tedious, I believe I came up with a simple way of controlling the good with the bad:

#include <array.au3>$String='GuiCreate("Test",800,600,34,23)'$aP=_ParamValidation($String)_ArrayDisplay($aP,"Parameters")Func_ParamValidation($sString);List of functions you are testingLocal$aIndex[2]=["","GUICreate"];Total ParamsLocal$aTotal[2]=["",8];Mandatory Params: n = MandatoryLocal$aMandatory[2]=["",1];Put number of mandatory params, put 0 if no mandatory;Seperate the function nameLocal$aFunc=StringRegExp($sString,"^\s*(\w+)\s*\(",1);If no function name, return error code 1IfIsArray($aFunc)=0ThenReturnSetError(1,0,"");Find our function and dimension number for $aTotal/$aMandatoryLocal$nDimension=0For$iCC=1ToUBound($aIndex)-1IfStringRegExp($sString,"(?i)^\s*"&$aIndex[$iCC]&"\s*\(")Then$nDimension=$iCCExitLoopEndIfNext;Put all parameters in a single string for parsing laterLocal$aParams=StringRegExp($sString,$aFunc[0]&"\s*\(\s*(.+?)\)",3);If the array failed, the function was written and passed wrong more than likely, return error code 2IfIsArray($aParams)=0ThenReturnSetError(2,0,"");Check if parameter is blank and if is allowed to be blank if it isIf$nDimension<>0And($aParams[0]=""Or$aParams[0]='""'Or$aParams[0]="''")Then;If the parameter is blank and not allowed to be, return error code 3If$aMandatory[$nDimension]ThenReturnSetError(3,0,"")EndIfLocal$aParamBreakDown=StringRegExp($aParams[0],'"(.*?)"\s*(?m:$|,)|\s*(.+?)\s*(?m:$|,)',3);Fill return array with parameters from param break downLocal$aReturnParams[(UBound($aParamBreakDown)/2)+2]For$iCC=0ToUBound($aParamBreakDown)-1Step2$aReturnParams[($iCC/2)+1]=$aParamBreakDown[$iCC]Next$aReturnParams[0]=UBound($aReturnParams)-1;If the total params are greater than the total allowed, then return error code 4 and extended number of paramsIf$aReturnParams[0]>$aTotal[$nDimension]ThenReturnSetError(4,$aReturnParams[0],"")Return$aReturnParamsEndFunc

You could get a lot more in depth with if the parameter should be a string/integer/float/long etc... but this is just proof of concept all the same.

In the future... since you know all the "string" functions other than RegExp, it would be much more efficient (since it seems people are having an issue with understanding what you are trying to do), to write the concept out in the functions you know and understand and maybe ask someone if they wouldn't mind converting it, rather than having some write the whole function themselves and them ask them to take their time and write comments so you can better understand what they did with the time they took for you.

Edit:

Had a message box in there I needed to remove.

Edited February 18, 2008 by SmOke_N

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.