Jump to content

Tvern

Active Members
  • Posts

    965
  • Joined

  • Last visited

About Tvern

  • Birthday 06/17/1985

Profile Information

  • Location
    Holland

Recent Profile Visitors

921 profile views

Tvern's Achievements

  1. The input pattern you give offers a few ways to solve this, but I doubt the obvious ones would work in other cases than the example you gave. To give any sensible advise we'd need to know what sort of input patterns to expect. Obviously the example has more numbers than the output pattern is resolves to. These are the things I would need to know: There are two numbers for nearly all numbers in the pattern, and three for one of them. *How many doubles can there be in the input pattern for each number in the output pattern? (or does it just get increasingly unlikely for each additional double?) *Does each number always occur twice at minimum? In your example 4.7 gets resolved to 4. making for a difference of 0.7. *how big can we realistically expect this number to be, before it makes sense to disqualify a match? I was writing an example, but ran out of time. Basically what I propose is that for each number in your chart, you iterate through the numbers in the input pattern. The first number in the input pattern should represent the first number in the chart pattern. The second number in the input pattern could represent the first, or second number in the chart pattern, so check which it is closest to. Once you have all the numbers in the Input pattern that represent the first number of the chart pattern, average them out and calculate the difference to the number you are comparing to. If this is bigger than a threshold value, you can disqualify the pattern and go to the next pattern on the chart, otherwise you continue to the next number in the chart pattern. Add the difference for the each number in the chart pattern together. This gives you a number that indicates your match quality. The lower the number the higher the quality. Like this you calculate the quality for each pattern on the chart. The pattern with the lowest number should be your match. You have to make a workaround for chart patterns with very few numbers as they will always have a high quality match, but like I said. I have no time any more.
  2. 1. In SciTe press Ctrl+1 (or Tools->SciTe Config) 2. Go to the "Color Settings" tab 3. Press "New Scheme" 4. Select "OldSciTE4AutoIt3 ==> Old Standard SciTE4AutoIt3 Color scheme" 5. Save+Apply That should give you the old look back.
  3. Hmm I didn't expect it to work right away to be honest. Glad you got it working. Do the Redims slow it down at all?
  4. Hmm I see I was pretty sloppy there with not declaring variables and using the wrong return value from _Sql_GetTable2D. If you want to keep an array that contains all elements of the treeview it's probably best to copy the content over to another array. (You can use a global array for this, or a local one and pass it ByRef) The problem with this approach is that ReDim is a slow function, so you don't want to add the items one by one and redim for each one. Another option could be to copy each version of $ahArray into another array, but putting arrays into arrays is frowned upon and with good reason, although they have their uses. I'm not sure how many tree nodes you will have, but this should reduce the amount of ReDims to once per parent node Hopefully that would give an acceptable result. It's getting a little hard to write these examples without testing them, so I hope it's not too far off. Global $aTreeViewItems[1][2] ;I'm using [0][0] and [0][1] to keep track of array size and last filled row. ;I should really set them to a known value for this, but as I know the value to be 0 at this point I'm not going to. Global $hTreeView = GUICtrlCreateTreeView(144, 55, 257, 106, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_CHECKBOXES)) _FillTree_Rec($hTreeView,7) Func _FillTree_Rec($hParent, $iFID) Local $ahArray, $gRows, $gColumns, $hItem Local $sSQL = "SELECT folder_id,folder_name FROM table_folder where folder_id_2 = " & $iFID & " AND folder_id <> 7;" Local $iRval = _Sql_GetTable2D($hDBHandle, $sSQL, $ahArray, $gRows, $gColumns) If $iRval Then Return $aTreeViewItems[0][0] += $gRows ;increase the row count with the number of returned rows. ReDim $aTreeViewItems[$aTreeViewItems[0][0]+1][2] ;resize the array. For $i = 1 To $gRows $aTreeViewItems[0][1] += 1 ;copy data to the first empty row. $aTreeViewItems[$aTreeViewItems[0][1]][0] = $ahArray[$i][0] $aTreeViewItems[$aTreeViewItems[0][1]][1] = $ahArray[$i][1] $hItem = GUICtrlCreateTreeViewItem($ahArray[$i][1], $hParent) ;You might want to store the handle in $aTreeViewItems here, just add a 3rd collumn if needed. _FillTree_Rec($hItem, $ahArray[$i][0]) Next EndFunc Since you seem to want to have all treeview items in one array, wouldn't it make more sense to read the entire array with a single Sql query, rather than merging multiple ones?
  5. You could do this with a recursive function. I assume your data will never have more than a dozen of levels, so recursion errors should not be a problem. Here is an example, but it's untested and you'll have to add the SQL stuff and GUI first: $hTreeView = GUICtrlCreateTreeView(144, 55, 257, 106, BitOR( $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_CHECKBOXES)) _FillTree_Rec($hTreeView) Func _FillTree_Rec($hParent, $iFID = 7) Local $sSQL="SELECT folder_id,folder_name FROM table_folder where folder_id_2 = " & $iFID & ";" ;query to select children of the passed folder ID Local $iRval= _Sql_GetTable2D($hDBHandle,$sSQL,$ahArray,$gRows,$gColumns) ;fetch to array ;it's probably best to check if any values are returned here and return from the function if not. (I wasn't sure if there is a return count in $iRval[0][0]) Local $hItem For $i = 1 To UBound($iRval) -1 $hItem=GUICtrlCreateTreeViewItem($iRval[$i][1], $hParent) ;create item for each child _FillTree_Rec($hItem, $iRval[$i][0]) ;run again with the last child as parent. Next EndFunc
  6. The method I described won't allow you to copy over the running exe, but you won't have to as it will be unlikely to need updates. If you still want to have an exe update itself you're going to need to have a helper process. (I recommend a .bat file, but another autoit exe would work as well) You don't need to close update.exe from the helper process, you can just call Exit after running the helper process. Make sure the helper process has a small delay build in, to allow update.exe to exit.
  7. I usually compile the main script and the updater as main.a3x and update.a3x, then have a main.exe which only executes those a3x files. (look at the helpfile for the command line interface to run a3x files using another script as interpreter) Because main.exe is very simple (between 2 and ~10 lines in total) it will only need updating when you update your autoit version. And you can update the a3x files while they are running, so update.a3x can update itself, then reboot after. The added benefit is that you will keep your updates really small as you are not downloading the interpreter each time.
  8. The logPrint function shouldn't cause trouble, still I'm even more sceptical of Sleep() being the culprit, seen as a huge amount of scripts call sleep 100 times per second and they're usually fine. I suspect there is some some sort of event constantly calling a function, but without more code it's impossible to tell. It'd help if you could post a working example that demonstrates the problem, or at least as much as you can as the code you posted doesn't give any clues. I will probably be unable to reply soon, but maybe someone else will get an idea. There are two things you can do to give a little more information on the problem: replace Sleep() with: $iTimer = TimerInit() Do Until TimerDiff($iTimer) > 1000 This will bump your CPU usage to 100% (for one logical core at least), so it's not meant as a solution, but it'll be interesting to see if it makes a difference. Go to the Tools menu in Scite4AutoIt and click "Trace: Add Func Trace Lines" in both your main script and any includes used. (Don't forget to save each one after you add the trace lines) Run the script and check the console when it becomes unresponsive.
  9. I'm a lot more suspicious about the logPrint function. Could you post it here, or show us where you got it?
  10. You can try logging in with an embedded IE and then download using _INetGetSource. I've had that work before. A better, but more complicated way would be to use the winhttp udf to do the whole thing. Edit: It's not so much that AutoIt has IE support, as that the IE COM interface allows (scripting)languages to use it.As far as I know FF and Chrome don't have this option, but there is a plugin for FF that will allow it to be automated. (not sure about Chrome, you'll have to search). The script will only work on computers that have both FireFox and the plugin installed, which means your script is unlikely to work on any PC but your own. The main reason why it makes sense to use IE is that every computer that can run AutoIt scripts should have IE installed.
  11. You're not making abot and I hope botters will realise that, but the experience is that they will use any reason why they would be allowed to break the rules. Anyways back to the topic. I think the problem with how you use 'my' example is the input. I'll try to demonstrate is with an example: $bBinary1 = Binary(0x00000001) $bBinary2 = Binary(0x00000002) ConsoleWrite($bBinary1 & @CRLF) ;this is probably not the input you want? ConsoleWrite($bBinary2 & @CRLF) $bReturn = _WinHttpBinaryConcat($bBinary1, $bBinary2) ConsoleWrite($bReturn & @CRLF) ;concat seems correct to me ConsoleWrite(IsBinary($bReturn) & @CRLF & @CRLF) ;return type seems correct to me $bBinary1 = Binary(0x01000000) $bBinary2 = Binary(0x02000000) ConsoleWrite($bBinary1 & @CRLF) ;this is probably the input you want? ConsoleWrite($bBinary2 & @CRLF) $bReturn = _WinHttpBinaryConcat($bBinary1, $bBinary2) ConsoleWrite($bReturn & @CRLF) ;concat seems correct to me ConsoleWrite(IsBinary($bReturn) & @CRLF) ;return type seems correct to me Func _WinHttpBinaryConcat(ByRef $bBinary1, ByRef $bBinary2) Switch IsBinary($bBinary1) + 2 * IsBinary($bBinary2) Case 0 Return SetError(1, 0, Binary('')) Case 1 Return $bBinary1 Case 2 Return $bBinary2 EndSwitch Local $tAuxiliary = DllStructCreate("byte[" & BinaryLen($bBinary1) & "];byte[" & BinaryLen($bBinary2) & "]") DllStructSetData($tAuxiliary, 1, $bBinary1) DllStructSetData($tAuxiliary, 2, $bBinary2) Local $tOutput = DllStructCreate("byte[" & DllStructGetSize($tAuxiliary) & "]", DllStructGetPtr($tAuxiliary)) Return DllStructGetData($tOutput, 1) EndFunc ;==>_WinHttpBinaryConcat It should work, You might want to make some speed comparisons with different methods though. I'd use whatever works for you as a place holder and put a review on your TODO list.
  12. This is from the winhttp UDF. Is that what you where looking for? ; #FUNCTION# ;=============================================================================== ; Name...........: _WinHttpBinaryConcat ; Description ...: Concatenates two binary data returned by _WinHttpReadData() in binary mode. ; Syntax.........: _WinHttpBinaryConcat(ByRef $bBinary1, ByRef $bBinary2) ; Parameters ....: $bBinary1 - Binary data that is to be concatenated. ; $bBinary2 - Binary data to concat. ; Return values .: Success - Returns concatenated binary data. ; Failure - Returns empty binary and sets @error: ; |1 - Invalid input. ; Author ........: ProgAndy ; Modified.......: trancexx ; Remarks .......: ; Related .......: _WinHttpReadData ; Link ..........: ; Example .......: ;============================================================================================ Func _WinHttpBinaryConcat(ByRef $bBinary1, ByRef $bBinary2) Switch IsBinary($bBinary1) + 2 * IsBinary($bBinary2) Case 0 Return SetError(1, 0, Binary('')) Case 1 Return $bBinary1 Case 2 Return $bBinary2 EndSwitch Local $tAuxiliary = DllStructCreate("byte[" & BinaryLen($bBinary1) & "];byte[" & BinaryLen($bBinary2) & "]") DllStructSetData($tAuxiliary, 1, $bBinary1) DllStructSetData($tAuxiliary, 2, $bBinary2) Local $tOutput = DllStructCreate("byte[" & DllStructGetSize($tAuxiliary) & "]", DllStructGetPtr($tAuxiliary)) Return DllStructGetData($tOutput, 1) EndFunc ;==>_WinHttpBinaryConcat @Valik You know you're going to have to explain game-botters why this thread is still open at least twice a day from now on right?
  13. Looks like it's base64 encoded. You should be able to find a decoder function when you search for base64.
  14. Let me ease your shame a bit with
  15. To change the master volume you can use these functions: Send("{VOLUME_MUTE}") Send("{VOLUME_DOWN}") Send("{VOLUME_UP}") To only change the volume of your script, use SoundSetWaveVolume()
×
×
  • Create New...