22 posts in this topic
FileWriteLine error in expression
I am trying to do something a little whacky but here's the function that's kicking back an error.
I am fairly sure I am overlooking a simple error but I am not seeing it.
Func mouseSpot () Global $mouseSpot = MouseGetPos() ConsoleWrite ($mouseSpot & ", " & $mouseSpot & @CRLF) FileWriteLine ("mouseGrabs.txt" , "MouseClick ('"'primary'"' , $mouseSpot , $mouseSpot, 1, 10)" ) EndFunc The error displays as this
I'm getting the syntax error: "Statement cannot be just an expression."
Here's the piece of code where it occurs:
$Check = WinExists("MySQL Installer") If $Check <> "" Then WinClose("MySQL Installer") Else $Check = ControlGetHandle("", "&No", '[CLASS:Button; INSTANCE:2]') If $Check <> "" Then ControlClick("", "&No", '[CLASS:Button; INSTANCE:2]') Sleep(10000) WinClose("MySQL Installer") EndIf EndIf Anyone know why this error is occurring?
Write string between strings?
hey guys, anyone knows how to write a string between two other strings like for example:
To write AbzhdfX_d between ElseIf $sVideoLink1 = " and " then _IEAction ($oA, "click"),
Simpler: to write a between b and c ,but automatically
Just A Problem don't know how to name it^^
I currently a bit sad because i can't find anywhere in helpfiles and google away in autoit to check if a number between another number is the same as 4 variables which is checking if the main variable got the same princip of looking >.<.( I really can't explain it at all)
Case $Send2Box $ReadText2Box = GuictrlRead($Text2Box) _GUICtrlEdit_AppendText($Console, $ReadText2Box & @CRLF) If $ReadText2Box = '/ping ' & $ip1 & '.' & $ip2 & '.' & $ip3 & '.' & $ip4 Then $IP = StringRight('/ping ', 1) $Ping = Ping($IP) _GUICtrlEdit_AppendText($Console,'Ping is: ' & $Ping & 'ms') GUICtrlSetData($Text2Box,'') EndIf Next try to explain ^-^ i want to check if the text in the inputbox($Text2Box which is read from $ReadText2Box) the same looking like a ip but with a '/ping ' before and i don't know how to make the variables to check this.. and getting after it checked that it is truly a IP to ping it and send it to $Console to display the ms
I hope i could explained it anyway to understand it(if i write more i am getting more confused)
Thanks to everyone who try's to help me
Computing Padding Algorithm
For some obvious reason,
Sucessfully to translate an #computing padding algorithm,
and outputting same value with example of an explanation
Lets take a breath, wiki say:
The following formulas provide the number of padding bytes required to align the start of a data structure (where mod is the modulo operator):
# pseudo-code, see actual code below padding = (align - (offset mod align)) mod align new offset = offset + padding = offset + (align - (offset mod align)) mod align For example, the padding to add to offset 0x59d for a structure aligned to every 4 bytes is 3. The structure will then start at 0x5a0, which is a multiple of 4. Note that when offset already is a multiple of align, the second modulo in (align - (offset mod align)) mod align is required to get a padding of 0.
Then I write AutoIt3 script.
ConsoleWrite(@CR & '+ Computing padding' & @CR) Local $align, $offset, $padding, $new_offset $align = 4 $offset = 0x59d $padding = Mod($align - Mod($offset, $align), $align) $new_offset = $offset + $padding + Mod($offset + ($align - Mod($offset, $align)), $align) ConsoleWrite('padding: ' & $padding & ' new offset: 0x' & StringLower(Hex($new_offset, 4)) & @CR) And the output is match with example in explanation.
+ Computing padding padding: 3 new offset: 0x05a0 The question #01 are is that are correct translation? changing second line on second (=) (see below) with plus sign (+) in AutoIt3 (see above) ?
new offset = offset + padding = offset + (align - (offset mod align)) mod align .
Again lets take a breath, wiki say:
If the alignment is a power of two, the modulo operation can be reduced to a bitwise boolean AND operation. The following formulas provide the new offset (where & is a bitwise AND and ~ a bitwise NOT):
padding = align - (offset & (align - 1)) = (-offset) & (align - 1) new offset = (offset + align - 1) & ~(align - 1) Then I write AutoIt3 script.
ConsoleWrite(@CR & '+ align 2 - Power of Two' & @CR) Local $align, $offset, $padding, $new_offset $align = 2 $offset = 0x59d $padding = $align - (BitAND($offset, ($align - 1))) + BitAND((-$offset), ($align - 1)) $new_offset = BitAND(($offset + $align - 1), BitNOT($align - 1)) ConsoleWrite('padding: ' & $padding & ' new offset: 0x' & StringLower(Hex($new_offset, 4)) & @CR) And the output is.
+ align 2 - Power of Two padding: 2 new offset: 0x059e The question #02. First line and second (=) I replace with plus (+) sign, again is that correct?
The question #03.
What is meaning from the word of 'The Power of Two'?
Are 2 is The Power of Two?
Are 4, 8, 16 is The Power of Two?
Which are the number are is The Power of Two and which is not?
Can someone give me an confirmation if translation that pseudo-code to AutoIt3 are correct.?
Can someone give me an explanation what is so called 'The Power of Two'.?
Please answer even if you think this are childish question, because I'm not from Brittain nor from American.