Sign in to follow this  
Followers 0
realkiller

gui background

13 posts in this topic

#1 ·  Posted (edited)

i searched in aut0it helpfile for help setting up a background image for a gui but without suc6.

i came out with GUICtrlCreatePic, and tryed to figure it out.

please help me compleeting my script

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<< login 24 Help tool >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Local $Password = "timmy"
Do
$sPass = InputBox("Security Check", "Enter your password:", "", "*")
If $sPass = $Password Then
MsgBox(0, "Access Granted", "Thank you, you have logged in successfully.", 1)
Else
MsgBox(0, "Access Denied", "Sorry, you did not enter the correct password." & @CRLF & "Try Again.")
EndIf
Until $sPass = $Password
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<< login 24 Help tool >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


#include <GUIConstants.au3>
#include <IE.au3>

Opt("WinTitleMatchMode", 2)
GUICreate("24 Help V1.2", "956", "24", "", "", $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetHelp("notepad")
$ISIS = GUICtrlCreateButton("ISIS", 22, -1, 85, 25, 0)
$Rollercoaster = GUICtrlCreateButton("Rollercoaster",128, -1, 95, 25, 0)
$SupportCenter = GUICtrlCreateButton("Support Center", 244, -1, 95, 25, 0)
$CSpire = GUICtrlCreateButton("C-Spire", 360, -1, 85, 25, 0)
GUICtrlCreateDate(@YEAR & "/" & @MON & "/" & @MDAY, 448, -1, 185)
$Avaya = GUICtrlCreateButton("Avaya", 658, -1, 85, 25, 0)
$Clairify = GUICtrlCreateButton("Clairify", 763, -1, 85, 25, 0)
$Lotus = GUICtrlCreateButton("Lotus", 871, -1, 85, 25, 0)


$Pic1 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 2, 1, 21, 21)
$Pic2 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 108, 1, 21, 21)
$Pic3 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 224, 1, 21, 21)
$Pic4 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 340, 1, 21, 21)
$Pic4 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 637, 1, 21, 21)
$Pic4 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 742, 1, 21, 21)
$Pic4 = GUICtrlCreatePic(@ScriptDir & "\Grijs.gif", 849, 1, 21, 21)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    
Case $ISIS
$oIE = _IECreate("www.google.nl")
$x = StatusbarGetText("Google")
While Not StringInStr($x, "Done")
Sleep(100)
$x = StatusbarGetText("Google")
WEnd

WinMove("Google", "", 0, 25, 1024, 740)
ClipPut("Hello Words")
Send("^v") 
_IENavigate($oIE, "www.tcniso.net")
GUICtrlSetImage($Pic1,@ScriptDir & "\Blauw.gif")
            


        Case $Rollercoaster
            Run("Calc.exe")
            GUICtrlSetImage($Pic2,@ScriptDir & "\Blauw.gif")
            $oIE1 = _IECreate("www.lycos.nl")
            sleep("5000")
            _IENavigate($oIE1, "www.google.nl")



        Case $SupportCenter
            Run("Freecell.exe")
            GUICtrlSetImage($Pic3,@ScriptDir & "\Blauw.gif")
            
            
            
        Case $CSpire
            Run("MSPaint.exe")
            GUICtrlSetImage($Pic4,@ScriptDir & "\Blauw.gif")
            
            
            
        Case $Avaya
            GUICtrlSetImage($Pic4,@ScriptDir & "\Blauw.gif")
            
            
            
        Case $Clairify
            GUICtrlSetImage($Pic4,@ScriptDir & "\Blauw.gif")
            
            
        Case $Lotus
            GUICtrlSetImage($Pic4,@ScriptDir & "\Blauw.gif")
            
    EndSwitch
    If Not WinExists("Google") Then GUICtrlSetImage($Pic1,@ScriptDir & "\Grijs.gif")
    If Not ProcessExists("Calc.exe") Then GUICtrlSetImage($Pic2,@ScriptDir & "\Grijs.gif")
    If Not ProcessExists("Freecell.exe") Then GUICtrlSetImage($Pic3,@ScriptDir & "\Grijs.gif")
    If Not ProcessExists("MSPaint.exe") Then GUICtrlSetImage($Pic4,@ScriptDir & "\Grijs.gif")
