Jump to content

jameswaugh

Members
  • Posts

    6
  • Joined

  • Last visited

jameswaugh's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thankyou for that i will try it and look through the other post as i may have missed something that has been posted there.
  2. This is a greet little screen capture program. I was wondering if it is possible if someone could help me as i was wondering if it is possible instead of saving the file as the name clipboard it would change it would be possible to save it as the username,pcname,date and time. I have tried this but it didn't like it. I can get the File save as box to appear but it then stops. I am a newbie so please help as i have looked in the help file and i have managed to create the following line as the save as string (which i think is correct). $filename = @UserName & " on " & @ComputerName & " at " & @HOUR & "." & @MIN & "." & @SEC & " on " & @MON & "-" & @MDAY & "-" & @YEAR & ".jpg" I have posted the same question here http://www.autoitscript.com/forum/index.ph...f=2&t=31180 so if an administrator would like to either merge or link the topics that would be helpful
  3. As i said i did get this from the Autoit forum i will find where i got it and post link to it as i cant fully remember what i searched for the first time. got it from thisa forum so i will also ask in there http://www.autoitscript.com/forum/index.php?showtopic=29920
  4. Get Clipboard Func GetClipBoard(ByRef $pbuf) Local $hBitmap; Local $hMyDC Local $bmBitmap = DllStructCreate($tagBITMAP) If $DEBUG Then _FileWriteLog($LOG, "DllStructCreate Error>" & $StructError[@error] & @LF) Local $Me = DllCall("user32.dll", "hwnd", "GetDesktopWindow") If IsArray($Me) Then OpenClipboard($Me[0]) If (IsClipboardFormatAvailable($CF_BITMAP)) Then $hBitmap = GetClipboardData($CF_BITMAP) If ($hBitmap) Then GetObject($hBitmap, DllStructGetSize($bmBitmap), DllStructGetPtr($bmBitmap)) For $x = 1 To 7 ConsoleWrite("BMP>" & $x & ">" & DllStructGetData($bmBitmap, $x) & @LF) Next $hMyDC = GetDC(0) If ($hMyDC) Then Local $width = DllStructGetData($bmBitmap, 2) Local $height = DllStructGetData($bmBitmap, 3) Local $DIBHead = DllStructCreate($tagBITMAPINFOHEADER & ";" & $tagBITS) DllStructSetData($DIBHead, 1, 40) DllStructSetData($DIBHead, 2, $width) DllStructSetData($DIBHead, 3, $height) DllStructSetData($DIBHead, 4, 1) $bpp = DllStructGetData($bmBitmap, 6) If $bpp > 16 Then $bpp = 24 ConsoleWrite(">>$bbp>" & $bpp & @LF) DllStructSetData($DIBHead, 5, $bpp) Local $iBitmap = CreateDIBSection($hMyDC, $DIBHead, $DIB_RGB_COLORS, 0, 0, 0) Local $iSrc = CreateCompatibleDC(0) Local $hOldObj = SelectObject($iSrc, $hBitmap) Local $iDest = CreateCompatibleDC(0) Local $hNewObj = SelectObject($iDest, $iBitmap) if (DllStructGetData($DIBHead, 5) <= 8) Then ;take the DFB's palette and set it to our DIB ;not working with clipboard yet. Local $hPalette = GetCurrentObject($iSrc, $OBJ_PAL); if ($hPalette) Then Local $pal = DllStructCreate("byte[1024]") Local $nEntries = GetPaletteEntries($hPalette, 0, 256, DllStructGetPtr($pal)); if ($nEntries) Then If $DEBUG Then ConsoleWrite("$nEntries:" & $nEntries & @LF) For $x = 1 to ($nEntries * 4) Step 4 DllStructSetData($pal, 1, 0, $x) Next ConsoleWrite(SetDIBColorTable($iDest, 0, $nEntries * 4, DllStructGetPtr($pal)) & @LF) EndIf EndIf EndIf BitBlt($iDest, 0, 0, $width, $height, $iSrc, 0, 0, $SRCCOPY) $wide = DllStructGetData($DIBHead, 2) $tall = DllStructGetData($DIBHead, 3) Local $size = (((($wide * 32) + 31) / 32) * 4) * Abs($tall) DllStructSetData($DIBHead, 7, $size) ; $bmInfoHeader = DllStructCreate($tagBITMAPINFOHEADER, DllStructGetPtr($DIBHead, 1)) ConsoleWrite("byte[" & DllStructGetData($DIBHead, 7) & "]" & @LF) $pbuf = DllStructCreate("byte[" & DllStructGetData($DIBHead, 7) & "]") GetDIBits($iDest, $iBitmap, 0, $tall, DllStructGetPtr($pbuf), DllStructGetPtr($DIBHead), 0) Else If $DEBUG Then _FileWriteLog($LOG, "Error retrieving Bitmap" & @LF) EndIf ; Release struct. CloseClipboard() ReleaseDC(0, $iSrc) DeleteDC($iSrc) ReleaseDC(0, $iDest) DeleteDC($iDest) DeleteObject($hBitmap) $hBitmap = $iBitmap DeleteObject($hOldObj) DeleteObject($hNewObj) ReleaseDC(0, $hMyDC) DeleteDC($hMyDC) $bmBitmap = 0 $pal = 0 $DIBHead = 0 If $DEBUG Then _FileWriteLog($LOG, "Bitmap Retrieved" & @LF) Else If $DEBUG Then _FileWriteLog($LOG, "Error creating DC" & @LF) EndIf ;Return $iBitmap Return $hBitmap Else If $DEBUG Then _FileWriteLog($LOG, "No bitmap's in clipboard" & @LF) EndIf EndIf EndFunc ;==>GetClipBoard
  5. Preview Image is this Func PreviewImage(ByRef $byteStruct, $wid, $hgt) ; Local Const $DIB_RGB_COLORS = 0 ; Local Const $SRCCOPY = 0xCC0020 Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $preview = GUICreate("Preview", 500, 400, (@DesktopWidth - 500) / 2, (@DesktopHeight - 400) / 2) Local $pic = GUICtrlCreatePic("", 0, 0, $wid, $hgt) Local $pic_hWnd = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $preview, "int", $pic) $pic_hWnd = $pic_hWnd[0] GUISetState() Local $lpInfo = DllStructCreate($tagBITMAPINFOHEADER & ";" & $tagBITS) DllStructSetData($lpInfo, 1, 40) DllStructSetData($lpInfo, 2, $wid) DllStructSetData($lpInfo, 3, $hgt) DllStructSetData($lpInfo, 4, 1) DllStructSetData($lpInfo, 5, $bpp) Local $dc = GetDC($pic_hWnd) if ($dc) Then ConsoleWrite("Dc>" & $dc & @LF) Local $hBitmap = CreateCompatibleBitmap($dc, $wid, $hgt) If $hBitmap Then ConsoleWrite("$hBitmap>" & $hBitmap & @LF) Local $v_ret = SetDIBits($dc, $hBitmap, 0, $hgt, DllStructGetPtr($byteStruct), DllStructGetPtr($lpInfo), $DIB_RGB_COLORS) if ($v_ret) Then ConsoleWrite("$v_ret>" & $v_ret & @LF) Local $vret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $pic_hWnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "hwnd", $hBitmap) If $vret[0] Then ConsoleWrite("SendMessage>" & $v_ret[0] & @LF) EndIf EndIf Sleep(3000) GUIDelete($preview) ReleaseDC($pic_hWnd, $dc) EndIf $lpInfo = 0 EndFunc ;==>PreviewImage
  6. Hi This is my first request for help so please be nice, i have only just started using Autoit and i need to capture a screen shot and save it with the file neam of machine number , user, date and time on a network drive. I have used scripts that i have found on this forum and have got to the point where i press printscreen and it copies the screen to clipboard and previews it. This is where i get stuck as i can do a file save as but then that requires user input which is what i want to avoid. I know the text for the $filename is correct but i dont understand how to get it to put it as the file name and save it automatically. If that makes sense. Thanks in advance Func ContentHandler() Local $buffer Local $clipbmp = GetClipBoard($buffer) If $DEBUG Then _FileWriteLog($LOG, ";----------------------------------------------------------" & @LF) _FileWriteLog($LOG, "Begin Process: " & @error & @LF) EndIf If $DEBUG Then _FileWriteLog($LOG, "Getting Clipboard>" & @error & @LF) If $clipbmp Then If $DEBUG Then _FileWriteLog($LOG, "Captured Screen>" & @error & @LF) PreviewImage($buffer, $wide, $tall) FileSaveDialog ( "Save As" , "\\Wyjs_pdc\Flare\JWaugh" , "Images (*.jpg;*.bmp)") $filename = @UserName & " on " & @ComputerName & " at " & @HOUR & "." & @MIN & "." & @SEC & " on " & @MON & "-" & @MDAY & "-" & @YEAR & ".jpg" If $DEBUG Then _FileWriteLog($LOG, "Return Error Status: " & @error & @LF) EndIf If $DEBUG Then _FileWriteLog($LOG, "Exiting Now. Bye." & @LF) _FileWriteLog($LOG, ";----------------------------------------------------------" & @LF & @LF) EndIf DeleteObject($clipbmp) $buffer = 0 EndFunc ;==>ContentHandler
×
×
  • Create New...