Jump to content

server banner to script


Recommended Posts

hi guys, i wondering is it anyhow possible to create somekind box where that banner would go

#include 
#include 

Example()

; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Example()
Local $oIE, $GUI_Button_Back, $GUI_Button_Forward
Local $GUI_Button_Home, $GUI_Button_Stop, $msg

$oIE = ObjCreate("Shell.Explorer.2")

; Create a simple GUI for our output
GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
GUICtrlCreateObj($oIE, 10, 40, 395, 65)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 330, 420, 100, 30)

GUISetState() ;Show GUI

$oIE.navigate("http://cache.www.gametracker.com/server_info/63.143.46.162:28951/b_350_20_692108_381007_FFFFFF_000000.png")

; Waiting for user to close the window
While 1
$msg = GUIGetMsg()

Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
$oIE.navigate("http://cache.www.gametracker.com/server_info/63.143.46.162:28951/b_350_20_692108_381007_FFFFFF_000000.png")
Case $msg = $GUI_Button_Back
$oIE.GoBack
Case $msg = $GUI_Button_Forward
$oIE.GoForward
Case $msg = $GUI_Button_Stop
$oIE.Refresh
EndSelect

WEnd

GUIDelete()
EndFunc ;==>Example

if i do that, there will be large white area what i cant take away. i appreciate if someone can help and this wont affent anyhow to game ^^ my apology if there is any thread like this but could find :/

Link to comment
Share on other sites

Why don't you download the file with InetGet()? (perhaps to a temporary directory). You could then set it in your GUI.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

Something like this:

InetGet("<URL HERE>", "<DESTINATION PATH>", 0, 0)

and then you can set the picture (by GuiCtrlCreatePic())

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

Just a note, the picture being accessed is in the PNG image format, you'll have to look at the example script for GUICtrlCreateImage (3rd example) for a way to use that type of image.

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

Sorry, you're right, I mistyped that. :oops:

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

again i jammed :/ i cant figure out how i could add that picture to script. here my code

#include 
Global $aTitle[5] = [5, "lol", "lil", "lal", "lel"]
Global $aButton[5]
$form1 = GUICreate("test", 400, 125)
GUICtrlCreateTab(10, 10, 380, 100)

GUISetState(@SW_SHOW)
GUICtrlCreateTab(10, 10, 200, 100)
$tab1 = GUICtrlCreateTabItem("lollil") ; <== changed
$aButton[1] = GUICtrlCreateButton("lol", 20, 50, 50)
$aButton[2] = GUICtrlCreateButton("lil", 20, 75, 50)
GUICtrlCreateTabItem("") ; <== added according to the help file
GUICtrlCreateTabItem("lallel")
$aButton[3] = GUICtrlCreateButton("lal", 20, 50, 50)
$aButton[4] = GUICtrlCreateButton("lel", 20, 75, 50)
GUICtrlCreatePic("C:UsersJarnoDesktoplol.jpg", 20, 20, 350, 50)

GUISetState()
While 1
$iMsg = GUIGetMsg()
Switch $iMsg
Case $aButton[1]
MsgBox(0, "", "lol")
Case $aButton[2]
MsgBox(0, "", "lil")
Case $aButton[3]
MsgBox(0, "", "lal")
Case $aButton[4]
MsgBox(0, "", "lel")
EndSwitch
If $iMsg = $GUI_EVENT_CLOSE Then Exit
WEnd
Link to comment
Share on other sites

Try this, it will only work if you have the picture file saved where it tries to read it from.

#include <GUIConstantsEx.au3>
Global $aTitle[5] = [5, "lol", "lil", "lal", "lel"]
Global $aButton[5]
$form1 = GUICreate("test", 400, 125)
GUICtrlCreateTab(10, 10, 380, 100)
GUISetState(@SW_SHOW)
GUICtrlCreateTab(10, 10, 200, 100)
$tab1 = GUICtrlCreateTabItem("lollil") ; <== changed
$aButton[1] = GUICtrlCreateButton("lol", 20, 50, 50)
$aButton[2] = GUICtrlCreateButton("lil", 20, 75, 50)
GUICtrlCreateTabItem("lallel")
$aButton[3] = GUICtrlCreateButton("lal", 20, 50, 50)
$aButton[4] = GUICtrlCreateButton("lel", 20, 75, 50)
GUICtrlCreatePic("C:UsersJarnoDesktoplol.jpg", 70, 40, 300, 50)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateTabItem("") ; <== added according to the help file
GUISetState()
While 1
     $iMsg = GUIGetMsg()
     Switch $iMsg
          Case $aButton[1]
               MsgBox(0, "", "lol")
          Case $aButton[2]
               MsgBox(0, "", "lil")
          Case $aButton[3]
               MsgBox(0, "", "lal")
          Case $aButton[4]
               MsgBox(0, "", "lel")
     EndSwitch
     If $iMsg = $GUI_EVENT_CLOSE Then Exit
WEnd

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

i tried change png to jpg but autoit wont accept that image even if i can view it myself with other program, i checked that 3rd example but i didnt get it how it works