WEnd

post-8019-1163776342_thumb.jpg

Edited by realkiller

Share this post


Link to post
Share on other sites



From the help file

If a picture is set as a background picture, as the other controls will overlap, it important to disable the pic control : GuiCtrlSetState(-1,$GUI_DISABLE). This does not work with Tab control which behave differently. in this case you need to create the picture with the $WS_CLIPSIBLINGS style, some $GUI_ONTOP can still be necessary for the tab control.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

I noticed you were creating a menu. Here's a dynamic one that I have built for my girlfriend a long long time ago.

#NoTrayIcon
#include <GUIConstants.au3>

;Change these variables only
Global $buttonsize = 55 ; Mind your resolution with this one.
Global $iconsize = 1 ; 1 for big icon image 0 for small icon image
; If you change one of the two following variables to a smaller value then some icons may be lost.
Global $buttonrow = 3 ; minimum 3 recommended 3!
Global $buttoncol = 8
;EndChange

Global $GUI[2] = [($buttonsize * ($buttonrow)) + 20, ($buttonsize * ($buttoncol + 1)) + 25]
Global $Visible
Global $button[$buttonrow][$buttoncol][2]

For $y = 0 to $buttoncol - 1
    For $x = 0 to $buttonrow - 1
        $button[$x][$y][0] = -1
    Next
Next

Opt("RunErrorsFatal", 0)

Opt("TrayAutoPause", 0)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
TraySetIcon( "shell32.dll" , 43 )
TraySetOnEvent(-7, "ShowHide")
TraySetToolTip("Click here to show and hide your favorites")

$Filehandle = FileOpen("Menu.ini", 1)

GUICreate("Quick Launch Menu", $GUI[0], $GUI[1], @DesktopWidth - $GUI[0], @DesktopHeight - $GUI[1] - 28, $WS_POPUP, $WS_EX_TOOLWINDOW)
WinSetOnTop("Quick Launch Menu", "", 1)

