Jump to content

_IEImgClick on a image that works as multiple buttons


Recommended Posts

I just threw something together quick using your script and it stays on top for me with that change to your GUICreate line.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Use the extended style $WS_EX_TOPMOST

$ImgGUI = GUICreate("No DLL Required", $SplashSize, $SplashSize, -1, -1, $WS_POPUP, BitOr($WS_EX_TOPMOST,$WS_EX_LAYERED))

This works!

The reason my code failed was cause i used BitAnd instead.

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Ill try it when i come home from my exam

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Untested.

AdlibRegister('_FakeActivity', 900000) ;Run every 15 mins.
Func _FakeActivity()
    ControlClick($hGUI, '', 'Internet Explorer_Server1', 'Primary', 1, 1, 1)
EndFunc

Added together with a hide gui function (not sure if you want it but its easy to comment out if the users doesnt like it.

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Can someone explain how this works:

$bActive = ($bActive = False)
    If $bActive Then
Line 148 & 149

#AutoIt3Wrapper_Icon=GrooveShark.Ico
#AutoIt3Wrapper_UseX64=n
#include<ie.au3>
#include<splash.au3>
Opt('GuiOnEventMode', 1)
Opt('GUIResizeMode', 102)
Opt("TrayAutoPause", 0)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 3)



;Create tray items.
$Dummy = TrayCreateItem('Nothing playing')
;TraySetToolTip('Nothing playing')
TraySetToolTip("GrooveShark")
TrayItemSetState($Dummy, 128)
TrayCreateItem('')
$sStr = StringSplit('Play|Next|Previous||Shuffle|Repeat||', '|')
For $i = 1 To $sStr[0]
    TrayCreateItem($sStr[$i])
    If $sStr[$i] Then TrayItemSetOnEvent(-1, '_' & $sStr[$i])
Next



$TrayHide = TrayCreateItem("Hide")
TrayItemSetOnEvent($TrayHide,"_Hide")
TrayCreateItem("")
$TrayExit = TrayCreateItem("Exit")
TrayItemSetOnEvent($TrayExit,"_Exit")

;~ $TrayHide = _

;~         TrayItemSetText($dummy, $sCurrent)





TraySetClick(8)
TraySetOnEvent(-8, '_Hide')
Local $Icon = "GrooveShark.Ico"
TraySetIcon($Icon)

;Load and shows splash image
_GUI_Image()
_GUI_Image_Show()

;Set hotkeys.
;HotKeySet('!d', '_Debug')
;HotKeySet('{ESC}', '_Exit2')
HotKeySet('{MEDIA_PLAY_PAUSE}', '_Play')
HotKeySet('{MEDIA_NEXT}', '_Next')
HotKeySet('{MEDIA_PREV}', '_Prev')

HotKeySet("{F1}","_Info")
HotKeySet("{F2}","_Hide")
HotKeySet("{F3}","_WhatsPlaying")

;Variables.
Global $oIE, $hGUI, $bActive = False, $oArtist = 'Artist', $oSong = 'Song', $sCurrent
Global Const $iWidth = (@DesktopWidth/2 + @DesktopWidth/100*25), $iHeight = (@DesktopHeight/2 + @DesktopHeight/100*25), $iPid = @AutoItPID

;Create Gui.
$oIE = _IECreateEmbedded()
$hGUI = GUICreate('Grooveshark', $iWidth, $iHeight, -1, -1, BitOR(0x00010000, 0x00020000))
$oCtrl = GUICtrlCreateObj($oIE, -2, -2, $iWidth + 178, $iHeight - 24)
GUISetOnEvent(-3, '_Exit')
;GUISetOnEvent(-4, '_GuiMini')
_IENavigate($oIE, 'http://grooveshark.com')
;Wait for page to load
_IELoadWait ($oIE)
;Wait for everyting else to load
Sleep (4500)
;Hides the splash image
_GUI_Image_Hide()
;Gives the splash time to disapear before showing GS GUI
Sleep (200)
;Show GS GUI
GUISetState(@SW_SHOW, $hGUI)

;Media control.
Func _Next()
;~  TrayItemSetState(@TRAY_ID, 4)
    $oNext = _IEGetObjByName($oIE, 'player_next')
    _IEAction($oNext, 'click')
EndFunc   ;==>_Next

Func _Play()
;~  TrayItemSetState(@TRAY_ID, 4)
    $oPlay = _IEGetObjByName($oIE, 'player_play_pause')
    _IEAction($oPlay, 'click')
EndFunc   ;==>_Play

Func _Prev()
;~  TrayItemSetState(@TRAY_ID, 4)
    $oPrev = _IEGetObjByName($oIE, 'player_previous')
    _IEAction($oPrev, 'click')
EndFunc   ;==>_Prev

Func _Shuffle()
    $oShuffle = _IEGetObjByName($oIE, 'player_shuffle')
    _IEAction($oShuffle, 'click')
EndFunc   ;==>_Shuffle

