Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/24/2013 in all areas

  1. May be some of you know the shareware VectorMagic who permit to easily convert bitmap Images to clean Vector Art ! Pic2Vector 1.0.1.4 is free, and can give similar effects ! I was interested by some effects added to a photo. I'm not using gdi for the vectorization, but 2 command line tools : Autotrace 0.27 with ILDA file support for converting bitmap to vector graphics Custom Version at : http://www.raycomposer.de/en/ressources/autotrace/ More general infos : http://autotrace.sourceforge.net/ GPL Ghostscript 9.07 use here for converting vector graphics to Jpeg. More infos : http://www.ghostscript.com/doc/9.07/Use.htm# example 1 example 2 example 3 example 4 example 5 example 6 example 7 example 8 Free to you to play with settings for see changes.(Infos with tooltip added to each type of setting) If UAC Enable, use right click, execute as Admin. Click on vectorized Pic for display it in fullscreen with Windows picture Viewer. You can save result to jpg, png, bmp or gif format. Changes Version 1.0.1.4 Settings can be saved by creating a profil. No more appcrash window for autotrace.exe. New buttons for display compatibility with xp. Externals files are embedded, no more downloads needed. Some minor improvements. Added new examples to topic. Tested with WinXp, Win7 and Win 8.1. previous downloads : 666 source and executable are available in the Download Section Hope you like it !
    3 points
  2. _ScreenCapture_Capture("c:\New folder\" & $picnum + 1 & ".jpg") Note the backslash after New Folder. If that doesn't work, put the whole path and filename inside quotes.
    1 point
  3. Here you go: #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> Global Const $pi = 3.14159265358979 HotKeySet("{ESC}", "_Bye") $iCircleR = 20; <=== Edit this for different circle radius (in pixels) $iCircleD = $iCircleR * 2 Global $radius = 0 ;radius of movement of the blob mouse cursor to centre of circle blob Global $angle = 4 Global $incr = 3 $pt = MouseGetPos() ;New Code $hGUI = GUICreate("") $hChild = GUICreate("", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TRANSPARENT)) _WinAPI_SetLayeredWindowAttributes($hChild, 0xFFFFFF, 125) GUISetBkColor(0xFFFF99) $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD) _SetWindowRgn($hChild, $a) GUISetState(@SW_SHOWNOACTIVATE, $hChild) While 1 Sleep(10) $pt = MouseGetPos() If Not @error Then MoveBlob($pt) _WinAPI_SetWindowPos($hChild, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOSENDCHANGING)) WEnd Func _CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2) Return $ret[0] EndFunc ;==>_CreateRoundRectRgn Func _CombineRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc ;==>_CombineRgn Func _SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc ;==>_SetWindowRgn Func _bye() Exit EndFunc ;==>_bye Func Setangle() $angle = Mod($angle + $incr, 360);degrees EndFunc ;==>Setangle Func MoveBlob($mousePos) $radAng = $angle * $pi / 180 Local $x = $mousepos[0] + $radius * Cos($radAng) - $iCircleR Local $y = $mousepos[1] + $radius * Sin($radAng) - $iCircleR WinMove($hChild, "", $x, $y) EndFunc ;==>MoveBlob I removed the controls, added the TRANSPARENT exstyle to the child GUI and the SetWindowPos function in the main while to keep the window on top in case you activate a top most window (it can be improved if you use a window hook to detect when a new window is activated). Br, FireFox.
    1 point
  4. kylomas

    generic array question

    SecretLanguage, In the future you should start a new topic rather than highjacking another's thread.
    1 point
  5. My crystal ball is in the repair shop, can you post your code until it is fixed?
    1 point
  6. 1 point
  7. MaGRauN, That is happening because you have lines in those files without "Netbios = " so there is no return. If you do not specify the correct starting parameters in your questions then the code you get is unlikely to work - something to remember in future. This runs correctly on the 3 files you posted: #include <Constants.au3> For $i = 1 To 3 ; Open the file $hFile = FileOpen("Possibility" & $i & ".log") ; Now loop through the file - much quicker to let Autoit do the counting for you While 1 ; Read the next line $sLine = FileReadLine($hFile) ; And exit the loop when we get to EOF If @error = -1 Then ExitLoop ; Extract the required text $aNetbios = StringRegExp($sLine, "(?i)Netbios name\s=\s(.*)," , 3) ; Check we have an array - ie there was a "Netbios = " in the line If IsArray($aNetBios) Then ; And now check Switch $aNetBios[0] Case "", "Unknown" ; Do nothing Case Else MsgBox($MB_SYSTEMMODAL, "Found NetBios", $aNetbios[0]) EndSwitch EndIf WEnd ; Close the file FileClose($hFile) ; And go around for the next one Next All clear now? M23
    1 point
  8. Ducks go quack and fish go blub and the seal goes ow ow ow... What does the fox say? - Ring-ding-ding-ding-dingeringeding!? Gering-ding-ding-ding-dingeringeding!?! Nope? You should try harder explaining what you want to do. Something that makes sense to you doesn't have to make sense to other people.
    1 point
  9. @Zch - It depends on how and where it is different. Window Title recognition has a few Modes, mentioned in the Help file. For instance, the default Mode, recognizes letters from the start of the name, so if the first five don't change, just use them ... or something like that. You can also get a Handle for the first Window Title, and any subsequent renaming of that window title won't cause an issue, as the Handle will remain the same. I've used that last (a single instance/many page changes) with FireFox quite successfully.
    1 point
  10. Here, let me then: #include <WinApi.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AddHookApi("user32.dll", "MessageBoxW", "Intercept_MessageBoxW", "int", "hwnd;wstr;wstr;uint") Func Intercept_MessageBoxW($hWnd, $sText, $sTitle, $iType) Local $aCall = DllCall("user32.dll", "int", "MessageBoxW", _ "hwnd", $hWnd, _ "wstr", $sText, _ "wstr", StringReplace($sTitle, "AutoIt", @ScriptName), _ "uint", $iType) If @error Or Not $aCall[0] Then Return 0 Return $aCall[0] EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Let's try it ; Usual message box MsgBox(0, 'Test', 'Some text') ; Cause error that would say some AutoIt shit happened, but now it wouldn't say "AutoIt" DllStructCreate("byte[123456789097]") ; The End ; The magic is down below Func AddHookApi($sModuleName, $vFunctionName, $vNewFunction, $sRet = "", $sParams = "") Local Static $pImportDirectory, $hInstance Local Const $IMAGE_DIRECTORY_ENTRY_IMPORT = 1 If Not $pImportDirectory Then $hInstance = _WinAPI_GetModuleHandle(0) $pImportDirectory = ImageDirectoryEntryToData($hInstance, $IMAGE_DIRECTORY_ENTRY_IMPORT) If @error Then Return SetError(1, 0, 0) EndIf Local $iIsInt = IsInt($vFunctionName) Local $iRestore = Not IsString($vNewFunction) Local $tIMAGE_IMPORT_MODULE_DIRECTORY Local $pDirectoryOffset = $pImportDirectory Local $tModuleName Local $iInitialOffset, $iInitialOffset2 Local $iOffset2 Local $tBufferOffset2, $iBufferOffset2 Local $tBuffer, $tFunctionOffset, $pOld, $fMatch, $pModuleName, $pFuncName Local Const $PAGE_READWRITE = 0x04 While 1 $tIMAGE_IMPORT_MODULE_DIRECTORY = DllStructCreate("dword RVAOriginalFirstThunk;" & _ "dword TimeDateStamp;" & _ "dword ForwarderChain;" & _ "dword RVAModuleName;" & _ "dword RVAFirstThunk", _ $pDirectoryOffset) If Not DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAFirstThunk") Then ExitLoop $pModuleName = $hInstance + DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAModuleName") $tModuleName = DllStructCreate("char Name[" & _WinAPI_StringLenA($pModuleName) & "]", $pModuleName) If DllStructGetData($tModuleName, "Name") = $sModuleName Then ; function from this module $iInitialOffset = $hInstance + DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAFirstThunk") $iInitialOffset2 = $hInstance + DllStructGetData($tIMAGE_IMPORT_MODULE_DIRECTORY, "RVAOriginalFirstThunk") If $iInitialOffset2 = $hInstance Then $iInitialOffset2 = $iInitialOffset $iOffset2 = 0 While 1 $tBufferOffset2 = DllStructCreate("dword_ptr", $iInitialOffset2 + $iOffset2) $iBufferOffset2 = DllStructGetData($tBufferOffset2, 1) If Not $iBufferOffset2 Then ExitLoop If $iIsInt Then If BitAND($iBufferOffset2, 0xFFFFFF) = $vFunctionName Then $fMatch = True; wanted function Else $pFuncName = $hInstance + $iBufferOffset2 + 2 ; 2 is size od "word", see line below... $tBuffer = DllStructCreate("word Ordinal; char Name[" & _WinAPI_StringLenA($pFuncName) & "]", $hInstance + $iBufferOffset2) If DllStructGetData($tBuffer, "Name") == $vFunctionName Then $fMatch = True; wanted function EndIf If $fMatch Then $tFunctionOffset = DllStructCreate("ptr", $iInitialOffset + $iOffset2) VirtualProtect(DllStructGetPtr($tFunctionOffset), DllStructGetSize($tFunctionOffset), $PAGE_READWRITE) If @error Then Return SetError(3, 0, 0) $pOld = DllStructGetData($tFunctionOffset, 1) If $iRestore Then DllStructSetData($tFunctionOffset, 1, $vNewFunction) Else DllStructSetData($tFunctionOffset, 1, DllCallbackGetPtr(DllCallbackRegister($vNewFunction, $sRet, $sParams))) EndIf Return $pOld EndIf $iOffset2 += DllStructGetSize($tBufferOffset2) WEnd ExitLoop EndIf $pDirectoryOffset += 20 ; size of $tIMAGE_IMPORT_MODULE_DIRECTORY WEnd Return SetError(4, 0, 0) EndFunc Func VirtualProtect($pAddress, $iSize, $iProtection) Local $aCall = DllCall("kernel32.dll", "bool", "VirtualProtect", "ptr", $pAddress, "dword_ptr", $iSize, "dword", $iProtection, "dword*", 0) If @error Or Not $aCall[0] Then Return SetError(1, 0, 0) Return 1 EndFunc Func ImageDirectoryEntryToData($hInstance, $iDirectoryEntry) ; Get pointer to data Local $pPointer = $hInstance ; Start processing passed binary data. 'Reading' PE format follows. Local $tIMAGE_DOS_HEADER = DllStructCreate("char Magic[2];" & _ "word BytesOnLastPage;" & _ "word Pages;" & _ "word Relocations;" & _ "word SizeofHeader;" & _ "word MinimumExtra;" & _ "word MaximumExtra;" & _ "word SS;" & _ "word SP;" & _ "word Checksum;" & _ "word IP;" & _ "word CS;" & _ "word Relocation;" & _ "word Overlay;" & _ "char Reserved[8];" & _ "word OEMIdentifier;" & _ "word OEMInformation;" & _ "char Reserved2[20];" & _ "dword AddressOfNewExeHeader", _ $pPointer) Local $sMagic = DllStructGetData($tIMAGE_DOS_HEADER, "Magic") ; Check if it's valid format If Not ($sMagic == "MZ") Then Return SetError(1, 0, 0) ; MS-DOS header missing. Btw 'MZ' are the initials of Mark Zbikowski in case you didn't know. ; Move pointer $pPointer += DllStructGetData($tIMAGE_DOS_HEADER, "AddressOfNewExeHeader") ; move to PE file header ; In place of IMAGE_NT_SIGNATURE structure Local $tIMAGE_NT_SIGNATURE = DllStructCreate("dword Signature", $pPointer) ; Check signature If DllStructGetData($tIMAGE_NT_SIGNATURE, "Signature") <> 17744 Then ; IMAGE_NT_SIGNATURE Return SetError(2, 0, 0) ; wrong signature. For PE image should be "PE\0\0" or 17744 dword. EndIf ; Move pointer $pPointer += 4 ; size of $tIMAGE_NT_SIGNATURE structure ; In place of IMAGE_FILE_HEADER structure ; Move pointer $pPointer += 20 ; size of $tIMAGE_FILE_HEADER structure ; Determine the type Local $tMagic = DllStructCreate("word Magic;", $pPointer) Local $iMagic = DllStructGetData($tMagic, 1) Local $tIMAGE_OPTIONAL_HEADER If $iMagic = 267 Then ; x86 version ; Move pointer $pPointer += 96 ; size of $tIMAGE_OPTIONAL_HEADER ElseIf $iMagic = 523 Then ; x64 version ; Move pointer $pPointer += 112 ; size of $tIMAGE_OPTIONAL_HEADER Else Return SetError(3, 0, 0) ; unsupported module type EndIf ; Validate input by checking available number of structures that are in the module Local Const $IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16 ; predefined value that PE modules always use (AutoIt certainly) If $iDirectoryEntry > $IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1 Then Return SetError(4, 0, 0) ; invalid input ; Calculate the offset to wanted entry (every entry is 8 bytes) $pPointer += 8 * $iDirectoryEntry ; At place of correst directory entry Local $tIMAGE_DIRECTORY_ENTRY = DllStructCreate("dword VirtualAddress; dword Size", $pPointer) ; Collect data Local $pAddress = DllStructGetData($tIMAGE_DIRECTORY_ENTRY, "VirtualAddress") If $pAddress = 0 Then Return SetError(5, 0, 0) ; invalid input ; $pAddress is RVA, add it to base address Return $hInstance + $pAddress EndFuncedit: because this is better than before.
    1 point
×
×
  • Create New...