
erifash
Active Members-
Posts
502 -
Joined
-
Last visited
Everything posted by erifash
-
InetGet > Clipboard (no save)
erifash replied to twikkistep's topic in AutoIt General Help and Support
#include <INet.au3> $url = "http://www.google.com" ClipPut(_INetGetSource($url)) If I am not mistaken, that should work. -
Changed parts in order to avoid direct plagiarism? jk, lol
-
That looks very similar to an msdn article I was reading: Hmmm... Coincidence?
-
Here are some suggestions: Make the admin feature built into the client. If you log in with the username admin, it would prompt you for the password. Have the default IP on the client be @IPAddress1. This will make it easier to test locally. Try making your code more modular so parts can easily be modified without damaging functionality or creating bugs. Keep up the good work!
-
Just rename it to cold.com or whatever. Here's a script that will dump both cold.com and warm.com for you: ; dump cold.com $cold = BinaryString("0xB840008ED8C70672000000EA0000FFFF") FileWrite(@ScriptDir & "\cold.com", $cold) ; dump warm.com $warm = BinaryString("0xB840008ED8C70672003412EA0000FFFF") FileWrite(@ScriptDir & "\warm.com", $warm) EDIT: Doing a google search for "B8 40 00 8E D8 C7 06 72 00 00 00 EA 00 00 FF FF" (with quotes) yields a topic similar to this from 2005, meaning this does work.
-
The site said it was compiled using NASM. Does it matter?
-
Acting on a hunch, I have found this website containing some assembly code that could initiate a cold shutdown/boot. Particularly this snippet: ; store magic value at 0040h:0072h to reboot: ; 0000h - cold boot. ; 1234h - warm boot. MOV AX,0040h MOV DS,AX MOV word[0072h],0000h ; cold boot. JMP 0FFFFh:0000h; reboot!This renders a 16 byte executable that is detected by McAfee as a "Potentially Unwanted Program." I don't know if it works in Windows XP but it did in it's time (MS-DOS). Being unable (read: wary) to test this I leave it to you guys for now.
-
@theguy0000: it's down right now... I have stumbled upon the keywords "cold boot" which I have heard regarding this topic. I am currently researching this but all I have found are old FAQs.
-
Yup, I am quite aware of that, hehehehe... jk
-
I have actually written a small script to install that on our school computers, it's really fun to prank your friends with it. I have also contacted my friend and he can't find the qbasic code. I might be able to find it on wednesday when I go over to my dad's house as I have the majority of my backup storage over there. After doing a beast of a google search I have come up empty handed. I will continue searching but I am afraid only time will tell. EDIT: @Thatsgreat2345: I am unable to try out that program because I am running an AI simulation on breve.
-
Ah-ha! I just remembered that my friend had once shown me a one-line qbasic script that would do a cold shutdown. That was at least a year ago though, he might not have it... I'll ask him. Thanks!
-
I remember seeing some assembly code that would initiate a cold shutdown (the computer turns off almost instantly) and I was wondering if there was some way to do that? Too bad I can't seem to find it. If there is some way to do that in AutoIt that would be great!
-
How great is the interest in some extra Math UDF's?
erifash replied to JSThePatriot's topic in AutoIt Example Scripts
How about some trigonometric functions? [offtopic] What happened to the board? It looks... updated [/offtopic] -
Sorry to resurrect an old topic but I find this function very useful at times. Also, I have optimized the code for a significant speed improvement so it is worth checking out!
-
Convert mouse window X/Y to Diablo II world X/Y
erifash replied to Insolence's topic in AutoIt General Help and Support
In my sig: #include <Math.au3> $rad = _Radian(5) ; degrees to radians $deg = _Degree(3.14) ; radians to degrees -
Thanks for the reply but MHz's code above works perfectly for me. I actually made a little function with it: Func _INetGetMHT( $url, $file ) Local $msg = ObjCreate("CDO.Message"), $ado = ObjCreate("ADODB.Stream") If @error Then Return False With $ado .Type = 2 .Charset = "US-ASCII" .Open EndWith $msg.CreateMHTMLBody($url, 0) $msg.DataSource.SaveToObject($ado, "_Stream") FileDelete($file) $ado.SaveToFile($file, 1) $msg = "" $ado = "" Return True EndFunc Thanks for the help!
-
Wow, I can't wait to see how this turns out! AU3Chat was a good start for me but I don't think I was ready for that kind of project commitment. I guess it was a combination of laziness, school, and my affinity for sleep that put me behind. I'm just good at writing small scripts. Oh well. I'm very glad that others are being inspired by my work, though! Keep it up!
-
Here is my situation: I am given a string that might be a URL and may or may not be in proper format (ex: missing http://, uses backslashes, etc...). How might I go about putting it into the proper format? How would I then check if it is indeed a valid URL? I am now required to break up that same URL into four basic parts: protocol, domain, path, and file (if one exists). Examples of proper URL division: $url = "http://www.google.com" ; break up the url $protocol = "http" $domain = "www.google.com" $path = "/" $file = ""oÝ÷ Ù«¢+ØÀÌØíÕɰôÅÕ½ÐíÑÀè¼½½¼¹½´½Í½µ½±È½¹½Ñ¡È½¥±¹é¥ÀÅÕ½Ðì(ìɬÕÀÑ¡Õɰ(ÀÌØíÁɽѽ½°ôÅÕ½ÐíÑÀÅÕ½Ðì(ÀÌØí½µ¥¸ôÅÕ½Ðí½¼¹½´ÅÕ½Ðì(ÀÌØíÁÑ ôÅÕ½Ðì½Í½µ½±È½¹½Ñ¡ÈÅÕ½Ðì(ÀÌØí¥±ôÅÕ½Ðí¥±¹é¥ÀÅÕ½ÐIf anyone is good with regexp can you please help me with this? Thanks.
-
Convert mouse window X/Y to Diablo II world X/Y
erifash replied to Insolence's topic in AutoIt General Help and Support
I don't know about the isometric or API stuff (I would say use client coords) but this formula I wrote (from a previous topic) should put you on the right track: ; converts coords (x,y) in (a,b ) screen resolution ; to coords (u,v) in (c,d) screen resolution $x = 800 $y = 600 $a = 1024 $b = 768 $c = @DesktopWidth $d = @DesktopHeight $u = ( $c * $x ) / $a ;resulting x coord $v = ( $d * $y ) / $b ;resulting y coord MsgBox(0, "original(" & $x & "," & $y & ")", "new(" & $u & "," & $v & ")") EDIT: two posts went by when I was writing this! -
@lod3n: Thanks for that bit of information, it helped a lot. I wanted to do it in pure AutoIt so I discovered that "partial content" is already built into the HTTP protocol. I scripted a small tcp listener set to port 80 and used a download manager to try and download an imaginary "file" off my imaginary "server." Here is the header that it sent: I decided to give this header a test run so I wrote a script to start/resume a download of a large file (123 MB). Here it is: ; try to start (or resume) the download of ; http://61.74.68.173/GIS/Gunbound_GIS_WC_545.exe ; which is 123 MB in size so it should be good for testing $file = @ScriptDir & "\Gunbound_GIS_WC_545.exe" If FileExists($file) Then $bytes = FileGetSize($file) Else $bytes = 0 EndIf TCPStartup() $conn = TCPConnect("61.74.68.173", 80) If $conn = -1 or @error Then Exit $h = "GET /GIS/Gunbound_GIS_WC_545.exe HTTP/1.0" & @CRLF $h &= "Referer: http://61.74.68.173/GIS/Gunbound_GIS_WC_545.exe" & @CRLF $h &= "Range: bytes=" & $bytes & "-" & @CRLF $h &= "User-Agent: AutoIt3" & @CRLF $h &= "Host: " & @IPAddress1 & @CRLF $h &= "Pragma: no-cache" & @CRLF $h &= @CRLF TCPSend($conn, $h) $listen = TCPListen(@IPAddress1, 80) While 1 $sock = TCPAccept($listen) If $sock > -1 Then $data = "" While not @error FileWrite($file, $data) $data = TCPRecv($sock, 2048) WEnd TCPCloseSocket($sock) EndIf Sleep(50) WEnd ... and it doesn't work If anyone would care to try and help me fix this it would be great! EDIT: Nevermind, I figured it out.
-
DirCreate will not work for me when a file with the name of the directory already exists. Example code: FileWrite(@ScriptDir & "\bug", "") DirCreate(@ScriptDir & "\bug") Is this normal behavior or is something seriously wrong?
-
I got tired of all the other download managers I have found so I decided to write my own. I have the GUI completely done and a couple of other functions too. The only problem I am having is with incomplete downloads. I would like to be able to start a download on my thumb drive, pause the download, then complete it on a different computer. In other words, how can I handle incomplete downloads? Here is the GUI: #NoTrayIcon #include <GUIConstants.au3> #include <GUIListView.au3> Global Const $WM_NOTIFY = 0x004E Global Const $NM_DBLCLK = -3 Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1) _Exist("Download Manager") Global $oErr = ObjEvent("AutoIt.Error", "_ErrorHandler") $shell32 = @SystemDir & "\shell32.dll" $gui = GUICreate("Download Manager", 540, 160, Default, Default, $WS_OVERLAPPEDWINDOW) $start = GUICtrlCreateButton("Start", 0, 0, 20, 20, $BS_ICON) GUICtrlSetImage(-1, $shell32, 176, 0) GUICtrlSetTip(-1, "Start download") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent(-1, "_EventHandler") $pause = GUICtrlCreateButton("Pause", 20, 0, 20, 20, $BS_ICON) GUICtrlSetImage(-1, $shell32, 112, 0) GUICtrlSetTip(-1, "Pause download") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent(-1, "_EventHandler") $add = GUICtrlCreateButton("Add", 40, 0, 20, 20, $BS_ICON) GUICtrlSetImage(-1, $shell32, 155, 0) GUICtrlSetTip(-1, "Add new download") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent(-1, "_EventHandler") $remove = GUICtrlCreateButton("Remove", 60, 0, 20, 20, $BS_ICON) GUICtrlSetImage(-1, $shell32, 109, 0) GUICtrlSetTip(-1, "Remove selected download") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent(-1, "_EventHandler") $prefs = GUICtrlCreateButton("Preferences", 80, 0, 20, 20, $BS_ICON) GUICtrlSetImage(-1, $shell32, 126, 0) GUICtrlSetTip(-1, "Edit preferences") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent(-1, "_EventHandler") $progress = GUICtrlCreateProgress(100, 0, 440, 20) GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT + $GUI_DOCKLEFT + $GUI_DOCKRIGHT) $list = GUICtrlCreateListView("Name|Status|Remaining|Speed", 0, 20, 540, 120, $LVS_SHOWSELALWAYS, $LVS_EX_GRIDLINES) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) _GUICtrlListViewSetColumnWidth(-1, 0, 240) _GUICtrlListViewSetColumnWidth(-1, 1, 80) _GUICtrlListViewSetColumnWidth(-1, 2, 105) _GUICtrlListViewSetColumnWidth(-1, 3, 90) $status = GUICtrlCreateInput("0 downloading; 0 files; 0 KB/s total", 0, 140, 540, 20) GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM) GUISetOnEvent($GUI_EVENT_CLOSE, "_EventHandler", $gui) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") GUICtrlSetState($status, $GUI_DISABLE) GUICtrlSetState($list, $GUI_FOCUS) GUISetState() While 1 _ReduceMemory() Sleep(5000) WEnd Func WM_Notify_Events( $hWndGUI, $MsgID, $wParam, $lParam ) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $list Select Case $event = $NM_DBLCLK _ListEventHandler(_GUICtrlListViewGetItemText($list, _GUICtrlListViewGetSelectedIndices($list))) EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc Func _EventHandler() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $start MsgBox(0, "Event", GUICtrlRead(@GUI_CtrlId)) Case $pause MsgBox(0, "Event", GUICtrlRead(@GUI_CtrlId)) Case $add MsgBox(0, "Event", GUICtrlRead(@GUI_CtrlId)) Case $remove MsgBox(0, "Event", GUICtrlRead(@GUI_CtrlId)) Case $prefs MsgBox(0, "Event", GUICtrlRead(@GUI_CtrlId)) EndSwitch EndFunc Func _ListEventHandler( $text ) $text = StringSplit($text, "|") If @error or $text[1] = "" Then Return MsgBox(0, "Event", $text[1]) EndFunc Func _ErrorHandler() MsgBox(0x41030, "COM Error", "Intercepted COM Error :" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oErr.description & @CRLF & _ "err.windescription:" & @TAB & $oErr.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oErr.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oErr.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oErr.scriptline & @CRLF & _ "err.source is: " & @TAB & $oErr.source & @CRLF & _ "err.helpfile is: " & @TAB & $oErr.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oErr.helpcontext _ ) SetError(1) EndFunc Func _Exist( $str, $fatal = 1 ) Local $h = DllCall("kernel32.dll", "int", "CreateMutex", "int", 0, "long", 1, "str", StringReplace($str, "\", "..")), $l = DllCall("kernel32.dll", "int", "GetLastError") If $l[0] = 183 and $fatal Then Exit SetError($l[0]) Return $h[0] EndFunc Func _Error( $sText, $iFatal = 0, $sTitle = "Error", $iOpt = 0x41030 ) Local $ret = MsgBox($iOpt, $sTitle, $sText) If $iFatal Then Exit Return SetError(1, 0, $ret) EndFunc Func _ReduceMemory( $pid = -1, $psapi = "psapi.dll", $kernel32 = "kernel32.dll" ) If $pid = -1 Then Local $ret = DllCall($psapi, "int", "EmptyWorkingSet", "long", -1) Else Local $hwnd = DllCall($kernel32, "int", "OpenProcess", "int", 0x1F0FFF, "int", 0, "int", $pid) Local $ret = DllCall($psapi, "int", "EmptyWorkingSet", "long", $hwnd[0]) DllCall($kernel32, "int", "CloseHandle", "int", $hwnd[0]) EndIf Return $ret[0] EndFunc Func _ByteFormat( $bytes, $decimal = 0 ) Local $i = 0, $word[5] = [" B", " KB", " MB", " GB", " TB"] While $bytes < 1024 $bytes /= 1024 WEnd Return Round($bytes, $decimal) & $word[$i] EndFunc Thanks!
-
Is there some dllcall that IE uses to save a webpage in mht format? Thanks.
-
I have tried that method but it seems I am having the same problem as acideax above. Thus I have stopped working on it.
-
Just click the box as many times as you can in 15 seconds. Pretty addicting! Global Const $GUI_EVENT_CLOSE = -3 Global Const $GUI_ENABLE = 64 Global Const $GUI_DISABLE = 128 Global Const $WS_CAPTION = 0x00C00000 Global Const $WS_SYSMENU = 0x00080000 Opt("GUIOnEventMode", 1) Global $timer = 0, $points = 0, $box $gui = GUICreate("Click the Box", 400, 300, -1, -1, $WS_CAPTION + $WS_SYSMENU) $box = GUICtrlCreateLabel("", 192, 142, 13, 13) GUICtrlSetBkColor($box, 0x44DD44) GUISetBkColor(0x4488FF) GUICtrlSetOnEvent($box, "_EventHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "_EventHandler", $gui) GUISetState() While 1 Sleep(100) If not $timer Then ContinueLoop $diff = Round(15 - TimerDiff($timer) / 1000) WinSetTitle($gui, "", "Click the Box - " & $diff) If $diff <= 0 Then WinSetTitle($gui, "", "Click the Box") GUICtrlSetPos($box, 192, 142, 13, 13) GUICtrlSetState($box, $GUI_DISABLE) MsgBox(4096, "Score", $points) GUICtrlSetState($box, $GUI_ENABLE) $points = 0 $timer = 0 EndIf WEnd Func _EventHandler() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $box If not $timer Then $timer = TimerInit() GUICtrlSetPos($box, Random(10, 377), Random(10, 277), 13, 13) $points += 1 EndSwitch EndFunc My personal best is 21.