Medic873 Posted October 24, 2012 Posted October 24, 2012 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("
FireFox Posted October 24, 2012 Posted October 24, 2012 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=', '&imgrefurl=') ConsoleWrite($aImgURL[0] & @CrLf) Br, FireFox.
PhoenixXL Posted October 24, 2012 Posted October 24, 2012 (edited) 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=', '&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 October 24, 2012 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.
FireFox Posted October 24, 2012 Posted October 24, 2012 Great reply by firefox thanks.hehe, you can also display a mosaic of all images
PhoenixXL Posted October 24, 2012 Posted October 24, 2012 (edited) yup, good idea here is the code of mosaic expandcollapse popup#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=', '&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 October 24, 2012 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.
FireFox Posted October 24, 2012 Posted October 24, 2012 here is the code of mosaic muttley I was almost sure that you would do it.
PhoenixXL Posted October 24, 2012 Posted October 24, 2012 good guess 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.
PhoenixXL Posted October 24, 2012 Posted October 24, 2012 Some pngs were not getting set, therefore i modified, added the support of GDIPlus expandcollapse popup#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=', '&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.
Medic873 Posted November 1, 2012 Author Posted November 1, 2012 BTW Forgot to say thank you for this, was a real help.
FireFox Posted November 1, 2012 Posted November 1, 2012 BTW Forgot to say thank you for this, was a real help. muttley finally woke up from his long sleep.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now