Edited by cation
Link to comment
Share on other sites

i managed to get that png to my script and i figured out how i can move it, but yet i havent figure out how i but it to specific tab that picture, like in tab1 it wont show and in tab2 it will show

code without png thing

#include
#include
#include
#include

Global $aTitle[5] = [5, "lol", "lil", "lal", "lel"]
Global $aButton[5]
$form1 = GUICreate("test", 400, 125)

GUISetState(@SW_SHOW)
GUICtrlCreateTab(10, 10, 2000, 1000)
$tab1 = GUICtrlCreateTabItem("lollil") ; <== changed
$aButton[1] = GUICtrlCreateButton("lol", 20, 50, 50)
$aButton[2] = GUICtrlCreateButton("lil", 20, 75, 50)
GUICtrlCreateTabItem("lallel")
$aButton[3] = GUICtrlCreateButton("lal", 20, 50, 50)
$aButton[4] = GUICtrlCreateButton("lel", 20, 75, 50)
GUICtrlCreatePic("C:UsersJarnoDesktoplol.jpg", 70, 40, 300, 50)
GUICtrlCreateTabItem("") ; <== added according to the help file
GUISetState()
While 1
$iMsg = GUIGetMsg()
Switch $iMsg
Case $aButton[1]
MsgBox(0, "", "lol")
Case $aButton[2]
MsgBox(0, "", "lil")
Case $aButton[3]
MsgBox(0, "", "lal")
Case $aButton[4]
MsgBox(0, "", "lel")
EndSwitch
If $iMsg = $GUI_EVENT_CLOSE Then Exit
WEnd

and this is that png thing

#include
#include
#include

Global $hImage, $hGraphic, $hImage1

; Load PNG image
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile("C:UsersJarnoDesktoplol.png")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($form1)

GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")
GUISetState()


; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()

; Draw PNG image
Func MY_WM_PAINT($hWnd, $msg, $wParam, $lParam)
#forceref $hWnd, $Msg, $wParam, $lParam
_WinAPI_RedrawWindow($form1, 0, 0, $RDW_UPDATENOW)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 50, 200)
_WinAPI_RedrawWindow($form1, 0, 0, $RDW_VALIDATE)
Return $GUI_RUNDEFMSG
EndFunc
Edited by cation
Link to comment
Share on other sites

What are you trying to do that isn't working? If you only want the pic on the lallel tab, then it's written correctly, if you want it on both tabs, then you need to have a duplicate line to create the pic in each tab.

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

if i put that png thing to script under GUICtrlCreateTabItem("lallel"), it will show on both tabs :/ and before i posted that, i get png picture to script, now i tried again, i cant get it to script :o, could you show example how i do it? and also, how i put two png to same script, do i have to do that long script twice if i want two png to script? : O confusing :/

Edited by cation
Link to comment
Share on other sites

This is how I'd do it using a .JPG file.

; *** Start added by AutoIt3Wrapper ***
#include <GUIConstantsEx.au3>
Global $aTitle[5] = [5, "lol", "lil", "lal", "lel"]
Global $aButton[5]
$form1 = GUICreate("test", 400, 125)
GUISetState(@SW_SHOW)
GUICtrlCreateTab(10, 10, 2000, 1000)
$tab1 = GUICtrlCreateTabItem("lollil") ; <== changed
$aButton[1] = GUICtrlCreateButton("lol", 20, 50, 50)
$aButton[2] = GUICtrlCreateButton("lil", 20, 75, 50)
GUICtrlCreatePic("C:UsersJarnoDesktoplol.jpg", 70, 40, 300, 50)
GUICtrlCreateTabItem("lallel")
$aButton[3] = GUICtrlCreateButton("lal", 20, 50, 50)
$aButton[4] = GUICtrlCreateButton("lel", 20, 75, 50)
GUICtrlCreatePic("C:UsersJarnoDesktoplol.jpg", 70, 40, 300, 50)
GUICtrlCreateTabItem("") ; <== added according to the help file
GUISetState()
While 1
     $iMsg = GUIGetMsg()
     Switch $iMsg
          Case $aButton[1]
               MsgBox(0, "", "lol")
          Case $aButton[2]
               MsgBox(0, "", "lil")
          Case $aButton[3]
               MsgBox(0, "", "lal")
          Case $aButton[4]
               MsgBox(0, "", "lel")
     EndSwitch
     If $iMsg = $GUI_EVENT_CLOSE Then Exit
WEnd

I don't have any experience with using GDI+ so I can't be much help there.

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

In doing some research for a project I'm going to be doing, I came across which may help you do what you're looking for. Specifically, the _SetImage function of it. Yashied did the Icons.au3 UDF, so if it works, send a thanks his way. ;)

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

sry, BrewManNH, could handle it and it looked too messy :/ it might help little bit if you can write little example if you have knowledge for it :) about that _SetImage

Edited by cation
Link to comment
Share on other sites

It's one line, _SetImage(<control handle>, <file name>) how hard is that to figure out?

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

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...