Screenshot-Captura_Pantallas

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Screenshot-Captura_Pantallas

Post by Roberto Lopez »

And...

Once that you do the captures automatically at regular intervals, the next step is to upload them to a FTP server, or email them as attachments (one by one)...
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Screenshot-Captura_Pantallas

Post by mustafa »

Ok !!! Roberto
Saludos/Regars
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Screenshot-Captura_Pantallas

Post by mustafa »

Hola amigos:
A petición de la sugerencia del amigo Esgici de que pudiera
haber una opción de Captura automática
Haciendo pruebas se me ocurrió que con TIMER se podria mantener
unos Tiempos de Captura con COMBOBOX en la primera acción es por
defecto "0" No hay ninguna Captura y si estamos Capturando con las
otras opciones de Capture Time del COMBOBOX , tenemos que volver
a dejar por defecto la opción a "0"

La opción que indica el Maestro Roberto de subir a un servidor FTP,
o enviarlas por correo electrónico como archivos adjuntos (uno por uno) ...

Algún compañero se anima a continuar ?
Un Saludo a todos
*--------------------------------- Google ---------------------------------------------*
Hello friends:
At the request of a friend's suggestion he could Esgici
have an option of Automatic capture
By testing occurred to me that could be maintained TIMER
Capture few times with COMBOBOX in the first action is
default "0" No Capture and if we are capturing with
other options Capture Time the COMBOBOX , we must return
leave the default option to "0"

The option indicates the Master Roberto upload to an FTP server,
or send them by email as attachments (one by one) ...

A colleague is encouraged to continue?
Greetings to all

Mustafa :lol: :idea:
Attachments
Screenshot_Captura_Pantalla_New.zip
(256.9 KiB) Downloaded 325 times
Screenshot1.jpg
Screenshot1.jpg (44.41 KiB) Viewed 6116 times
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Screenshot-Captura_Pantallas

Post by esgici »

mustafa wrote: ...
A colleague is encouraged to continue?
...
Ok amigo;

please continue :arrow:

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Screenshot-Captura_Pantallas

Post by mustafa »

Hola amigo Esgici:
Master Roberto Lopez:
...
And ...

Once that you 'do the captures automatically at regular intervals, the next step is to upload them to a FTP server, or email them as attachments
(One by one) ...
...

yo No... yo No... :cry: :cry:
Dejo esta nueva etapa para quien tenga unos conocimientos más superiores , como vosotros los Maestros.

Saludos/Regards :lol:

*----------------------------------------------- Google -------------------------------------------*
Hello friend Esgici:
Master Roberto Lopez:
...
And ...

Once that you 'do the captures automatically at regular intervals, the next step is to upload them to a FTP server, or email them as attachments
(One by one) ...
...
I do not ... I do not ... :cry: :cry:
Leave this new stage for those who have a more superior knowledge, as you Masters.

Saludos/Regards :lol:
Mustafa
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Screenshot-Captura_Pantallas

Post by esgici »

mustafa wrote: ...
I do not ... I do not ... :cry: :cry:
Leave this new stage for those who have a more superior knowledge, as you Masters.
...
Hola amigo

You are right,

