Jump to content
Sign in to follow this  
Medic873

Pull Google Images

Recommended Posts

Medic873

Okay ive seen another program like this somewhere but im just trying to build it for myself

basicly what I want to do is set a keyword (simple input box)

and then once every hour my program will go to google images and pull a photo under that keyword and make it your background

so far Im just trying to tactil part one pull the image from google images

<p>#include <IE.au3>

#Include <ScreenCapture.au3>

#include <Excel.au3>

#include "array.au3"

#Include <File.au3>

#include <string.au3>

#include <INet.au3>

$GoogleImagesHTML = _INetGetSource("

Share this post


Link to post
Share on other sites
FireFox

Hi,

Like this :

#include <INet.au3>
#include <String.au3>

Global $sSource, $aImgURL, $sKeyWord

$sKeyWord = "toto"

$sSource = _INetGetSource("http://www.google.fr/search?q=" & $sKeyWord & "&tbm=isch")

$aImgURL = _StringBetween($sSource, '<a href="/imgres?imgurl=', '&amp;imgrefurl=')

ConsoleWrite($aImgURL[0] & @CrLf)

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
PhoenixXL

Great reply by firefox

here is an example of the code firefox posted

#include <INet.au3>
#include <String.au3>

Global $sSource, $aImgURL, $sKeyWord

$sKeyWord = "hello"

$sSource = _INetGetSource("http://www.google.fr/search?q=" & $sKeyWord & "&tbm=isch")

$aImgURL = _StringBetween($sSource, '<a href="/imgres?imgurl=', '&amp;imgrefurl=')

$aImgURL=$aImgURL[Random(0,UBound($aImgURL)-1,1)]

$nFile=@ScriptDir&'Downloaded.'&StringRight($aImgURL,3)
InetGet($aImgURL,$nFile)

GUICreate('')
GUICtrlCreatePic($nFile,0,0)

GUISetState()

While GUIGetMsg()<>-3
Sleep(10)
WEnd
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
FireFox

Great reply by firefox

:graduated: thanks.

hehe, you can also display a mosaic of all images :idiot:


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
PhoenixXL

yup,

good idea

here is the code of mosaic

#include <INet.au3>
#include <String.au3>
Global $sSource, $aImgURL, $sKeyWord

$sKeyWord = "hello"

$sSource = _INetGetSource("http://www.google.fr/search?q=" & $sKeyWord & "&tbm=isch")

$aImgURL = _StringBetween($sSource, '<a href="/imgres?imgurl=', '&amp;imgrefurl=')
Local $iBound=UBound($aImgURL)
Local $nFile[$iBound]
For $i=0 To $iBound-1
$nFile[$i]=@ScriptDir&'Downloaded'&$i+1&StringRight($aImgURL[$i],4)
InetGet($aImgURL[$i],$nFile[$i])
Next

GenerateButtons($nFile,UBound($nFile)-1,5)

Exit


Func GenerateButtons($nButtonNameArray,$sNumber,$sLine=1,$Width=70,$Height=50,$sButtonSpacing=10,$hBorderSpacing=20)
If $sLine>=$sNumber Then $sLine=$sNumber
Local $sMaxButton=Ceiling($sNumber/$sLine)
Local $Form2 = GUICreate("Phoenix XL _Testing.au3", _
($sMaxButton*$Width)+(2*$hBorderSpacing)+(($sMaxButton-1)*$sButtonSpacing), _
($sLine*$Height)+(2*$hBorderSpacing)+(($sLine-1)*$sButtonSpacing))
Global $Buttons[$sNumber+1]
Local $h = $hBorderSpacing
Local $w = $hBorderSpacing
If Not IsArray($nButtonNameArray) Then
Local $nMakeArray[1]=[0]
Local $iCount,$iDimension
For $n=1 To $sNumber
_ArrayAddEx($nMakeArray,0,$iDimension,$iCount)
Next
ReDim $nMakeArray[$iCount]
$nButtonNameArray=$nMakeArray
EndIf
For $i=1 To $sNumber
$Buttons[$i]=GUICtrlCreatePic($nButtonNameArray[$i],$w,$h,$Width,$Height)
GUICtrlSetTip(-1,'Button Number: '&$i,'Information',1,3)
If IsMultiple($i,$sMaxButton) Then
$h+=$Height+$sButtonSpacing
$w = $hBorderSpacing
Else
$w+=$Width+$sButtonSpacing
EndIf
Next
GUISetState()
Local $nMsg
While 1
$nMsg=GUIGetMsg()
Switch $nMsg
Case -3
Return GUIDelete($Form2)
Case $Buttons[1] To $Buttons[$sNumber]
GUICtrlSetData($nMsg,Number(GUICtrlRead($nMsg))+1)
EndSwitch
WEnd
EndFunc

Func IsMultiple($nNumber,$sFactor)
If IsInt($nNumber/$sFactor) Then Return 1
Return 0
EndFunc

Func _ArrayAddEx(ByRef $aArray, $sData, ByRef $iDimension, ByRef $iCount) ; Taken from Array.au3 and modified by guinness to reduce the use of ReDim.
    If IsArray($aArray) = 0 Then
        Return SetError(1, 0, -1)
    EndIf

    If UBound($aArray, 0) <> 1 Then
        Return SetError(2, 0, -1)
    EndIf

    If $iCount = 0 Then
        $iCount = UBound($aArray, 1)
    EndIf

    $iCount += 1
    If ($iCount + 1) >= $iDimension Then
        $iDimension = (UBound($aArray) + 1) * 2
        ReDim $aArray[$iDimension]
    EndIf
    $aArray[$iCount - 1] = $sData
    Return $iCount - 1
EndFunc   ;==>_ArrayAddEx
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
FireFox

here is the code of mosaic

muttley I was almost sure that you would do it.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
PhoenixXL

good guess :graduated:


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
PhoenixXL

Some pngs were not getting set,

therefore i modified, added the support of GDIPlus

#include <INet.au3>
#include <String.au3>
#include <Gdiplus.au3>
#include <Array.au3>
_GDIPlus_Startup()
Global $sSource, $aImgURL, $sKeyWord

$sKeyWord = "love"

$sSource = _INetGetSource("http://www.google.com/search?q=" & $sKeyWord & "&tbm=isch")

$aImgURL = _StringBetween($sSource, '<a href="/imgres?imgurl=', '&amp;imgrefurl=')
_ArrayInsert($aImgURL,0,UBound($aImgURL))
Local $iBound = UBound($aImgURL)
Local $nFile[$iBound]
For $i = 1 To $iBound-1
$nFile[$i] = @ScriptDir & 'Downloaded' & $i & StringRight($aImgURL[$i], 4)
InetGet($aImgURL[$i], $nFile[$i])
Next

GenerateButtons($nFile, UBound($nFile) - 1, 5,300,120)
_GDIPlus_Shutdown()
Exit


Func GenerateButtons($nButtonNameArray, $sNumber, $sLine = 1, $Width = 70, $Height = 50, $sButtonSpacing = 10, $hBorderSpacing = 20)
If $sLine >= $sNumber Then $sLine = $sNumber
Local $sMaxButton = Ceiling($sNumber / $sLine)
Local $Form2 = GUICreate("Phoenix XL _Testing.au3", _
($sMaxButton * $Width) + (2 * $hBorderSpacing) + (($sMaxButton - 1) * $sButtonSpacing), _
($sLine * $Height) + (2 * $hBorderSpacing) + (($sLine - 1) * $sButtonSpacing))
Global $Buttons[$sNumber + 1]
Local $h = $hBorderSpacing
Local $w = $hBorderSpacing
If Not IsArray($nButtonNameArray) Then
Local $nMakeArray[1] = [0]
Local $iCount, $iDimension
For $n = 1 To $sNumber
_ArrayAddEx($nMakeArray, 0, $iDimension, $iCount)
Next
ReDim $nMakeArray[$iCount]
$nButtonNameArray = $nMakeArray
EndIf
For $i = 1 To $sNumber
$Buttons[$i] = GUICtrlCreatePic('', $w, $h, $Width, $Height)
_PicSetImage($nButtonNameArray[$i],$Buttons[$i],$Form2)
GUICtrlSetTip(-1, 'Button Number: ' & $i, 'Information', 1, 3)
If IsMultiple($i, $sMaxButton) Then
$h += $Height + $sButtonSpacing
$w = $hBorderSpacing
Else
$w += $Width + $sButtonSpacing
EndIf
Next
WinSetOnTop($Form2,'',1)
GUISetState()
Local $nMsg
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Return GUIDelete($Form2)
Case $Buttons[1] To $Buttons[$sNumber]
GUICtrlSetData($nMsg, Number(GUICtrlRead($nMsg)) + 1)
EndSwitch
WEnd
EndFunc   ;==>GenerateButtons

Func IsMultiple($nNumber, $sFactor)
If IsInt($nNumber / $sFactor) Then Return 1
Return 0
EndFunc   ;==>IsMultiple

Func _ArrayAddEx(ByRef $aArray, $sData, ByRef $iDimension, ByRef $iCount) ; Taken from Array.au3 and modified by guinness to reduce the use of ReDim.
If IsArray($aArray) = 0 Then
Return SetError(1, 0, -1)
EndIf

If UBound($aArray, 0) <> 1 Then
Return SetError(2, 0, -1)
EndIf

If $iCount = 0 Then
$iCount = UBound($aArray, 1)
EndIf

$iCount += 1
If ($iCount + 1) >= $iDimension Then
$iDimension = (UBound($aArray) + 1) * 2
ReDim $aArray[$iDimension]
EndIf
$aArray[$iCount - 1] = $sData
Return $iCount - 1
EndFunc   ;==>_ArrayAddEx

Func _PicSetImage($nFile, $nPic, $hGUI)
$hBmp = _GDIPlus_ImageLoadFromFile($nFile)
$hBmp_Logo = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
_GDIPlus_BitmapDispose($hBmp)
$nPos=ControlGetPos($hGUI,'',$nPic)
GUICtrlSendMsg($nPic, 0x0172, 0, $hBmp_Logo)
ControlMove($hGUI,'',$nPic,Default,Default,$nPos[2],$nPos[3])
EndFunc   ;==>_PicSetImage

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
Medic873

BTW Forgot to say thank you for this, was a real help.

Share this post


Link to post
Share on other sites
FireFox

BTW Forgot to say thank you for this, was a real help.

muttley finally woke up from his long sleep.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Epic007
      By Epic007
      Hey guys I'm stuck with a program.....I need a make an automation which copies text from a chat bot app and paste it in notepad to log the replies of my chat bot and to analyse stuff....a lil help pls
       
       
       
       
       
       
       
      Thanks in advance
    • odaylton
      By odaylton
      Hello everyone ,
      Text translated from Portuguese by google - please apologize for any errors

      Once again I need a light from the gurus of this wonderful website
      I am fanatic by combobox for its usability but I am not able to uncertain images within lists ...
      I know uncertain icons, and cursors but I am not able to insert gif or jpg images.
      1) How to solve this ...
      2) will the path is to convert gif into bmp and then uncertain ... how to do that?
      #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ;dados de mouse #include <WinAPIRes.au3> ;COMBO #include <GuiComboBoxEx.au3> ;Fonts #include <FontConstants.au3> ;obter imagem de arquivo #include <GDIPlus.au3> #include <WinAPIGdi.au3> Example() Func Example() Local $hGUI, $hImage, $hCombo, $hFont Local $idListview, $hImage Local $sWow64 = "" Local $Pasta = "C:\WINDOWS\Cursors\3dgarro.cur" Local $PastaROMs = @MyDocumentsDir & "\Stella\ROMs\" ;com barra no final $hGUI = GUICreate("ImageList", 500, 310) GUISetFont(14, 400, 0, "Arial") ;<<<<<<<<<<this does not work for _GUICtrlComboBoxEx_Create $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 494, 200) ;GUICtrlSetFont($hCombo, 14, 400, 0, "Arial");<<<<<<<<<<It does not work ; ;Create a handle to a font object $hFont = _WinAPI_CreateFont(30, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') ;Pass the handle to _WinAPI_SetFont _WinAPI_SetFont($hCombo, $hFont) $idListview = GUICtrlCreateListView("", 2, 50, 494, 250, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Initialize GDI+ library _GDIPlus_Startup() ; Load images $hImage = _GUIImageList_Create(120, 70, 6, 2) ;32,32,5,5) ; $DadosCombo = "Escolha|" & _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0x0000FF, 120, 70)) ;Local $aCursors[] = [32650, 32512, 32515, 32649, 32651, 32513, 32648, 32646, 32643, 32645, 32642, 32644, 32516, 32514] For $i = 1 To 10 $sFile = FileOpenDialog("Please select an image", $PastaROMs, "Image (*.jpg;*.png;*.bmp;*.gif;*.tif)", BitOR($FD_PATHMUSTEXIST, $FD_FILEMUSTEXIST)) If @error Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "No image file has been selected", 30) $a = _GDIPlus_BitmapCreateFromFile ($sFile);<<<<< ok If @error Or Not $hImage Then MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "This file isn't supported by GDIPlus!") Else $b=_GUIImageList_Add($hImage, $a);<<<<<< Return -1 $DadosCombo &= "|" & $i & "_img_princ.gif""|" & $b EndIf Next _GUICtrlListView_SetImageList($idListview, $hImage, 1) _GUICtrlComboBoxEx_SetImageList($hCombo, $hImage) ; Add columns _GUICtrlListView_AddColumn($idListview, "Icons - Mouses", 350) ; Add items $a = StringSplit($DadosCombo, "|") For $i = 1 To $a[0] Step 2 _GUICtrlListView_AddItem($idListview, $a[$i], $a[$i + 1]) _GUICtrlComboBoxEx_AddString($hCombo, $a[$i], $a[$i + 1], $a[$i + 1]) Next ;AutoIt_Debugger_Command:Disable_Debug ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() ;AutoIt_Debugger_Command:Enable_Debug EndFunc ;==>Example tks
    • corz
      By corz
      We've been able to drag images out of web browsers since forever. Can I drag one into my GUI?
      Or rather, can I drag an image from my web browser onto my GUI and have my app *do* something with that image?
      My fingers bleed from searching. Any ideas much appreciated!
      ;o) Cor
    • fatpig
      By fatpig
      can anyone tell me how I stop this from occuring when I place a jpg in my GUI?
      White parts become black. might be transparent, too. Not sure.
      thanks

×