Jump to content

MiserableLife

Active Members
  • Posts

    66
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MiserableLife's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. even without ByRef, only $oObject will trigger the destructor Edit: updated code... #Include <AutoItObject.au3> _AutoItObject_StartUp() $oObject = _Autoitobject_Create() _Autoitobject_AddMethod( $oObject, "RunMe", "RunMe") _AutoItObject_AddDestructor($oObject, "Destructor") $oObject.RunMe() Sleep(1000) ConsoleWrite("== Sleep ==" & @CRLF) ;<== the destructor should run before this $oObject = 0 Func RunMe($oSelf) ConsoleWrite("runnung RunMe" & @CRLF) $oSelf = 0 ;<== didn't call the Destructor ;~ $oObject = 0 ;<== this works fine. EndFunc Func Destructor($oSelf) ConsoleWrite("runnung Destruct" & @CRLF) EndFunc
  2. an Ugly workaround.... (hide and show) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <IE.au3> $E_Browser = _IECreateEmbedded() $Home = "www.Google.com" $Main = "C:\Users\Owner\Pictures\Logitech Webcam\Picture 28.jpg" $Window = GUICreate("Web Browser", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $GUI_SS_DEFAULT_GUI + $WS_MAXIMIZEBOX) GUISetState() GUISetState(@SW_MAXIMIZE) $Height_Width = WinGetPos($Window) $Background = GUICtrlCreatePic($main, 0, 0, $Height_Width[2], $Height_Width[3], 0, $GUI_WS_EX_PARENTDRAG) ;~ GUICtrlSetState($Background, $GUI_DISABLE) $Browser = GUICtrlCreateObj($E_Browser, 10, 40, $Height_Width[2] - 40, $Height_Width[3] - 100) _IENavigate($E_Browser, $Home) $I_URL = GUICtrlCreateInput($Home, 250, 10, 200, 20) $B_Refresh = GUICtrlCreateButton("Refresh", 540, 10, 70, 20) $B_Go = GUICtrlCreateButton("Go", 460, 10, 70, 20, $BS_DEFPUSHBUTTON) $B_Forward = GUICtrlCreateButton("Forward", 170, 10, 70, 20) $B_Back = GUICtrlCreateButton ("Back", 90, 10, 70, 20) $B_Home = GUICtrlCreateButton ("Home", 10, 10, 70, 20) $B_Background = GUICtrlCreateButton ("Background", 630, 10, 70, 20) GUICtrlSetResizing($Browser, 1) GUICtrlSetResizing($Background, 1) While 1 Sleep(10) HotKeySet("{F5}", "_Refresh") $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_MAXIMIZE GUICtrlSetResizing($Browser, 1) GUICtrlSetResizing($Background, 1) Case $msg = $B_Go $URL = GUICtrlRead($I_URL) _IENavigate($E_Browser, $URL) Case $msg = $B_Home _IENavigate($E_Browser, $Home) Case $msg = $B_Refresh _IEAction($E_Browser, "Refresh") Case $msg = $B_Back _IEAction($E_Browser, "Back") Case $msg = $B_Forward _IEAction($E_Browser, "Forward") Case $msg = $B_Background $Picture = FileOpenDialog("Select a picture...", "C:\Users\Owner\Pictures\Logitech Webcam", "Images (*.jpg;*.bmp)", 1) If $Picture <> "" Then GUICtrlSetImage($Background, $picture) GUICtrlSetState($Browser, $GUI_HIDE) GUICtrlSetState($Browser, $GUI_SHOW) Else EndIf EndSelect WEnd Func _Refresh() _IEAction($E_Browser, "Refresh") EndFunc
  3. = =" I got everything working but the browser going blank.
  4. call GUICtrlCreatePic before creating any control should do what you want.
  5. Hi, I'm having a problem destructing an object, I am not sure if AutoItObj is suppose to do this. Please have a look. #Include <AutoItObject.au3> _AutoItObject_StartUp() $oObject = _Autoitobject_Create() _Autoitobject_AddMethod( $oObject, "RunMe", "RunMe") _AutoItObject_AddDestructor($oObject, "Destructor") $oObject.RunMe() ConsoleWrite("== Sleep ==" & @CRLF) Sleep(1000) $oObject = 0 Func RunMe(ByRef $oSelf) ConsoleWrite("runnung RunMe" & @CRLF) $oSelf = 0 ;<== didn't call the Destructor ;~ $oObject = 0 ;<== this works fine. ConsoleWrite("Is $oSelf = $oObject ?" & ($oSelf = $oObject) & @CRLF) ;<== what's their difference? EndFunc Func Destructor($oSelf) ConsoleWrite("runnung Destruct" & @CRLF) EndFunc
  6. WoW, a very good UDF. Thanks for sharing it. I have a problem. Is this the right way to compress the files in chunks? I can't decompress it... #Include "LZMA.au3" $Original_Filename = FileOpenDialog("Open File", "", "Any File (*.*)") If $Original_Filename = "" Then Exit $Compressed_Filename = FileSaveDialog("Save File", "", "Any File (*.*)") If $Compressed_Filename = "" Then Exit $BufferSize = 0x80000 ;8MB $FileSize = FileGetSize($Original_Filename) $hFile1 = FileOpen($Original_Filename, 16) $hFile2 = FileOpen($Compressed_Filename, 2 + 16) For $i = 1 To Ceiling($FileSize / $BufferSize) $Original_Data = FileRead($hFile1, $BufferSize) $Compressed_Data = _LZMA_Compress($Original_Data, 5) FileWrite($hFile2, $Compressed_Data) FileFlush($hFile2) Next FileClose($hFile1) FileClose($hFile2)
  7. You can get your IP with _GetIP().
  8. Does this help? Mod ( value1, value2 ) Return Value Success: Returns the remainder when value1 is divided by value2. Failure: Returns -1.#IND if the divisor is zero. If Mod( 26, 26) Then it = ( 26 / 26 = 1 + remains nothing ). So Mod(26,26) = 0 is correct ???? Then Chr(0 + 64) = @ ????? $s = "" $count = 0 $i = 321272407 ConsoleWrite('$i = ' & $i & @CRLF & @CRLF) Do $count += 1 ConsoleWrite('Loop ' & $count & @CRLF) If $i = 26 Then $mod = 26 Else $mod = Mod($i, 26) EndIf ConsoleWrite('Mod($i, 26) = ' & $mod & @CRLF) $ASCII = $mod + 64 ConsoleWrite('$mod + 64 = ' & $ASCII & @CRLF) $chr = Chr($ASCII) ConsoleWrite('Chr($ASCII) = ' & $chr & @CRLF) $s = $chr & $s ConsoleWrite('$chr & $s = ' & $s & @CRLF) $mod2 = Mod($i, 26) ConsoleWrite('Mod($i, 26) = ' & $mod & @CRLF) $number = Number($mod2 = 0) ConsoleWrite('Number($mod2 = 0) = ' & $number & @CRLF) $int = Int($i/26) ConsoleWrite('Int($i/26) = ' & $mod & @CRLF) $i = $int - $number ConsoleWrite('$int - $number = ' & $i & @CRLF) ConsoleWrite(@CRLF) Until $i = 0 ConsoleWrite('$s = ' & $s & @CRLF) ConsoleWrite( ToBase26(26) & @CRLF) Func ToBase26($i) Local $s = "" Do If $i = 26 Then $mod = 26 Else $mod = Mod($i, 26) EndIf $s = Chr($mod + 64) & $s $i = Int($i/26) - Number(Mod($i, 26) = 0) Until $i = 0 Return $s EndFunc ;==>ToBase26
  9. Got it. Thanks~ ConsoleWrite(0xB800 & @CRLF) ConsoleWrite('0xB800' & @CRLF) ConsoleWrite(Binary(0xB800) & @CRLF) ConsoleWrite(Binary('0xB800') & @CRLF) ConsoleWrite(BinaryLen(0xB800) & @CRLF) ConsoleWrite(BinaryLen('0xB800') & @CRLF)
  10. I wanted to ask my question, but I don't know how to express it. So I just did it even if it has a problem. How about this: What is the difference between 0x8B00 and "0x8B00" if there's no difference, then why BinaryLen(0x8B00) will return 4 and BinaryLen("0x8B00") returns 2 ?
  11. How come a binary number with quotes and without quotes has different binary length? Is it because it is stored in different datatypes inside AutoIt ? Thanks $bin0 = 0xB800 Msgbox(0,'',BinaryLen($bin0));BinaryLen = 4 $bin1 = "0xB800" Msgbox(0,'',BinaryLen($bin1));BinaryLen = 2
  12. Did I screw your server up? I'm very sorry if I did. that code I gave you is to run your script in Task Scheduler. at is the cmd command line version to add tasks to Task Scheduler.(type at /? in cmd for details) what is it that you are trying to do on the server?
  13. $handle = FileFindFirstFile(@ScriptDir&"\*.*") While 1 $file = FileFindNextFile($handle) If @error Then ExitLoop FileDelete($file) WEnd FileClose($handle)
  14. maybe these help? WinINet.au3 InternetSetOption Function _WinINet_InternetSetOption($hInternet, $iOption, $vBuffer) I think $vbuffer is $iOption(or the same length) Maybe $iOption = $INTERNET_OPTION_SECURITY_FLAGS $vBuffer = $SECURITY_FLAG_IGNORE_UNKNOWN_CA See :Option Flags ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WinINet_InternetSetOption ; Description ...: Sets an Internet option. ; Syntax ........: _WinINet_InternetSetOption($hInternet, $iOption, $vBuffer) ; Parameters ....: $hInternet - Handle on which to set information. ; $iOption - Internet option to be set. Can be one of the $INTERNET_OPTION_* options. ; $vBuffer - The option setting. ; Return values .: Success - True ; Failure - False, sets @error to 1 ; Author ........: Ultima ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: @@MsdnLink@@ InternetSetOption ; Example .......: ; =============================================================================================================================== Func _WinINet_InternetSetOption($hInternet, $iOption, $vBuffer) ; Set data/structures up Local $tBuffer, $iBuffer If IsBinary($vBuffer) Then $iBuffer = BinaryLen($vBuffer) $tBuffer = DllStructCreate("byte[" & $iBuffer & "]") Else $tBuffer = DllStructCreate($WIN32_TCHAR & "[" & (StringLen($vBuffer)+1) & "]") $iBuffer = DllStructGetSize($tBuffer) EndIf DllStructSetData($tBuffer, 1, $vBuffer) ; Make DLL call Local $avResult = DllCall($__WinINet_hDLL, _ "int", "InternetSetOption" & $WIN32_FTYPE, _ "ptr", $hInternet, _ "dword", $iOption, _ "ptr", DllStructGetPtr($tBuffer), _ "dword", $iBuffer _ ) ; Return response If @error Or Not $avResult[0] Then Return SetError(1, 0, False) Return True EndFunc ;==>_WinINet_InternetSetOption You can try a tool called WireShark to check your out going package from AutoIt
×
×
  • Create New...