Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/05/2016 in all areas

  1. @TheDcoder, Let me strongly disagree in turn: it isn't because a language syntax or writing system looks ugly to some people that it's inherently bad or that it can't be a good vehicle for powerful and subtle concepts (or programs). मानक हिन्दी looks like graffiti to most westerners, yet it's the 4th most used language on Earth as you surely know. APL looks terrible to non-APLists but it's unprecedently concise and powerful; APL is currently regaining interest (as APL2, A+ or J) in several domains. Perl makes a heavy use of regexps but has been the workhorse of the web and many other use cases, PHP without regexps is like a spider with no legs, and the list goes on. Almost all powerful generic languages offer SRE support and for a reason, else noone would bother wasting energy, time and money to include such support if it didn't have a significant usefulness. Your opinion seems based on your own laziness or unwillingness to approach SREs with a technically open mindframe.
    2 points
  2. mLipok

    ensure visible questions

    I do not know why your are using: _GUICtrlListView_SetItemDropHilited() I think you should read about: _GUICtrlListView_GetSelectedIndices() _GUICtrlListView_SetItemSelected() _GUICtrlListView_SetSelectionMark()
    1 point
  3. You should look into using _IEFormElementSetValue instead of changing the value directly. This will handle the event firing that is currently missing from your script.
    1 point
  4. @kcvinu Wow! That is awesome to know!
    1 point
  5. Thanks @kcvinu, Good to know some Malayalam words, will come in handy when I visit Kerala .
    1 point
  6. Oh its ok. So this is the Malayalam word word for Nee kosam. Nee kosam = നിനക്കായി Or നിനക്കു വേണ്ടി (Ninakkayi Or Ninakku vendi) Cheppu = Tell = പറയൂ (Parayu)
    1 point
  7. It means "For you". Sorry but I don't know any Malayalam words to share!
    1 point
  8. Malayalam for @kcvinu and Telugu for me .
    1 point
  9. Try this: #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <Array.au3> #include <Excel.au3> Local $sValueToFind = "lol" Local $sFileOpenDialog = FileOpenDialog("Please select the Excel file", "", "Excel (*.xlsx;*.xlsm;*.xlsb;*.xltx;*.xltm;*.xls;*.xlt;*.xml)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST)) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ConsoleWrite($sFileOpenDialog & @CRLF) ShellExecute($sFileOpenDialog, "", "", "open", @SW_MAXIMIZE) If @error Then Exit MsgBox(0, "ERROR", "Error in ShellExecute") Local $aExcelFileName = StringRegExp($sFileOpenDialog, '[^\\]*$', 1) If Not IsArray($aExcelFileName) Then Exit MsgBox(0, "ERROR", "Error in StringRegExp" & @CRLF & "@error: " & @error) If Not WinWait($aExcelFileName[0], "", 15) Then Exit MsgBox(0, "ERROR", "Error in WinWait") Sleep(3000) Local $oWorkbook = ObjGet($sFileOpenDialog) If @error Or Not IsObj($oWorkbook) Then Exit MsgBox($MB_SYSTEMMODAL, "ERROR", "Error in ObjGet") Local $aResult = __Excel_RangeFind($oWorkbook, $sValueToFind) If Not @error And IsArray($aResult) Then _ArrayDisplay($aResult, "Excel UDF: _Excel_RangeFind Example", "", 0, "|", "Sheet|Cell|Value|Formula") Exit Else Exit MsgBox(0, "Error", "The value/text (" & $sValueToFind & ") could not be found.") EndIf Func __Excel_RangeFind($oWorkbook, $sSearch, $vRange = Default, $iLookIn = Default, $iLookAt = Default, $bMatchcase = Default) If Not IsObj($oWorkbook) Or ObjName($oWorkbook, 1) <> "_Workbook" Then Return SetError(1, 0, 0) If StringStripWS($sSearch, 3) = "" Then Return SetError(2, 0, 0) If $iLookIn = Default Then $iLookIn = $xlValues If $iLookAt = Default Then $iLookAt = $xlPart If $bMatchcase = Default Then $bMatchcase = False Local $oMatch, $sFirst = "", $bSearchWorkbook = False, $oSheet If $vRange = Default Then $bSearchWorkbook = True $oSheet = $oWorkbook.Sheets(1) $vRange = $oSheet.UsedRange ElseIf IsString($vRange) Then $vRange = $oWorkbook.Activesheet.Range($vRange) If @error Then Return SetError(3, @error, 0) EndIf Local $aResult[100][4], $iIndex = 0, $iIndexSheets = 1, $iNumberOfSheets = $oWorkbook.Worksheets.Count While 1 $oMatch = $vRange.Find($sSearch, Default, $iLookIn, $iLookAt, Default, Default, $bMatchcase) If @error Then Return SetError(4, @error, 0) If IsObj($oMatch) Then $sFirst = $oMatch.Address While 1 $aResult[$iIndex][0] = $oMatch.Worksheet.Name $aResult[$iIndex][1] = $oMatch.Address $aResult[$iIndex][2] = $oMatch.Value $aResult[$iIndex][3] = $oMatch.Formula $iIndex = $iIndex + 1 If Mod($iIndex, 100) = 0 Then ReDim $aResult[UBound($aResult, 1) + 100][4] $oMatch = $vRange.Findnext($oMatch) If Not IsObj($oMatch) Or $sFirst = $oMatch.Address Then ExitLoop WEnd EndIf If Not $bSearchWorkbook Then ExitLoop $iIndexSheets = $iIndexSheets + 1 If $iIndexSheets > $iNumberOfSheets Then ExitLoop $sFirst = "" $oSheet = $oWorkbook.Sheets($iIndexSheets) If @error Then ExitLoop $vRange = $oSheet.UsedRange WEnd ReDim $aResult[$iIndex][4] Return $aResult EndFunc Exit
    1 point
  10. Use an array : Local $aTest = ["yılınız: 0", "yılınız: 1"] $testrand = $aTest[ Random(0, UBound($aTest) - 1 , 1) ] $year = StringRegExp($testrand, '\d+$', 1) If @error Then Exit MsgBox(16, "", "invalid string") MsgBox(0, "", $year[0])
    1 point
  11. TheDcoder, Wrong on both counts: Regexes are not easy (unless your brain is wired differently from the majority of coders), but can be super efficient. Using them is most certainly not "bad practice" of any form. As George always used to point out, the real difficulty with Regexes is learning when not to use them when a simpler solution will suffice. This case is one where a Regex is the sensible answer: ConsoleWrite(StringRegExpReplace("aaa\bbb\ccc", "(^.*\\)(.*)", "$1") & @CRLF) M23
    1 point
  12. Ah ok. Seems that the eyes doesn't benefit from Aspirin ... I edit the two solutions.
    1 point
  13. @dmob Easy to use, not easy to make!
    1 point
  14. One way: Local $sString = 'aaa\bbb\ccc' Local $iPos = StringInStr($sString, "\", 0, -1) - 1 Local $sNuString = StringMid($sString, 1, $iPos) ConsoleWrite("$sNuString: " & $sNuString & @CRLF) StringInStr has an option to search from the right. Sure the Regex gurus can whip a one-liner
    1 point
  15. No, the code is faster, but AssembleIt2 is slower...but only with this AutoIt-sourcecode! I detected a "bug"(!?) in AssembleIt2 yesterday with this code. It costs me some hours to find out how. One of my used RegEx-pattern to eliminate the comments out of the code runs in a socalled "catastrophic backtracking". If you write a semicolon ; at the end of the AutoIt-Script, the "catastrophic backtracking" of the RegEx will be prevented! This is one of the reasons to measure the clockticks within the asm-code...
    1 point
  16. Add a COM error handler to your script to get more detailed error information. Check ObjEvent in the help file to get an example.
    1 point
  17. $test0 = "yılınız: 0" $test1 = "yılınız: 1" $testrand = Random(0, 1 , 1) $testrand = eval("test" & $testrand) msgbox(0, "Target" , $testrand)
    1 point
  18. hi i have find multiple problem : - your usage of random seems bad. - StringRegExp return a array, so u need use $aYear[0] #include <Array.au3>; for _ArrayDisplay $sStart = "yılınız: " $iRandom = Random(1950, 2050, 1); return 1950-2050 integer $sString = $sStart & $iRandom ; Return "(.*?)" in a array $aYear = StringRegExp($sString, '(?i)z:\s(\d+)(.*?)', $STR_REGEXPARRAYGLOBALMATCH) If @error then Msgbox(0, "$iRandom=" & $iRandom, "Year not found") Else Msgbox(0, "$iRandom=" & $iRandom, "Year found : " & $aYear[0]) EndIf ;_ArrayDisplay($aYear); for help to understand
    1 point
  19. kcvinu

    Voice Recognition

    Hi, There is UDF which uses SAPI somewhere in this forum. Please search for that.
    1 point
  20. I quite often use raised eyebrows in my comments: ; ^^ . . . simply to draw attention to a particular line of code. I've got used to doing this now and anyone reading the code is likely to figure this out before long, or at least ponder the importance of an expression a little while longer.
    1 point
  21. This version is unknown, use actual stable.
    1 point
  22. BeginConnect is a method so you need to pass the parameters like this: $ConnectorObject.ConnectorFormat.BeginConnect($BeginObject.Name, 3)
    1 point
  23. Another idea, it's probably a bad one (do not hit me, please [:P] ): 1) Call a AutoIt compiled script (incAll.exe) before the compilation, using #AutoIt3Wrapper_Run_Before 2) IncAll.exe reads all AutoIt files in the Include directory, and put their content in an output file (includeAll.au3) - after removing all #Include lines 3) Include the generate file at the beginning of the script For example : IncAll.exe If Not $CmdLine[0] Then Exit MsgBox(16, "IncludeAll error", "Syntax error") _IncludeAll(@ScriptDir & "\" & $CmdLine[1]) If @error Then MsgBox(16, "IncludeAll error", "Unable to generate " & $sOuputFile) Func _IncludeAll($sOuputFile) FileDelete($sOuputFile) Local $sFilename, $sContent, $sConstants, $sFuncs Local $sIncludeDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\" & (@AutoItX64 ? "Wow6432Node\": "") & "AutoIt v3\AutoIt", "InstallDir") & "\include" If Not FileExists($sIncludeDir & "\*.au3") Then Return SetError(1, 0, 0) Local $hSearch = FileFindFirstFile( $sIncludeDir & "\*.au3") If $hSearch = -1 Then Return SetError(1, 0, 0) While 1 $sFilename = FileFindNextFile($hSearch) If @error Then ExitLoop $sContent = StringRegExpReplace( FileRead($sIncludeDir & "\" & $sFilename) , "(?i)(?:^|\R)\h*#Include.*", "") If StringInStr($sFileName, "Constants") Then $sConstants &= $sContent & @CRLF & @CRLF Else $sFuncs &= $sContent & @CRLF & @CRLF EndIf WEnd FileClose($hSearch) Local $hOutput = FileOpen($sOuputFile, 2) If $hOutput = -1 Then Return SetError(2, 0, 0) FileWrite($hOutput, "#Include-Once" & @CRLF & $sConstants & $sFuncs) FileClose($hOutput) Return 1 EndFunc theScript.au3 #AutoIt3Wrapper_Run_Before=incAll.exe includeAll.au3 #Include "includeAll.au3" ; your codeIt could work, but only for the native Includes in this state...
    1 point
  24. Basically don't have an entry point function, change the "compilation" from exe to a3x (can be done with Au3Wrapper directive) and include using #include with a3x extension. One thing I will say is if you use UDF functions in the a3x and then in your own code, it will of course return an error for redefining the same function twice.
    1 point
  25. Already a few times I was looking for a suitable description or tutorial to what you described here. I mean: How to create your own AutoIt "precompiled library" with a3x file. It is somewhere such a description ?
    1 point
  26. A3X Script Extract With newer versions of AutoIT (v3.3.10.0+), the compiled script is no longer appended to files as an overlay, and instead is embedded as a binary resource. This leads my previous AutoIt-script detection UDF lacking. However, since that UDF (>PE File Overlay Extraction) was targeted towards overlays in general, its still a worthwhile tool to have. This UDF on the other hand is pretty specific - it lets you detect and optionally extract A3X scripts from a compiled executable. The method is rather straightforward - it looks for a resource type of RT_RCDATA with a resource name of "SCRIPT", and then extracts the binary, testing for the A3X signature along the way. The main UDF has two functions: _FileContainsScriptResource() _FileContainsA3XScript() The first of these functions is there only for checking if a resource with "SCRIPT" exists. Its main purpose is to report on possible embedded scripts. I made this a separate function primarily because of issues with compressed executables. Tools like UPX and MPRESS can compress the resources as well as the rest of the executable, so any detection of the A3X signature will fail in those circumstances. (Note that UPX and MPRESS don't compress overlay data, which is why the older Overlay-Extraction A3X-detection worked regardless) The second function will both check for and optionally return the A3X script resource as binary. It also does a signature check for verification. Anyway, here's an example of its usage. The main UDF is attached below. #include <_FileContainsA3XScript.au3> ; ======================================================================================================== ; <A3XScriptExtract.au3> ; ; Example of detecting AutoIt Scripts embedded as binary resources (in AutoIt v3.3.10.0+ exe's), and ; extracting them to .A3X files. ; ; This script can be invoked in interactive or command-line mode. ; Passing an executable as a parameter will extract an A3X resource, writing it out to ; an A3X file with the same base name as the executable. ; ; Uses <_FileContainsA3XScript.au3> functions ; ; Author: Ascend4nt ; ======================================================================================================== ; ---------------------- MAIN CODE ------------------------------- Local $sFile, $sLastDir, $sLastFile, $binA3X, $iErr, $nA3XSize ; Command-line parameter received? Simply do a direct A3X extraction If $CmdLine[0] Then $sFile = $CmdLine[1] If Not FileExists($sFile) Then Exit 1 $binA3X = _FileContainsA3XScript($sFile, True) If @error Then Exit @error $nA3XSize = @extended Local $nExt = StringInStr($sFile, '.', 0, -1) If $nExt Then $sFile = StringLeft($sFile, $nExt - 1) EndIf $sFile &= '.a3x' Exit Not FileWrite($sFile, $binA3X) EndIf ; No command-line parameters, query the user in interactive mode $sLastDir = @ScriptDir While 1 $sFile=FileOpenDialog("Select PE File To Look for Embedded A3X scripts In",$sLastDir,"PE Files (*.exe;*.dll;*.scr)|All Files (*.*)",3,$sLastFile) If @error Or $sFile="" Then Exit $sLastFile = StringMid($sFile, StringInStr($sFile, '\', 1, -1) + 1) $sLastDir = StringLeft($sFile, StringInStr($sFile, '\', 1, -1) - 1) ; Resource 'Script' check $bScriptResourceFound = _FileContainsScriptResource($sFile) ConsoleWrite("_FileContainsScriptResource() return: " & $bScriptResourceFound & ", @error = " & @error & ", @extended = " & @extended & @CRLF) ; Actual A3X script resource check. True to return the A3X script as binary $binA3X = _FileContainsA3XScript($sFile, True) $iErr = @error $nA3XSize = @extended ; No A3X script found? If $iErr Or $nA3XSize = 0 Then ConsoleWrite("Failed Return from _FileContainsA3XScript(), @error = " & $iErr & ", @extended = " & $nA3XSize & @CRLF) MsgBox(64, "No AutoIt A3X script resource Found", "AutoIt A3X script resource not Found!" & @CRLF & _ ($bScriptResourceFound ? "However, *A* script resource was found" : "No 'Script' resource found either") & @CRLF & _ "for '" & $sLastFile & "'") ContinueLoop EndIf ConsoleWrite("_FileContainsA3XScript() return type: " & VarGetType($binA3X) & ", value = " & (IsBinary($binA3X) ? "[A3X_Binary]" : $binA3X) & @CRLF) ConsoleWrite(@TAB & "@error = " & $iErr & ", @extended = " & $nA3XSize & @CRLF) Local $hFileOut = -1, $sOutFile, $iMsgBox, $bSuccess = 0 $iMsgBox = MsgBox(35, "A3X script resource found in " & $sLastFile, "A3X script resource found. File size: " & FileGetSize($sLastFile) & _ ", A3X script size: " & $nA3XSize & @CRLF & @CRLF & _ "Would you like to Extract and save A3X file?") If $iMsgBox = 6 Then ;~ If $nA3XSize > 134217728 Then ;~ MsgBox(48, "A3X script is too huge", "A3X script size is > 128MB, skipping..") ;~ ContinueLoop ;~ EndIf $sOutFile = FileSaveDialog("A3X script - SAVE: Choose a file to write A3X script data to (from " & $sLastFile&")", _ $sLastDir, "AutoIt Compiled Sript (*.a3x)|All (*.*)", 2 + 16) If @error Then ContinueLoop ; Simple check for extension - if none, add .a3x If StringInStr($sOutFile, '.') = 0 Then $sOutFile &= ".a3x" ; Else $hFileOut = FileOpen($sOutFile, 16 + 2) If $hFileOut <> - 1 Then $bSuccess = FileWrite($hFileOut, $binA3X) FileClose($hFileOut) EndIf Else ContinueLoop EndIf If $bSuccess Then ShellExecute(StringLeft($sOutFile,StringInStr($sOutFile,'\',1,-1)-1)) Else MsgBox(64, "Error Opening or writing to file", "Error opening, reading, or saving A3X file") EndIf WEnd Exit _FileContainsA3XScript.au3 *edit: Modified example: Now alternatively accepts a command-line parameter for automated script extraction
    1 point
  27. See I like this, because I can now publish a "closed source" UDF and just have to worry about the documentation.
    1 point
  28. Actually, and not to knock you Melba, but I believe the A3X compiled format isn't documented in enough places, which can cause some to totally not understand it. Thats probably not exactly what aminfear meant, but I remember not knowing at first that A3X is both an option to use as a compile-to target and also the embedded resource type (or overlay, in previous versions) in an AutoIt executable.
    1 point
  29. Dont add too much security, that's often the mistake newly started and small companies make, look at the big guys like M$, Adobe, AutoDesk etc. etc., they could put way more security into their programs than they do, but they know that for every 1 million cracked copies, they get 10000 sales that they wouldnt have gotten if it wasnt cracked. The more your software spreads by piracy, the more people hear about it, and there are always those honest people that will pay for the software, something like 1% to 3%, but that's 1 to 3% more than you would have gotten if it wasnt cracked, and add to that the explosion in growth the more people hearing about it, and when it really spreads, those 1 to 3%, although not sounding like much, may equal several 1000% increase in your income. My suggestion, get completely rid of the online/web checking, leave your other security as you need to have some, just incase you need to drag someone to court later on when you have grown big, like if you dont lock your bike you get no insurance, no lock on software, no help in court. Ease up on the security /edit So what I was saying, why spend hours after hours, weeks after weeks, trying to secure your program, with the end result that nobody's gonna hear about it, so then you have to spend thousands on advertising to spread knowledge about your program, when you can just let the pirates do the advertising for your, and then spend all those hours improving your program so it get's even more interesting and spread more, plus save the thousands you would have spend on advertising. I mean, does the software cost you anything ? it's already made, it cost you nothing using the "copy" command in dos prompt
    1 point
×
×
  • Create New...