Func _Repeat()
;~  TrayItemSetState(@TRAY_ID, 4)
    $oRepeat = _IEGetObjByName($oIE, 'player_loop')
    _IEAction($oRepeat, 'click')
EndFunc   ;==>_Repeat

Func _GetVolume()
;~  <A style="BOTTOM: 0%" class="ui-slider-handle ui-state-default ui-corner-all" href="#" jQuery15107891455831978822="11"></A>
    $hfind = _IETagNameGetCollection($oIE, "A")
    For $h In $hfind
        If String($h.className) = "ui-slider-handle ui-state-default ui-corner-all" Then
            $iVol = StringRegExp(_IEPropertyGet($h, 'outerhtml'), '["]BOTTOM:.(.*?)%["]', 1)
            If IsArray($iVol) Then
                $iVol = $iVol[0]
                ConsoleWrite($iVol & @CRLF)
                Return $iVol
            Else
                Return -1
            EndIf
            ExitLoop
        EndIf
    Next
    Return -1
EndFunc   ;==>_GetVolume

Func _SetVolume($iVol)
    $oTags = _IETagNameGetCollection($oIE, "div")
    For $oTag In $oTags
        If String($oTag.id) = "volumeSlider" Then
            $iVol = StringRegExpReplace(StringRegExpReplace(_IEPropertyGet($oTag, 'outerhtml'), '["]BOTTOM:.(.*?)%["]', '"BOTTOM: ' & $iVol & '%";', 1), '["]HEIGHT:.(.*?)%["]', '"HEIGHT: ' & $iVol & '%";', 1)
            _IEPropertySet($oTag, 'outerhtml', $iVol)
            ConsoleWrite($iVol & @CRLF)
            ExitLoop
        EndIf
    Next
    Return -1
EndFunc   ;==>_SetVolume


;Hides the GUI into the tray.
Func _Hide()
    $bActive = ($bActive = False)
    If $bActive Then
        GUISetState(@SW_HIDE, $hGUI)
        TrayItemSetText($TrayHide,"Show")
    Else
        GUISetState(@SW_SHOW, $hGUI)
        TrayItemSetText($TrayHide,"Hide")
    EndIf
EndFunc   ;==>_Hide

;Misc.
Func _Debug()
;~       _SetVolume(50)
EndFunc   ;==>_Debug

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _Exit2()
    If WinActive($hGUI) Then Exit
EndFunc   ;==>_Exit2

Func _RM()
    Local $ai = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $iPid)
    $ai = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai[0])
    DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai[0])
EndFunc   ;==>_RM

Func _Info()
    MsgBox(64,"Info", "Grooveshark Player Info" & @CRLF & "You are currently using v2.4 " & @CRLF & "Program author: Maffe811")
EndFunc


Func _AntiFlash()
    If WinActivate("Adobe Flash Player 10") Then
        ControlClick("Adobe Flash Player 10","","[CLASS:Button; INSTANCE:1]")
    EndIf
EndFunc

Func _WhatsPlaying()
    TrayTip("GrooveShark", $sCurrent,5)
EndFunc


Func _FakeActivity()
    ControlClick($hGUI, '', 'Internet Explorer_Server1', 'Primary', 1, 1, 1)
EndFunc

;Reduce memory usage every 60 seconds.
AdlibRegister('_RM', 60000)
;Fake activity every 15 minutes.
AdlibRegister('_FakeActivity', 900000);Not sure if this works, but i will have my minions test!

;Main Loop.
$oTags = _IETagNameGetCollection($oIE, "A")
While 1
    For $oTag In $oTags
        If StringInStr($oTag.className, 'currentSongLink') Then
            $oSong = String($oTag.title)
        ElseIf StringInStr($oTag.className, 'artist') Then
            $oArtist = String($oTag.title)
            ExitLoop
        EndIf
    Next

    If $oSong & ' ~ ' & $oArtist <> $sCurrent Then
        $sCurrent = $oSong & ' ~ ' & $oArtist

        If $sCurrent = "Song ~ Artist" Then
        WinSetTitle ($hGUI, "", "GrooveShark")
        TrayItemSetText ($dummy,"Nothing Playing")
        ;TraySetToolTip("Nothing playing")
        Else
        WinSetTitle($hGUI, '', 'GrooveShark ~ ' & $sCurrent)
        TrayItemSetText($dummy, $sCurrent)
        ;TraySetToolTip($sCurrent)
        ;Toast?
            If Not WinActive($hGUI) Then
                TrayTip("GrooveShark", $sCurrent,5)
            EndIf
        EndIf
    EndIf

    Sleep(1000)
WEnd

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Can someone explain how this works:

$bActive = ($bActive = False)
    If $bActive Then
Line 148 & 149

This is a way of toggling the boolean value of $bActive. If $bActive is False, then $bActive becomes true, and if it's not False, then $bActive becomes false.

The second line is equivalent to this:

If $bActive = True then

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Okay.

Ill read more about it tomorrow.

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

So a boolean value is a true/false value ?

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...