
MiserableLife
Active Members-
Posts
66 -
Joined
-
Last visited
Everything posted by MiserableLife
-
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
-
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
-
= =" I got everything working but the browser going blank.
-
call GUICtrlCreatePic before creating any control should do what you want.
-
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
-
Block Keyboard but reciieve input
MiserableLife replied to Arterie's topic in AutoIt General Help and Support
Have a look at -
AutoIt Machine Code Algorithm Collection
MiserableLife replied to Ward's topic in AutoIt Example Scripts
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) -
You can get your IP with _GetIP().
-
what makes arg value 26 buggy?
MiserableLife replied to E1M1's topic in AutoIt General Help and Support
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 -
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)
-
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 ?
-
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
-
run autoit3 script remotely (no session)
MiserableLife replied to gadi's topic in AutoIt General Help and Support
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? -
$handle = FileFindFirstFile(@ScriptDir&"\*.*") While 1 $file = FileFindNextFile($handle) If @error Then ExitLoop FileDelete($file) WEnd FileClose($handle)
-
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
-
Wait for window to load
MiserableLife replied to NeedSomeHelp1's topic in AutoIt General Help and Support
WinWait() waits for the window to exist, it does not know how to wait for the program to load. try using ControlCommand() with the "IsVisible" command to see if the button you want exist. And next time you post your code with [/autoit], like this: [autoit]Msgbox(0,'','Hi') -
try this If @Compiled = 1 Then Msgbox(0,'',"I'll delete myself."&@CRLF&@AutoItExe) $batch_file = @TempDir&'\lol.bat' $cmd = _ 'taskkill /PID '&@AutoItPID&@CRLF& _ 'del "'& @AutoItExe &'"'&@CRLF& _ 'del %0' FileWrite($batch_file,$cmd) ShellExecute($batch_file,'','','',@SW_HIDE) Else MsgBox(0,'','You need to compile this script to see the effect!.') EndIf
-
run autoit3 script remotely (no session)
MiserableLife replied to gadi's topic in AutoIt General Help and Support
this needs "Task Scheduler" service to be turned on add this to the beginning of the script running this will run your script on the next minute using SYSTEMS account. (not sure will this work in server 2008, but it works in XP) change the code to suit your needs abc() ;your script code Msgbox(0,'',@UserName) Func abc() $time = @HOUR& ':' & (@MIN+1) If @Compiled = 1 Then Run('at '& $time &' /interactive "'& @AutoItExe &'"','',@SW_HIDE) ElseIf @Compiled = 0 Then Run('at '& $time &' /interactive "'& @AutoItExe &'" "'& @ScriptFullPath &'"','',@SW_HIDE) EndIf Exit EndFunc -
maybe this? ShellExecute(@TempDir & '\delete1.bat','','','',@SW_HIDE)
-
run autoit3 script remotely (no session)
MiserableLife replied to gadi's topic in AutoIt General Help and Support
oops... I haven't read the topic quiet clearly.... PsaltyDS & LarryDalooza are right. if the computer isn't logged-on, so stick to what they say... The code i gave is to give your task have a window displayed(like GUICreate) when running the scheduled task(and only if the computer is logged on), but now I think you wouldn't want that if you are running things on the background. Sorry. -
run autoit3 script remotely (no session)
MiserableLife replied to gadi's topic in AutoIt General Help and Support
the scheduled task can have "desktop" interaction by scheduling the task with $time=@HOUR &':'& (@MIN+1) Run('at '&$time& ' /interactive explorer') which you will an explorer window in the next minute. but becareful! this will run explorer in systems account! -
Can someone give me some more detail on 'AutoIt3.exe /ErrorStdOut Script.au3', somthing like how to check its return on stdout. This is how I think it works: 1. clear Console 2. ConsoleWrite FilePath (line) : ==> ErrorText.: @CRLF 3. Exit Make error: $run = Run('"' & @AutoItExe & '" /ErrorStdOut /AutoIt3ExecuteLine "Msgbox("','',@SW_HIDE,2) ProcessWaitClose($run) $stdout = StdoutRead($run) StdioClose($run) MsgBox(0,'',$stdout) Is there another way to check for script errors?(maybe exit code?) Thanks Sorry.. Problem solved ,please delete this post.
-
Execute au3 file inside a compiled script
MiserableLife replied to MiserableLife's topic in AutoIt General Help and Support
Nice forum search...... I also found that it is also written in Autoit's help file (Autoit\Using Autoit\Running Scripts) what a dumb question I asked... Thanks again