Jump to content

Izebize

Active Members
  • Posts

    57
  • Joined

  • Last visited

Recent Profile Visitors

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

Izebize's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. Thanks for sharing! I recommend jennico's _Borders.au3 UDF for those, who don't want to use constant border size, or _WinAPI_GetSystemMetrics.
  2. Hi all! I wrote a simple downloader with a gui. #include <INet.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $hGUI_DL, $guiDL_CloseLabel, $guiDL_CurrentFile, $guiDL_CurrentLabel, $guiDL_MinimizeLabel, $guiDL_Progress, $guiDL_Size, $guiDL_Speed, $guiDL_Status Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 4) $hGUI = GUICreate("TEST", 100, 24) GUISetOnEvent(-3, "_Quit") GUISetOnEvent(-7, "_DragWindow") GUICtrlCreateButton(" OK ", 30, 0, 40) GUICtrlSetOnEvent(-1, "DOWNLOAD") GUISetState() While 1 Sleep(20) WEnd Func DOWNLOAD() $sURL = "http://www.hardwired.hu/bigdl/3/10/Batman_Arkham_Asylum_PC_muvi_gadgets.wmv" $hGUI_DL = GUICreate("Download", 400, 120, Default, Default, 0x80080000, Default, $hGUI) GUISetOnEvent(-3, "_Quit") GUISetOnEvent(-7, "_DragWindow") GUICtrlCreateLabel("Download", (400 - 72) / 2, 1, 72) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") $guiDL_CloseLabel = GUICtrlCreateLabel("r", 400 - 26, 0, 20, 20, 0x01) GUICtrlSetOnEvent(-1, "_Quit") GUICtrlSetFont(-1, 12, 600, 0, "Webdings") $guiDL_Size = GUICtrlCreateLabel("0.0/0.0 MB (0.0%)", 154, 30, 400 - 164, 20, 0x02) $guiDL_CurrentFile = GUICtrlCreateLabel("", 10, 50, 380, 20) $guiDL_Progress = GUICtrlCreateProgress(10, 70, 380, 20) $guiDL_Speed = GUICtrlCreateLabel("Speed: 0 kB/s", 290, 96, 100, 20, 0x02) $guiDL_Status = GUICtrlCreateLabel("Status: Waiting for link... (0 seconds remaining)", 10, 96, 280, 20) GUISetState() _SimpleDownloader($sURL, "C:\Downloads") GUIDelete($hGUI_DL) EndFunc ;==>DOWNLOAD #Region _Quit() Func _Quit() Exit EndFunc ;==>_Quit #EndRegion _Quit() Func _DragWindow() DllCall("user32.dll", "int", "SendMessage", "hWnd", WinGetHandle("[ACTIVE]"), "int", 0xA1, "int", 2, "int", 0) ;$WM_NCLBUTTONDOWN, $HTCAPTION EndFunc ;==>_DragWindow #Region _SimpleDownloader($sURL, $sDownloadDir) Func _SimpleDownloader($sURL, $sDownloadDir) If StringRight($sDownloadDir, 1) <> "\" Then $sDownloadDir &= "\" GUICtrlSetData($guiDL_Status, "Status: Downloading...") InetGet($sURL, $sDownloadDir & StringRegExpReplace($sURL, "http://.*/(.*)", "$1"), 0, 1) $iSize = InetGetSize($sURL) Local $iSpeed, $iLastSpeed While @InetGetActive $iSpeed = @InetGetBytesRead ;Download GUI Code ;ConsoleWrite(@HOUR&":"&@MIN&":"&@SEC&"."&@MSEC&" > "&$iSpeed&@CR) GUICtrlSetData($guiDL_Size, StringFormat("%.2f/%.2f MB (%.1f%%)", $iSpeed / 1024 / 1024, $iSize / 1024 / 1024, $iSpeed / $iSize * 100)) GUICtrlSetData($guiDL_Progress, $iSpeed / $iSize * 100) GUICtrlSetData($guiDL_Speed, "Speed: " & StringFormat("%.0f kB/s", ($iSpeed - $iLastSpeed) / 1024)) $iLastSpeed = $iSpeed Sleep(1000) WEnd EndFunc ;==>_SimpleDownloader #EndRegion _SimpleDownloader($sURL, $sDownloadDir) But if I click on the close button, or try to move the child gui (using onevent functions) it only reacts at the end of the download. I know the reason is because of the "While @InetGetActive" loop but I have no idea how to make it work within the loop. Any suggest?
  3. Hi all! I've got a script like this: #include <GDIPlus.au3> $hGUI = GUICreate("IMGTEST") GUISetState() _GDIPlus_Startup() InetGet("http://www.google.com/enterprise/images/star.jpg", @TempDir&"\izethumb.jpg") $hBitmap = _GDIPlus_BitmapCreateFromFile(@TempDir&"\izethumb.jpg") $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hBitmap) _WinAPI_DeleteObject($hBitmap) FileDelete(@TempDir&"\izethumb.jpg") _GDIPlus_Shutdown() Do Until GUIGetMsg() = -3 How can I make it work without saving the picture to the disk? I supposed to use _INetGetSource() but I have no idea, how to display it as an image.
  4. Look for DllCall in the help file or try this.
  5. It will return only the first window, because if you use Return statment then it exits from the function, and gives back the result wich is $list[1][0].
  6. Try this:#include <Array.au3> Local $aArray = PixelSearch(712, 465, 714, 467, 0x55574D) _ArrayDisplay($aArray)
  7. If you use the Window Info tool then you can just double click on Mouse/Color, and it will copy the value to the clipboard. I suggest the Freeze (Ctrl+Alt+F) mode, and use the "Finder Tool", it's much easier.
  8. How did you get that pixel color? Default PixelGetColor gives you a decimal integer, you have to convert it to a 6 digit hex integer, if you want to use it as a hex. Here's a sample: Local $PixelColor = PixelGetColor(10, 10) ConsoleWrite("Default pixel color: " & $PixelColor & @CR) ConsoleWrite("Hex based pixel color: " & Hex($PixelColor,6) & @CR) Local $aTemp = PixelSearch(1, 1, 20, 20, $PixelColor) ConsoleWrite("PixelSearch X coord: " & $aTemp[0] &@CR) ConsoleWrite("PixelSearch Y coord: " & $aTemp[1] &@CR)
  9. Thanks for your help! I used StringInStr as you suggested, but now I figured out how to make it work with RegExp: $fFile = "X:\Folder\Archive.part1.rar" ConsoleWrite(StringRegExpReplace($fFile, ".*\\(.*)(?:\.part1)\.rar", "$1") &@CR);Old one ConsoleWrite(StringRegExpReplace($fFile, ".*\\(.*?)(?:\.part1)?\.rar", "$1") &@CR);Working one"?" is very important in these cases.
  10. $fFile = "X:\Folder\Archive.part1.rar" ConsoleWrite(StringRegExpReplace($fFile, ".*\\(.*)(?:\.part1)\.rar", "$1")&@CR) ;Works fine ConsoleWrite(StringRegExpReplace($fFile, ".*\\(.*)(?:\.part1)?\.rar", "$1")&@CR);keeps "part1" I want to set the ".part1" section may or may not appear. I thought this is the correct syntax, but It doesn't works.
  11. Maybe this would help you: #Include <GuiListView.au3> _GUICtrlListView_Create($hGUICreate, "item", 0, 0, 150, 150, BitOR($LVS_REPORT,$LVS_SHOWSELALWAYS))
  12. Sounds good, thanks! I also tryin to do it with xml, but for this I have to learn it a bit.
  13. If you use InetGet with IE UDF then you should know that it doesn't copies the header, just creates a new one. Thats the reason why it throws the login page. I personally recommend the WinHTTP UDF, but it takes time till you work out your IE script to WinHTTP.
  14. Hi! I want to create a script to download programs from the internet via the given link to it. I've created a "directory structure file" to arrange files (links) into folders, so it would be more see through. The structure looks like this (filestruct.txt): DirectoryName .SubDirName ..FileName ...-link ...-mirror ..FileName ...-link DirectoryName2 .FileName ..-link .SubDirName ..FileName ...-link I jump through the lines with FileReadLine. I use StringRegExp, to determinate the type of the current line (dir,subdir,file,link). But I have no idea how can I store it in a dinamical array. If I want to store it in an array, then I need at least a 5D array. I afraid that if I would use ReDim for every line, after some it would be slower and slower, if I add more and more files to it. Anyone knows another method for this, or to keep it fast? Maybe an already existing method to store a structure like this? And here is a simple 5D array declaration error: Dim $a1[1][1][1][1] = [[[[1]]]] ;Good Dim $a2[1][1][1][1][1] = [[[[[1]]]]] ;syntax & wrong nesting error
×
×
  • Create New...