Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/31/2013 in all areas

  1. As a one-liner: EDIT: removed Number() as it isn't useful. Local $s = "N01M67" & @CRLF & "N02M34" & @CRLF & "N03M02" & @CRLF & "N04M11" & @CRLF & "N05M0" & @CRLF & "N06M12" & @CRLF $t = Execute("'" & StringRegExpReplace($s, "(?m)(N\d+M\d+\R)N(\d+)(M0\R)", "$1N' & StringFormat('%04.1f', $2 - 0.9) & 'M47" & @CRLF & "N$2$3") & "'") ConsoleWrite($t)
    2 points
  2. It's a matter of specifying that you want only 1 replacement done: Func Add_M47() Local $ReadInput1 = GUICtrlRead($Input1) Local $sText = FileRead($ReadInput1) Local $sTextM47 = Execute("'" & StringRegExpReplace($sText, "(?m)(N\d+M\d+\R)N(\d+)(M0\R)", "$1N' & StringFormat('%04.1f', $2 - 0.9) & 'M47" & @CRLF & "N$2$3", 1) & "'") MsgBox(0, "Only first M47 added", $sTextM47) ; do whatever you want with the modified text EndFunc This code processes the text as a single block. It doesn't load lines into an array. ConsoleWrite only writes data to the Scite console for uncompiled scripts. This MsgBox should work better for you, provided your text is not too long to fit in the box.
    1 point
  3. Wombat, That was easier than I remembered. I hope this does the trick: #include <Array.au3> ; Simulate reading the file into an array $sText = "N01M67" & @CRLF & _ "N24M08" & @CRLF & _ "N24M0" & @CRLF & _ "N04M11" & @CRLF & _ "N05M0" & @CRLF & _ "N06M12" $aLines = StringSplit($sText, @CRLF, 1) _ArrayDisplay($aLines, "Original") For $i = UBound($aLines) - 1 To 1 Step -1 ; Loop upwards through the array to maintain the index values ; Read current line $sLine = $aLines[$i] ; Check for M0 at end of line If StringRegExp($sLine, "^.*M0$") Then ; Extract digits and subtract 0.9 $nDigits = Number(StringRegExpReplace($sLine, "^\D+(\d+)M0$", "$1")) - 0.9 ; Insert new line at current point and increase line count _ArrayInsert($aLines, $i, "N" & $nDigits & "M47") $aLines[0] += 1 ; Display amended array _ArrayDisplay($aLines, "Inserted") EndIf Next ; Final result _ArrayDisplay($aLines, "Final") For me that fires on the lines N24M0 and N05M0, but does not fire for N24M08. Good enough? M23
    1 point
  4. trancexx

    AutoIt v3.3.9.13 Beta

    Do you have AV running and which one if so? I had issues on one system when some version of Aut2Exe used %temp% directory for some PE temp files. I reported that to Jon and was under impression that he changed the location. I haven't had chance to test latest version on that particular comp but very likely I would have similar failure you do. ...But maybe it isn't related and it's really wrapper issue.
    1 point
  5. Jos

    AutoIt v3.3.9.13 Beta

    Are you using the latest Beta version available of Autoit3Wrapper? Add the following to AutoIt3Wrapper.ini in the AutoIt3Wrapper directory. [Other] TempDir=%USERPROFILE%
    1 point
  6. mlipok, As these checking tools only use relatively simple logic (apologies to Jos and the others, but you know what I mean ) the error is often not quite what it seems. In this case I have often found that such an error is generated in another call to that function - the reported error is actually telling you that earlier calls have used the corect syntax. It took me a few minutes to find and correct solve an error like that in one of my scripts the other day - that is why I am fairly sure that you have the same sort of problem. Can you post the whole script? I would be happy to look over it and see if I could spot where the problem lies. M23
    1 point
  7. Just says that the registry is preferred for all the reasons mentioned. Ini files are still the best option for portable applications. Registry isn't quite as simple as ini files either, there are a couple of extra bits you need to be aware of (like the x64 hives for example).
    1 point
  8. guinness

    [Solved]Number Split

    ConsoleWrite(_StringThousandSep('56868797689645') & @CRLF) ConsoleWrite(_StringThousandSep('1000') & @CRLF) Func _StringThousandSep($sString) ; By AZJIO - http://www.autoitscript.com/forum/topic/146585-stringformat-number-thousand-separator/?p=1037882 Return StringRegExpReplace($sString, '(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))', '\1,') EndFunc ;==>_StringThousandSep
    1 point
  9. you need to write example: cp and then press SPACE, it will expanded in: ClipPut()
    1 point
  10. i would do this: . Func Add_M47() Local $Find = "M0" Local $Replace = "WORKING SO FAR" $ReadInput1 = GUICtrlRead($Input1) $file=FileRead($ReadInput1) $file=StringReplace($file,$Find&@CRLF,$Replace&@CRLF) $open=FileOpen($ReadInput1,2) FileWrite($open,$file) FileClose($open) EndFunc E . Edit: this works for all "M0" at end of line. Edit: line breaks are also possible by only @cr or @lf, but mostly @crlf
    1 point
  11. It's worth noting that "C:" and "C:" are very different paths. "C:" returns the current working directory in the C drive where as "C:" is the root directory of the C drive. This is why *nix paths are so much easier with no namespaces.
    1 point
  12. FaridAgl

    AutoIt v3.3.9.13 Beta

    Incorrect, Actually the number 2 + 3 (5) will be converted to a string for the comparison. That's because of == operator: ==: Tests if two strings are equal. Case sensitive. The left and right values are converted to strings if they are not strings already. This operator should only be used for string comparisons that need to be case sensitive.
    1 point
  13. Look at abbreviations.Melba23 created an app in ScITEConfig to edit these.
    1 point
  14. Or for a simple maximization $hWnd = _IEPropertyGet($oIE, "hwnd") WinSetState($hWnd, "", @SW_MAXIMIZE)
    1 point
  15. _IEPropertySet($oIE, "theatermode", True)
    1 point
  16. I did up a page here on variables and functions and the so called memory usage of them. It focuses on the effect of copy-on-write. Try this test script and see if changes your view about ByRef usage.
    1 point
  17. ahahahahahah i'm a fucking dumbass. Thanks everybody, problem solved.
    1 point
  18. Or try this one: Case $arata_raport_1 $SQLCode_raport_tip1 = "SELECT `Sala` , SUM(cantitate) FROM `raspandire` WHERE `data` BETWEEN '"&GUICtrlRead($data_de_la)&"' AND '"&GUICtrlRead($data_pana_la)&"'AND `Tip`=1 GROUP BY `Sala`" $TableContents_tip1 = _Query($SQLInstance,$SQLCode_raport_tip1) Global $aResult[10001][4] = [[10000, 4]] Global $iIndex = 0 With $TableContents_tip1 While Not .EOF $aResult[$iIndex][0] = "SIMM" $aResult[$iIndex][1] = .Fields("Sala").value $aResult[$iIndex][2] = .Fields("SUM(cantitate)").value*2 $aResult[$iIndex][3] = GUICtrlRead($curs_valutar)*250 $iIndex = $iIndex + 1 .MoveNext WEnd EndWith If $iIndex > 0 then ReDim $aResult[$iIndex][4] Else $aResult = "" EndIf ; Rest of your queries go here If IsArray($bResult) Then _ArrayCombine($aResult, $bResult) If IsArray($cResult) Then _ArrayCombine($aResult, $cResult) If IsArray($dResult) Then _ArrayCombine($aResult, $dResult) If IsArray($eResult) Then _ArrayCombine($aResult, $eResult) _ArrayDisplay($aResult) What is still missing is what needs to be done if $aResult is empty.
    1 point
  19. What about getting the Class info for the window and using it as the first argument in your WinExists: WinExists("[Title:Error; Class:Program]", "") Check this reference out for more ways to match the window title. Once you have that working, the rest will be easy. Using the au3info tool and this reference, you should be able to solve it http://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm
    1 point
  20. Try using the WinExists function to check for the error window. You should be able to just send enter after that. You may possibly have to TAB, then enter. Also, you may find the info tool useful (Ctrl + F6 when using SciTE). http://www.autoitscript.com/autoit3/docs/intro/au3spy.htm
    1 point
  21. MHz

    Au3 API Updater

    Picture of a modified calltip in Scite Au3 API Updater This is the release of the Au3 API Updater version 2. Version 1 was released to public some years ago and it was very simple with just the "Check: Boolean, @error" type of stuff. Later, I decided of a new idea to implement a more expressive modification of the AutoIt inbuilt function calltips. The ini file method was limited in detail and not very readable for a human being. So I chose a csv method to do the storing of data needed. More information is added to the calltips which can be a concern as it takes more attention to read the detail of them. One advantage though is that it may help some people from referring to the help file too much. So a compromise had to be accepted though I did try to minimize wording as was possible. Scite allows the use of escape characters such as n t and some others in calltips though the interest in the others is not explored for this release. This is something that version 1 did not have access to. This opened up ideas to make better use of calltips with more then 2 lines. The n is for creating new lines while ntt is inserted inline for very long lines to create a wrap of text e.g. create new line, add 2 tabs and then continue with the line of text. I did choose to put a space after the last t as you may see that the t is not part of the word following it. It is important to have the property setting of calltip.*.use.escapes=1 in Scite. This allows for escaped n and other escaped characters in calltips. If you want to view and save the csv file in Scite then make sure you use the property setting strip.trailing.spaces=0 as Scite may have have it set to 1. The csv file is tab delimited and a setting of 1 will remove the tabs on the function name lines if saved. A spreadsheet program may help fix the formatting by importing it set as tab delimited with no quotes or other delimiter settings. Saving the csv with LibreOffice helps to correct them as I have tested. The script can also wrap long lines in the STD UDFs. Some inbuilt functions such as ControlCommand, which has many variations, is exempt from calltip modification except for wrapping long lines. The script does not check the function parameters to determine calltips to assign to them. You may notice in the script that I create a filter array. These filtered items are treated different compared to the other inbuilt functions. These filtered functions will keep the original descriptions. How to use Au3 API Updater Set calltip.*.use.escapes=1 in Scite. * Set strip.trailing.spaces=0 in Scite. * Extract zip file with folder structure to e.g. Desktop. Copy au3.api from @ProgramFilesDirAutoIt3Sciteapi into the folder on your Desktop. Run the script Au3_API_Updater.au3 in the Desktop folder and it may take as little as a second to finish the task. The au3.api will be modified with a backup made of the original set to .bak extension. The backup file allows you to rerun the scipt without the copy task needing to be repeated. You can then append the original in the api directory with a bak extension and then copy the modified au3.api file back into the api directory. Changing tabs in Scite or restarting Scite will load/reload the new calltips. * = User Options will be a reasonable place to add the Scite setting into. strip.trailing.spaces=0 is only needed if you edit and save the csv file in Scite. Download Au3 API Updater AutoIt 3.3.8.1 au3_api_updater.zip AutoIt 3.3.10.2 au3_api_updater.zip The requirement for using escaped characters in Scite calltips is version 3.04 or better. More can be found on the homepage that I setup for it here. A lua file for handling script directory calltips etc. can be found on the homepage. Cheers Edit Uploaded new zip file for use with AutoIt 3.3.10.2.
    1 point
  22. Valik

    12:00PM April 18 2012

    It is still attention.
    1 point
×
×
  • Create New...