$New = GUICtrlCreateButton("", 10, 10, $buttonsize, $buttonsize , $BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",54, $iconsize)
GUICtrlSetTip ( -1, "Create shortcut" )
$Delete = GUICtrlCreateButton("", 10 + $buttonsize, 10, $buttonsize, $buttonsize , $BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",131, $iconsize)
GUICtrlSetTip ( -1, "Delete shortcut" )
$Close = GUICtrlCreateButton("", 10 + (2 * $buttonsize), 10, $buttonsize, $buttonsize, $BS_ICON)
GUICtrlSetImage (-1, "shell32.dll",27, $iconsize)
GUICtrlSetTip ( -1, "Exit" )

If FileExists(@ScriptDir & "\Menu.ini") Then
    For $y = 0 to $buttoncol - 1
        For $x = 0 to $buttonrow - 1
            $button[$x][$y][1] = IniRead(@ScriptDir & "\Menu.ini", "Button=" & $x & ":" & $y, "Path", "")
            If $button[$x][$y][1] <> "" Then
                $button[$x][$y][0] = GUICtrlCreateButton("", 10 + ( $x * $buttonsize ), 15 + $buttonsize + ( $y * $buttonsize ), $buttonsize, $buttonsize, $BS_ICON)
                GUICtrlSetImage(-1, $button[$x][$y][1], 0, $iconsize)
                
                $tip = IniRead(@ScriptDir & "\Menu.ini", "Button=" & $x & ":" & $y, "Tip", "")
                If $tip <> "" Then
                    GUICtrlSetTip ( -1, $tip )
                Else
                    GUICtrlSetTip ( -1, "Set description with rightclick" )
                EndIf
            EndIf
        Next
    Next
EndIf

;ShowHide() ;uncomment this to show at startup

While 1
    $msg = GUIGetMsg()
    $mouse = GUIGetCursorInfo()
    Select
        Case $msg = $Close
            Exit
        Case $msg = $New
                ;Search for a empty place to put the button in.
                For $y = 0 to $buttoncol - 1
                    For $x = 0 to $buttonrow - 1
                        If $button[$x][$y][0] = -1 Then
                            $button[$x][$y][1] = FileOpenDialog("Create Shortcut to:", "C:\", "Executables (*.exe;*.bat)")
                            If @error Then
                                ;User didn't pick a file
                            Else
                                IniWrite(@ScriptDir & "\Menu.ini", "Button=" & $x & ":" & $y, "Path", $button[$x][$y][1])
                                
                                $button[$x][$y][0] = GUICtrlCreateButton("", 10 + ( $x * $buttonsize ), 15 + $buttonsize + ( $y * $buttonsize ), $buttonsize, $buttonsize, $BS_ICON)
                                GUICtrlSetImage (-1, "shell32.dll",2, $iconsize)
                                GUICtrlSetImage(-1, $button[$x][$y][1], 0, $iconsize)
                                
                                GUICtrlSetTip ( -1, "Set description with rightclick" )
                                
                                GUISetState(@SW_SHOW) ; Because it sometimes dissappears here for no apparent reason
                            EndIf
                            
                            ExitLoop 2
                        EndIf
                    Next
                Next
        Case $msg = $Delete
            While 1
                ToolTip("Click to delete") ; updating it all the time so it follows your mouse
                $msg = GUIGetMsg()
                
                For $y = 0 to $buttoncol - 1
                    For $x = 0 to $buttonrow - 1
                        If $msg = $button[$x][$y][0] Then
                            GUICtrlDelete($button[$x][$y][0])
                            $button[$x][$y][0] = -1
                            IniDelete(@ScriptDir & "\Menu.ini", "Button=" & $x & ":" & $y)
                        EndIf
                    Next
                Next
                
                If $msg = $Delete Then
                    ExitLoop
                EndIf
                
            WEnd
            ToolTip("")
            $msg = GUIGetMsg()
    EndSelect
    For $y = 0 to $buttoncol - 1
        For $x = 0 to $buttonrow - 1
            If $msg = $button[$x][$y][0] Then
                Run($button[$x][$y][1])
            EndIf
            If ($mouse[3] = 1 AND $mouse[4] = $button[$x][$y][0]) Then
                $tip = InputBox("Quick Launch Menu", "What do you want to set as the new description?")
                If $tip <> "" Then
                    IniWrite(@ScriptDir & "\Menu.ini", "Button=" & $x & ":" & $y, "Tip", $tip)
                    GUICtrlSetTip($mouse[4], $tip )
                EndIf
            EndIf
        Next
    Next
Wend

Func ShowHide()
    If $Visible Then
        GUISetState(@SW_HIDE)
    Else
        GUISetState(@SW_SHOW)
    EndIf
    $Visible = NOT $Visible
EndFunc

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

put the guictrlsetstate that big dod showed you under each guictrlcreatepic command

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

this looks intresting to but first i wanna change my own background:p can you finish my script that would be great:D

O.K. I will finish your script, but only if you finish my script first.

Here is what I want to do. I want to open a HTTPS web page, log on to a certain account. Then I want to browse to a certain page, extract some information and then take that information to open a ssh connection to a server on the internet. Then log into that server with the user credentials found on the web page mentioned above. After the login was successfull I want to change a file at the location /etc/passwd and add some lines, which should be entered through a gui. Then format the disk of that server and reboot it.

O.K. here is what I have so far....

; Script Start....
msgbox(0,"START", "Please press the button to start the program")

So, can you please finish my script? After you sent me the script, I will take care of yours....

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

O.K. I will finish your script, but only if you finish my script first.

Here is what I want to do. I want to open a HTTPS web page, log on to a certain account. Then I want to browse to a certain page, extract some information and then take that information to open a ssh connection to a server on the internet. Then log into that server with the user credentials found on the web page mentioned above. After the login was successfull I want to change a file at the location /etc/passwd and add some lines, which should be entered through a gui. Then format the disk of that server and reboot it.

O.K. here is what I have so far....

; Script Start....
msgbox(0,"START", "Please press the button to start the program")

So, can you please finish my script? After you sent me the script, I will take care of yours....

Cheers

Kurt

!!!! ;) !!!! :lmao: I couldn't quit reading that!!!!

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Here's a part of your script, it was quite easy to add in the modifications. I noticed that you put in a empty string ( "" ) in stead of a numeric 0 inside GUICreate, don't do that again. Anyway, look at it and I hope you'll learn.

Enjoy your toolbar. ( and don't ask so bluntly whether someone wants to script something for you, Larry has high blood pressure. )

#include <GUIConstants.au3>
#include <IE.au3>

Opt("WinTitleMatchMode", 2)
GUICreate("24 Help V1.2", 956, 24, 0,0, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ;modified!
GUICtrlCreatePic("background.jpg", 0,0,956, 24) ;modified!
GUICtrlSetState(-1,$GUI_DISABLE) ;modified!

GUISetHelp("notepad")
$ISIS = GUICtrlCreateButton("ISIS", 22, -1, 85, 25, 0)
$Rollercoaster = GUICtrlCreateButton("Rollercoaster",128, -1, 95, 25, 0)
$SupportCenter = GUICtrlCreateButton("Support Center", 244, -1, 95, 25, 0)
$CSpire = GUICtrlCreateButton("C-Spire", 360, -1, 85, 25, 0)
GUICtrlCreateDate(@YEAR & "/" & @MON & "/" & @MDAY, 448, -1, 185)
$Avaya = GUICtrlCreateButton("Avaya", 658, -1, 85, 25, 0)
$Clairify = GUICtrlCreateButton("Clairify", 763, -1, 85, 25, 0)
$Lotus = GUICtrlCreateButton("Lotus", 871, -1, 85, 25, 0)

; more of your code
; ..........................

Share this post


Link to post
Share on other sites

!!!! ;) !!!! :lmao: I couldn't quit reading that!!!!

I'm glad I could entertain you... :evil:

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Here's a part of your script, it was quite easy to add in the modifications. I noticed that you put in a empty string ( "" ) in stead of a numeric 0 inside GUICreate, don't do that again. Anyway, look at it and I hope you'll learn.

Enjoy your toolbar. ( and don't ask so bluntly whether someone wants to script something for you, Larry has high blood pressure. )

#include <GUIConstants.au3>
#include <IE.au3>

Opt("WinTitleMatchMode", 2)
GUICreate("24 Help V1.2", 956, 24, 0,0, $WS_POPUPWINDOW, $WS_EX_TOPMOST) ;modified!
GUICtrlCreatePic("background.jpg", 0,0,956, 24) ;modified!
GUICtrlSetState(-1,$GUI_DISABLE) ;modified!

GUISetHelp("notepad")
$ISIS = GUICtrlCreateButton("ISIS", 22, -1, 85, 25, 0)
$Rollercoaster = GUICtrlCreateButton("Rollercoaster",128, -1, 95, 25, 0)
$SupportCenter = GUICtrlCreateButton("Support Center", 244, -1, 95, 25, 0)
$CSpire = GUICtrlCreateButton("C-Spire", 360, -1, 85, 25, 0)
GUICtrlCreateDate(@YEAR & "/" & @MON & "/" & @MDAY, 448, -1, 185)
$Avaya = GUICtrlCreateButton("Avaya", 658, -1, 85, 25, 0)
$Clairify = GUICtrlCreateButton("Clairify", 763, -1, 85, 25, 0)
$Lotus = GUICtrlCreateButton("Lotus", 871, -1, 85, 25, 0)

; more of your code
; ..........................

thx verrrrry mutch you helped me out it works now, sorryfor asking all of you guys but iam not that good at autoit ;) iam trying to learn it

Edited by Examiner

Share this post


Link to post
Share on other sites

Please log-out... you are still logged in as Examiner

thx

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

thx verrrrry mutch you helped me out it works now, sorryfor asking all of you guys but iam not that good at autoit :lmao: iam trying to learn it

and you offered me to help me writing Cobra. ;)

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  
Followers 0