me too, I am not better than you :(

Saludos
Viva INTERNATIONAL HMG :D
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Screenshot-Captura_Pantallas

Post by Roberto Lopez »

Well...

Be careful, since I've modified certain BOS Taurus functions to use handles instead window names.

Maybe you must rename some of such functions.

Code: Select all

	<...>
		DEFINE TIMER Timer_1 ;
		INTERVAL 30000 ;
		ACTION CaptureSystem()
	<...>

Code: Select all

*------------------------------------------------------------------------------*
FUNCTION CaptureSystem()
*------------------------------------------------------------------------------*
LOCAL cFileName

	cBaseDir := ''

	dDate	:= DATE()

	cAnio	:= ALLTRIM( STR( YEAR( dDate ) ) )
	cMes 	:= ALLTRIM( STRZERO(MONTH( dDate ) , 2 ) )
	cDia	:= ALLTRIM( STRZERO(DAY  ( dDate ) , 2 ) )

	cTime	:= TIME()

	cHora	:= LEFT  ( cTime , 2 )	
	cMinutos	:= SUBSTR( cTime , 4 , 2 )
	cSegundos	:= RIGHT ( cTime , 2)

	cFileName := cBaseDir + cAnio + '-' + cMes + '-' + cDia + '-' + cHora + '-' + cMinutos + '-' + cSegundos 

		xSAVEWINDOWBYHANDLE ( BT_SCR_GETDESKTOPHANDLE() , cFileName + '.' + 'jpg' , 0 , 0 , 1366 , 768 )

		FTPUP(cFileName + '.jpg' )

		DELETE FILE (cFileName + '.jpg' )

RETURN NIL

Code: Select all

PROCEDURE FTPUP(cFileName)

	#pragma TEXTHIDDEN(1) 
	cNetServer := 'your server addres here'
	cServer   := cNetServer + ':your server port here'
	cUser     := "your username"
	cPassword := "your password"     
	#pragma TEXTHIDDEN(0) 

	cUrl      := "ftp://" + cUser + ":" + cPassword + "@" + cServer

	oUrl              := tUrl():New( cUrl )
	oFTP              := tIPClientFtp():New( oUrl, .F. )
	oFTP:nConnTimeout := 20000
	oFTP:bUsePasv     := .T.

	/* Comprobamos si el usuario contiene una @ para forzar el userid */
	IF At( "@", cUser ) > 0
		oFTP:oUrl:cServer   := cServer
		oFTP:oUrl:cUserID   := cUser
		oFTP:oUrl:cPassword := cPassword
	ENDIF

	IF oFTP:Open( cUrl )

		oFtp:UploadFile( cFileName )

		oFTP:Close()

	ELSE
	
		cStr := "No se ha podido conectar con el servidor FTP" + " " + oURL:cServer

		IF oFTP:SocketCon == NIL
			cStr += Chr( 13 ) + Chr( 10 ) + "Conexión no inicializada"
		ELSEIF hb_InetErrorCode( oFTP:SocketCon ) == 0
			cStr += Chr( 13 ) + Chr( 10 ) + "Respuesta del servidor:" + " " + oFTP:cReply
		ELSE
			cStr += Chr( 13 ) + Chr( 10 ) + "Error en la conexión:" + " " + hb_InetErrorDesc( oFTP:SocketCon )
		ENDIF

		*MSGSTOP(cStr)
		
	ENDIF

RETURN

Code: Select all

*------------------------------------------------------------------------------*
FUNCTION XSAVEWINDOWBYHANDLE ( nHandle , cFileName , nRow , nCol , nWidth , nHeight )
*------------------------------------------------------------------------------*
LOCAL hBitmap

   hBitmap := BT_BitmapCaptureClientArea ( nHandle , nRow, nCol, nWidth, nHeight)

   IF hBitmap <> 0

	IF	UPPER(RIGHT( cFileName , 4 ) ) == '.GIF'
	      BT_BitmapSaveFile (hBitmap, cFileName , BT_FILEFORMAT_GIF )
	ELSEIF	UPPER(RIGHT( cFileName , 4 ) ) == '.JPG'
	      BT_BitmapSaveFile (hBitmap, cFileName , BT_FILEFORMAT_JPG )
	ELSEIF	UPPER(RIGHT( cFileName , 4 ) ) == '.PNG'
	      BT_BitmapSaveFile (hBitmap, cFileName , BT_FILEFORMAT_PNG )
	ELSEIF	UPPER(RIGHT( cFileName , 4 ) ) == '.BMP'
	      BT_BitmapSaveFile (hBitmap, cFileName , BT_FILEFORMAT_BMP )
	ENDIF

	BT_BitmapRelease (hBitmap)

   ENDIF

RETURN hBitmap


Function BT_BitmapCaptureClientArea ( nHandle , Row, Col, Width, Height)
   LOCAL New_hBitmap
   LOCAL Max_Width  := BT_ClientAreaWidth( nHandle )
   LOCAL Max_Height := BT_ClientAreaHeight( nHandle )
   bt_FillRectIsNIL (@Row, @Col, @Width, @Height, 0, 0, Max_Width, Max_Height)   
   bt_AdjustWidthHeightRect (Row, Col, @Width, @Height, Max_Width, Max_Height)      
   New_hBitmap := BT_BMP_CAPTURESCR ( nHandle , Col, Row, Width, Height, BT_BITMAP_CAPTURE_DESKTOP)
Return New_hBitmap


Function BT_BitmapSaveFile (hBitmap, cFileName, nTypePicture)
   LOCAL lRet
   nTypePicture := IF (Valtype(nTypePicture) == "U", BT_FILEFORMAT_BMP, nTypePicture)
   lRet := BT_BMP_SAVEFILE (hBitmap, cFileName, nTypePicture)
Return lRet

Function BT_BitmapRelease (hBitmap)
   BT_BMP_RELEASE (hBitmap)
Return Nil

Function BT_ClientAreaWidth ( nHandle )
   LOCAL Width := BT_SCR_GETINFO ( nHandle , BT_SCR_CLIENTAREA, BT_SCR_INFO_WIDTH)   
Return Width

Function BT_ClientAreaHeight ( nHandle )
   LOCAL Height := BT_SCR_GETINFO ( nHandle , BT_SCR_CLIENTAREA, BT_SCR_INFO_HEIGHT)      
Return Height

Function bt_FillRectIsNIL (Row, Col, Width, Height, Row_value, Col_value, Width_value, Height_value)
   Row    := IF (Valtype(Row)    =="U",  Row_value,    Row)
   Col    := IF (Valtype(Col)    =="U",  Col_value,    Col)
   Width  := IF (Valtype(Width)  =="U",  Width_value,  Width)
   Height := IF (Valtype(Height) =="U",  Height_value, Height)   
Return Nil

Function bt_AdjustWidthHeightRect (Row, Col, Width, Height, Max_Width, Max_Height)
   Width  := IF ((Col + Width  > Max_Width),  (Max_Width  - Col), Width)
   Height := IF ((Row + Height > Max_Height), (Max_Height - Row), Height)
Return Nil

Function bt_WinHandle (Win)
   LOCAL hWnd := IF (ValType(Win)=="N", Win, GetFormHandle(Win))
Return hWnd

Happy Capturing!!!

Enjoy!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Screenshot-Captura_Pantallas

Post by esgici »

Roberto Lopez wrote:Well... wel... well...

Be careful, since I've modified certain BOS Taurus functions to use handles instead window names.

Maybe you must rename some of such functions.

...

Happy Capturing!!!

Enjoy!
Wow Maestro :o

This is wonderful ( as more than always ) ;)

You didn't left us a place to escape :(

Saludos cordiales;

Viva HMG and immortal HMG friendship :D
Viva INTERNATIONAL HMG :D
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Screenshot-Captura_Pantallas

Post by mustafa »

Hola amigo Esgici
Creo que el traductor Google no está traduciendo correctamente
Quiero decir que no tengo suficiente nivel programación ,para continuar.

Usted es el maestro y yo soy el estudiante
*-------------------------------------- Google -----------------------------------------*
Hello friend Esgici
I think the Google translator is not translating correctly
I mean I do not have enough level programming to continue.

You are the Teacher and I am the student
Saludos/Regards

Mustafa :)
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Screenshot-Captura_Pantallas

Post by mustafa »

Hola Maestro Roberto:
Muy Bien / Very Well
Gracias / Thank you
Saludos/Regards
Mustafa
Post Reply