Capture d'une page HTML intégrée.
Règles du forum
- Merci de consulter la section "Règles du forum" et plus particulièrement "Règles et Mentions Légales du site autoitscript.fr" avant d'écrire un message.
-
- Status : Hors ligne
Capture d'une page HTML intégrée.
Bonjour à tous,
Je cherche désespérément comment capturer une page html que j'affiche dans mon programme AutoIT puis que se sauvegarde en png sans C:\Temp.
La page où s'affiche le HTML est codée comme ceci :
$Informations2 = GUICtrlCreateGroup("Prévisualisation Synthèse", 500, 50, 435, 750)
$GUIActiveX = GUICtrlCreateObj($oIE, 524, 70, 390, 710)
_IENavigate ($oIE, "http://mon_iste_a_afficher.fr/test.html")
Hélas, je ne trouve pas la fonction pour le faire hormis "_ScreenCapture_Capture" mais qui nécessite des coordonnées alors que moi, je veux toute la zone définie ci-dessus.
Merci beaucoup pour votre aide.
Bonne journée.
Yann
Je cherche désespérément comment capturer une page html que j'affiche dans mon programme AutoIT puis que se sauvegarde en png sans C:\Temp.
La page où s'affiche le HTML est codée comme ceci :
$Informations2 = GUICtrlCreateGroup("Prévisualisation Synthèse", 500, 50, 435, 750)
$GUIActiveX = GUICtrlCreateObj($oIE, 524, 70, 390, 710)
_IENavigate ($oIE, "http://mon_iste_a_afficher.fr/test.html")
Hélas, je ne trouve pas la fonction pour le faire hormis "_ScreenCapture_Capture" mais qui nécessite des coordonnées alors que moi, je veux toute la zone définie ci-dessus.
Merci beaucoup pour votre aide.
Bonne journée.
Yann
- mikell
- Spammer !
- Messages : 6292
- Enregistré le : dim. 29 mai 2011 17:32
- Localisation : Deep Cévennes
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
C'est possible. ça dépend de ce que tu veux capturer exactement : ce qui est visible de la page (affiché dans le controle) , ou l'intégralité de la page (y compris ce qui ne s'affiche pas dans le controle)
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Bonjour Mikell,
Uniquement ce qui s'affiche dans le contrôle.
Uniquement ce qui s'affiche dans le contrôle.
- mikell
- Spammer !
- Messages : 6292
- Enregistré le : dim. 29 mai 2011 17:32
- Localisation : Deep Cévennes
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Voilà un exemple
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
$gui = GUICreate("", 700, 450, -1, -1, -1, 0x80)
$oIE=ObjCreate("Shell.Explorer.2")
;$oIE = _IECreateEmbedded()
$gX = GUICtrlCreateObj($oIE, 50, 50, 600, 350)
GUISetState()
$oIE.Navigate("mk:@MSITStore:" & StringRegExpReplace(@Autoitexe, '(.+)\\[^\\]+', "$1") _
& "\AutoIt.chm::/html/libfunctions/_ScreenCapture_Capture.htm")
Sleep(100)
$pos = WinGetPos(ControlGetHandle($gui, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\capture.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
While GuiGetMsg()<>$GUI_EVENT_CLOSE
Sleep(10)
Wend
Exit
#include <ScreenCapture.au3>
$gui = GUICreate("", 700, 450, -1, -1, -1, 0x80)
$oIE=ObjCreate("Shell.Explorer.2")
;$oIE = _IECreateEmbedded()
$gX = GUICtrlCreateObj($oIE, 50, 50, 600, 350)
GUISetState()
$oIE.Navigate("mk:@MSITStore:" & StringRegExpReplace(@Autoitexe, '(.+)\\[^\\]+', "$1") _
& "\AutoIt.chm::/html/libfunctions/_ScreenCapture_Capture.htm")
Sleep(100)
$pos = WinGetPos(ControlGetHandle($gui, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\capture.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
While GuiGetMsg()<>$GUI_EVENT_CLOSE
Sleep(10)
Wend
Exit
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Merci beaucoup Mikell, je teste ça dans la journée et je te dis ce qu'il en est.
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
J'ai quand même en souci de débutant et j'en suis désolé.
J'utilise déjà un objet dans group comme je l'indique dans mon 1er post et j'arrive pas à mixer votre code avec le mien.
Je voudrais juste capturer ma "zone" Group ou Objet et pas ouvrir une nouvelle "fenêtre".
Voici ce que j'utilise :
J'utilise déjà un objet dans group comme je l'indique dans mon 1er post et j'arrive pas à mixer votre code avec le mien.
Je voudrais juste capturer ma "zone" Group ou Objet et pas ouvrir une nouvelle "fenêtre".
Voici ce que j'utilise :
$Informations2 = GUICtrlCreateGroup("Prévisualisation Synthèse", 500, 50, 435, 750)
$GUIActiveX = GUICtrlCreateObj($oIE, 524, 70, 390, 710)
- mikell
- Spammer !
- Messages : 6292
- Enregistré le : dim. 29 mai 2011 17:32
- Localisation : Deep Cévennes
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Mon exemple n'était qu'un exemple à adapter évidemment
Les 2 lignes importantes pour capturer l'objet IE présent dans la gui sont :
Si tu as du mal pour les intégrer, poste une version courte 'édulcorée' de ton code
Les 2 lignes importantes pour capturer l'objet IE présent dans la gui sont :
$pos = WinGetPos(ControlGetHandle($nom_de_la_gui, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\capture.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
_ScreenCapture_Capture(@scriptdir & "\capture.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
Si tu as du mal pour les intégrer, poste une version courte 'édulcorée' de ton code
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Voici le code sécurisé. Je voudrais capturer l'objet la ligne 70 :
Code : Tout sélectionner
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=xxxxxx.ico
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: Yann
Date: 30/05/2017
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <file.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <StaticConstants.au3>
#include <ScreenCapture.au3>
#include <OutlookEx.au3>
#include <GDIPlus.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <ScreenCapture.au3>
;Variable --> A MODIFIER !----------------------------------------------------
$username = "xxxxx"
$password = "xxxxxxxxx"
; ----------------------------------------------------------------------------
$oIE = _IECreateEmbedded ()
#Region ### START Koda GUI section ### Form=c:\users\david\desktop\formulaire.kxf
$Form1_1 = GUICreate("Service Prod/Exploit (C) YLB-MRN 06/2017", 950, 850, 185, 101)
$Label1 = GUICtrlCreateLabel("Synthèse de production v2.0", 10, 8, 433, 33)
GUICtrlSetFont(-1, 24, 400, 0, "Arial")
$Informations = GUICtrlCreateGroup(" Homme de prod Etat", 8, 50, 485, 201)
$Service = GUICtrlCreateCombo("", 24, 70, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Yann|Eric|Jérémy")
$Etat = GUICtrlCreateCombo("", 205, 70, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Etat, "Verte|Rouge", "Verte")
if GUICtrlRead($Etat) = "Rouge" then
$couleur = "red"
else
$couleur = "green"
endif
GUISetState(@SW_SHOW)
GUICtrlSetFont(-1, 10, 100, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$commentaires = GUICtrlCreateEdit("", 24, 100, 317, 81,$ES_AUTOVSCROLL)
GUICtrlSetData(-1, "Pour un retour à la ligne <br>")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nagvis = GUICtrlCreateButton("1 - Nagvis", 370, 85, 105, 33)
$Capturer = GUICtrlCreateButton("2 - Capturer", 370, 120, 105, 33)
$Envoyer = GUICtrlCreateButton("3 - Envoyer", 370, 155, 105, 33)
$Documentation = GUICtrlCreateButton("4 - Documentation", 370, 190, 105, 33)
$GUI_Button_home = GUICtrlCreateButton("Rafraichir ->", 370, 355, 100, 30)
GUISetState(@SW_SHOW)
$Informations2 = GUICtrlCreateGroup("Prévisualisation Synthèse", 500, 50, 435, 750)
$GUIActiveX = GUICtrlCreateObj($oIE, 524, 70, 390, 710)
_IENavigate ($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2#")
$o_form = _IEFormGetObjByName ($oIE, "loginform")
$o_login = _IEFormElementGetObjByName ($o_form, "_username")
$o_password = _IEFormElementGetObjByName ($o_form, "_password")
$o_signin = _IEFormElementGetObjByName ($o_form, "submit")
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_Button_Home
_IENavigate ($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2")
Case $Envoyer
if GUICtrlRead($Etat) = "Rouge" then
$couleur = "red"
elseif GUICtrlRead($Etat) = "Bleue" then
$couleur = "#0000FF"
else
$couleur = "green"
endif
$oOL = _OL_Open()
_OL_Wrapper_SendMail($oOL, "yann.xxxxx@xxxx.fr", "", "", "Synthèse de Production : "& GUICtrlRead($Etat) &"", "<table style='width:200px;border-width:15px;border-color:"& $couleur &";border-style:solid;'><tr><td><img src='synthese_prod.jpg' alt='Synthèse de prod'></td></tr></table>", "C:\Temp\synthese_prod.jpg", $olFormatHTML, $olImportanceHigh)
MsgBox(4096, "Outlook", "Envoi du mail OK ! ")
Case $Nagvis
Run("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\plink.exe -ssh root@xx.xx.xx.xx -pw xxxxxxxx /root/synthesedeprod '"& GUICtrlRead($Service) &"' '"& GUICtrlRead($commentaires) &"'","",@SW_HIDE)
MsgBox(4096, "Nagvis", "Mise à jour Nagvis OK ! ")
Case $Documentation
ShellExecute("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\Synthesedeproduction.docx",@SW_MAXIMIZE)
Case $Capturer
$gui = GUICreate("", 700, 730, -1, -1, -1, 0x80)
$oIE=ObjCreate("Shell.Explorer.2")
;$oIE = _IECreateEmbedded()
$gX = GUICtrlCreateObj($oIE, 50, 10, 360, 720)
GUISetState()
_IENavigate($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2#")
Sleep(1000)
$pos = WinGetPos(ControlGetHandle($gui, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\synthese_prod.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
Capture()
Run("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\plink.exe -ssh root@xx.xx.xx.xx -pw xxxxxxx /root/synthese/synthese.sh","",@SW_HIDE)
ShellExecute("C:\Temp\synthese_prod.jpg")
Func Capture()
_ScreenCapture_Capture("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\synthese_prod.jpg", 10, 10, 360, 750)
$time = @YEAR & @MON & @MDAY
FileDelete("\synthese_prod_"& $time &"_"& GUICtrlRead($Etat) &".jpg")
FileCopy("\synthese_prod.jpg", "G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\Archive\synthese_prod_TEST"& $time &"_"& GUICtrlRead($Etat) &".jpg")
EndFunc
Send( "{F11}" )
EndSwitch
WEnd
- mikell
- Spammer !
- Messages : 6292
- Enregistré le : dim. 29 mai 2011 17:32
- Localisation : Deep Cévennes
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Allons allons c'est pourtant pas compliqué
PS : AutoIt version 3.3.6.1 ça commence à dater un brin, mettre à jour serait une bonne idée
Case $Capturer
$pos = WinGetPos(ControlGetHandle($Form1_1, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\synthese_prod.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
; et c'est tout
$pos = WinGetPos(ControlGetHandle($Form1_1, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\synthese_prod.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
; et c'est tout
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Merci beaucoup pour ton aide précieuse et j'imagine bien que c'est surement pas compliqué mais ça marche toujours pas hélas
J'ai bien inséré ton code mais la capture ne se fait toujours pas dans la bonne zone.
Voir photos/lins ci-dessous :
Résultat Capture
Zone à capturer
J'ai bien inséré ton code mais la capture ne se fait toujours pas dans la bonne zone.
Voir photos/lins ci-dessous :
Résultat Capture
Zone à capturer
- mikell
- Spammer !
- Messages : 6292
- Enregistré le : dim. 29 mai 2011 17:32
- Localisation : Deep Cévennes
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Chez moi le code ci-dessous fonctionne bien
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=xxxxxx.ico
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: Yann
Date: 30/05/2017
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <file.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <StaticConstants.au3>
#include <ScreenCapture.au3>
;#include <OutlookEx.au3>
#include <GDIPlus.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <ScreenCapture.au3>
;Variable --> A MODIFIER !----------------------------------------------------
$username = "xxxxx"
$password = "xxxxxxxxx"
; ----------------------------------------------------------------------------
$oIE = _IECreateEmbedded ()
#Region ### START Koda GUI section ### Form=c:\users\david\desktop\formulaire.kxf
$Form1_1 = GUICreate("Service Prod/Exploit (C) YLB-MRN 06/2017", 950, 850, 185, 101)
$Label1 = GUICtrlCreateLabel("Synthèse de production v2.0", 10, 8, 433, 33)
GUICtrlSetFont(-1, 24, 400, 0, "Arial")
$Informations = GUICtrlCreateGroup(" Homme de prod Etat", 8, 50, 485, 201)
$Service = GUICtrlCreateCombo("", 24, 70, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Yann|Eric|Jérémy")
$Etat = GUICtrlCreateCombo("", 205, 70, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Etat, "Verte|Rouge", "Verte")
if GUICtrlRead($Etat) = "Rouge" then
$couleur = "red"
else
$couleur = "green"
endif
GUISetState(@SW_SHOW)
GUICtrlSetFont(-1, 10, 100, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$commentaires = GUICtrlCreateEdit("", 24, 100, 317, 81,$ES_AUTOVSCROLL)
GUICtrlSetData(-1, "Pour un retour à la ligne <br>")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nagvis = GUICtrlCreateButton("1 - Nagvis", 370, 85, 105, 33)
$Capturer = GUICtrlCreateButton("2 - Capturer", 370, 120, 105, 33)
$Envoyer = GUICtrlCreateButton("3 - Envoyer", 370, 155, 105, 33)
$Documentation = GUICtrlCreateButton("4 - Documentation", 370, 190, 105, 33)
$GUI_Button_home = GUICtrlCreateButton("Rafraichir ->", 370, 355, 100, 30)
GUISetState(@SW_SHOW)
$Informations2 = GUICtrlCreateGroup("Prévisualisation Synthèse", 500, 50, 435, 750)
$GUIActiveX = GUICtrlCreateObj($oIE, 524, 70, 390, 710)
_IENavigate ($oIE, "http://www.google.fr")
#cs
_IENavigate ($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2#")
$o_form = _IEFormGetObjByName ($oIE, "loginform")
$o_login = _IEFormElementGetObjByName ($o_form, "_username")
$o_password = _IEFormElementGetObjByName ($o_form, "_password")
$o_signin = _IEFormElementGetObjByName ($o_form, "submit")
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
#EndRegion ### END Koda GUI section ###
#ce
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_Button_Home
_IENavigate ($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2")
Case $Envoyer
if GUICtrlRead($Etat) = "Rouge" then
$couleur = "red"
elseif GUICtrlRead($Etat) = "Bleue" then
$couleur = "#0000FF"
else
$couleur = "green"
endif
$oOL = _OL_Open()
_OL_Wrapper_SendMail($oOL, "yann.xxxxx@xxxx.fr", "", "", "Synthèse de Production : "& GUICtrlRead($Etat) &"", "<table style='width:200px;border-width:15px;border-color:"& $couleur &";border-style:solid;'><tr><td><img src='synthese_prod.jpg' alt='Synthèse de prod'></td></tr></table>", "C:\Temp\synthese_prod.jpg", $olFormatHTML, $olImportanceHigh)
MsgBox(4096, "Outlook", "Envoi du mail OK ! ")
Case $Nagvis
Run("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\plink.exe -ssh root@xx.xx.xx.xx -pw xxxxxxxx /root/synthesedeprod '"& GUICtrlRead($Service) &"' '"& GUICtrlRead($commentaires) &"'","",@SW_HIDE)
MsgBox(4096, "Nagvis", "Mise à jour Nagvis OK ! ")
Case $Documentation
ShellExecute("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\Synthesedeproduction.docx",@SW_MAXIMIZE)
Case $Capturer
$pos = WinGetPos(ControlGetHandle($Form1_1, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\synthese_prod.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
#cs
Capture()
Run("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\plink.exe -ssh root@xx.xx.xx.xx -pw xxxxxxx /root/synthese/synthese.sh","",@SW_HIDE)
ShellExecute("C:\Temp\synthese_prod.jpg")
Func Capture()
_ScreenCapture_Capture("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\synthese_prod.jpg", 10, 10, 360, 750)
$time = @YEAR & @MON & @MDAY
FileDelete("\synthese_prod_"& $time &"_"& GUICtrlRead($Etat) &".jpg")
FileCopy("\synthese_prod.jpg", "G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\Archive\synthese_prod_TEST"& $time &"_"& GUICtrlRead($Etat) &".jpg")
EndFunc
Send( "{F11}" )
#ce
EndSwitch
WEnd
#AutoIt3Wrapper_Icon=xxxxxx.ico
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: Yann
Date: 30/05/2017
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <file.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <StaticConstants.au3>
#include <ScreenCapture.au3>
;#include <OutlookEx.au3>
#include <GDIPlus.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <ScreenCapture.au3>
;Variable --> A MODIFIER !----------------------------------------------------
$username = "xxxxx"
$password = "xxxxxxxxx"
; ----------------------------------------------------------------------------
$oIE = _IECreateEmbedded ()
#Region ### START Koda GUI section ### Form=c:\users\david\desktop\formulaire.kxf
$Form1_1 = GUICreate("Service Prod/Exploit (C) YLB-MRN 06/2017", 950, 850, 185, 101)
$Label1 = GUICtrlCreateLabel("Synthèse de production v2.0", 10, 8, 433, 33)
GUICtrlSetFont(-1, 24, 400, 0, "Arial")
$Informations = GUICtrlCreateGroup(" Homme de prod Etat", 8, 50, 485, 201)
$Service = GUICtrlCreateCombo("", 24, 70, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Yann|Eric|Jérémy")
$Etat = GUICtrlCreateCombo("", 205, 70, 137, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Etat, "Verte|Rouge", "Verte")
if GUICtrlRead($Etat) = "Rouge" then
$couleur = "red"
else
$couleur = "green"
endif
GUISetState(@SW_SHOW)
GUICtrlSetFont(-1, 10, 100, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$commentaires = GUICtrlCreateEdit("", 24, 100, 317, 81,$ES_AUTOVSCROLL)
GUICtrlSetData(-1, "Pour un retour à la ligne <br>")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Nagvis = GUICtrlCreateButton("1 - Nagvis", 370, 85, 105, 33)
$Capturer = GUICtrlCreateButton("2 - Capturer", 370, 120, 105, 33)
$Envoyer = GUICtrlCreateButton("3 - Envoyer", 370, 155, 105, 33)
$Documentation = GUICtrlCreateButton("4 - Documentation", 370, 190, 105, 33)
$GUI_Button_home = GUICtrlCreateButton("Rafraichir ->", 370, 355, 100, 30)
GUISetState(@SW_SHOW)
$Informations2 = GUICtrlCreateGroup("Prévisualisation Synthèse", 500, 50, 435, 750)
$GUIActiveX = GUICtrlCreateObj($oIE, 524, 70, 390, 710)
_IENavigate ($oIE, "http://www.google.fr")
#cs
_IENavigate ($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2#")
$o_form = _IEFormGetObjByName ($oIE, "loginform")
$o_login = _IEFormElementGetObjByName ($o_form, "_username")
$o_password = _IEFormElementGetObjByName ($o_form, "_password")
$o_signin = _IEFormElementGetObjByName ($o_form, "submit")
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
#EndRegion ### END Koda GUI section ###
#ce
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_Button_Home
_IENavigate ($oIE, "http://xx.xx.xx.xx/nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=Synthese_Prod_2")
Case $Envoyer
if GUICtrlRead($Etat) = "Rouge" then
$couleur = "red"
elseif GUICtrlRead($Etat) = "Bleue" then
$couleur = "#0000FF"
else
$couleur = "green"
endif
$oOL = _OL_Open()
_OL_Wrapper_SendMail($oOL, "yann.xxxxx@xxxx.fr", "", "", "Synthèse de Production : "& GUICtrlRead($Etat) &"", "<table style='width:200px;border-width:15px;border-color:"& $couleur &";border-style:solid;'><tr><td><img src='synthese_prod.jpg' alt='Synthèse de prod'></td></tr></table>", "C:\Temp\synthese_prod.jpg", $olFormatHTML, $olImportanceHigh)
MsgBox(4096, "Outlook", "Envoi du mail OK ! ")
Case $Nagvis
Run("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\plink.exe -ssh root@xx.xx.xx.xx -pw xxxxxxxx /root/synthesedeprod '"& GUICtrlRead($Service) &"' '"& GUICtrlRead($commentaires) &"'","",@SW_HIDE)
MsgBox(4096, "Nagvis", "Mise à jour Nagvis OK ! ")
Case $Documentation
ShellExecute("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\Synthesedeproduction.docx",@SW_MAXIMIZE)
Case $Capturer
$pos = WinGetPos(ControlGetHandle($Form1_1, "", "Internet Explorer_Server1"))
_ScreenCapture_Capture(@scriptdir & "\synthese_prod.jpg", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
#cs
Capture()
Run("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\plink.exe -ssh root@xx.xx.xx.xx -pw xxxxxxx /root/synthese/synthese.sh","",@SW_HIDE)
ShellExecute("C:\Temp\synthese_prod.jpg")
Func Capture()
_ScreenCapture_Capture("G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\synthese_prod.jpg", 10, 10, 360, 750)
$time = @YEAR & @MON & @MDAY
FileDelete("\synthese_prod_"& $time &"_"& GUICtrlRead($Etat) &".jpg")
FileCopy("\synthese_prod.jpg", "G:\Dsi\1-Architecture Technique & Support\11-Applications\25-ProdExploit\Archive\synthese_prod_TEST"& $time &"_"& GUICtrlRead($Etat) &".jpg")
EndFunc
Send( "{F11}" )
#ce
EndSwitch
WEnd
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
finalement, on supprimant une partie du code, cela fonctionne parfaitement et mille mercis pour cette aide précieuse.
Reste plus qu'à trouver comment mettre un cadre rouge ou vert sur la copie d'écran générée en fonction du menu déroulant...Et j'aurais terminé.
Reste plus qu'à trouver comment mettre un cadre rouge ou vert sur la copie d'écran générée en fonction du menu déroulant...Et j'aurais terminé.
- mikell
- Spammer !
- Messages : 6292
- Enregistré le : dim. 29 mai 2011 17:32
- Localisation : Deep Cévennes
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Ben voilà
Case $Capturer
_GDIPlus_Startup()
$pos = WinGetPos(ControlGetHandle($Form1_1, "", "Internet Explorer_Server1"))
$hBitmap = _ScreenCapture_Capture("", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
$hPen = _GDIPlus_PenCreate(0xffff0000, 10)
_GDIPlus_GraphicsDrawRect($hGraphic, 0, 0, $pos[2], $pos[3], $hPen)
_GDIPlus_ImageSaveToFile($hImage, @scriptdir & "\synthese_prod.jpg")
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown()
_GDIPlus_Startup()
$pos = WinGetPos(ControlGetHandle($Form1_1, "", "Internet Explorer_Server1"))
$hBitmap = _ScreenCapture_Capture("", $pos[0], $pos[1], $pos[0]+$pos[2], $pos[1]+$pos[3])
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
$hPen = _GDIPlus_PenCreate(0xffff0000, 10)
_GDIPlus_GraphicsDrawRect($hGraphic, 0, 0, $pos[2], $pos[3], $hPen)
_GDIPlus_ImageSaveToFile($hImage, @scriptdir & "\synthese_prod.jpg")
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown()
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
-
- Status : Hors ligne
Re: Capture d'une page HTML intégrée.
Impressionné par la réactivité. Merci encore...