Jump to content

Help with my Gui


Marcdk
 Share

Recommended Posts

Hey everyone :P. I just started reading some tutorials about this scripting language, but i have some issues i hope some of you can solve...

First i have an image i want to put in as background for my gui. My question is.. When i compile it, i want to give the program to other persons, which means if i give them the exe (without the pic) the picture wont load into the program. I don't want to send the picture along with the exe everytime i give it to friends and so on, So i guess the only way you can solve this problem is, that you can upload it.. But if the picture gets deleted by the host later.. (much image uploading services doesn't keep images into their database forever).

Sorry for my bad english, but i hope some of you understand me... I want to know how i can solve this problem, so when i'm the only thing i have is ONE file.. (the .exe)

Next question..

This hasn't much to do with the GUI, but i felt like just asking about everything at the same time.., Okay so as you can see i have combobox, i want to add 3 more values to it, but how do i do that?

Question 3

How do i get the username in the textbox saved as a variable? So if i for example has it as $username i can use it for later use by using that...

Question 4

When the user presses the button, how do i make the actions which follows after that? I need to a website opened (www.battle.net) when pressing that button..

That should be all for now, i know these questions is VERY VERY nooby, but i don't understand much of those bad explained tutorials i've been reading so far.

Any help is greatly apreciated! Thanks :(

My code:

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\program files\autoit3\scite\koda\forms\marcdk's profile viewer.kxf

$Form1_1 = GUICreate("Marcdk's Profile Viewer", 377, 174, 193, 125)

$Label1 = GUICtrlCreateLabel("Insert the username into the textfield, and select the correct realm. ", 8, 40, 351, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

GUICtrlCreateInput("", 16, 96, 217, 21)

$Label2 = GUICtrlCreateLabel("Account name:", 80, 72, 78, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

$Button1 = GUICtrlCreateButton("Check player profile", 248, 64, 115, 33, 0)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

$Label3 = GUICtrlCreateLabel("Realm:", 288, 104, 37, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

$Combo1 = GUICtrlCreateCombo("Northrend", 272, 128, 73, 25)

$Pic1 = GUICtrlCreatePic("", 0, 0, 377, 193, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Link to comment
Share on other sites

Hey everyone :P . I just started reading some tutorials about this scripting language, but i have some issues i hope some of you can solve...

First i have an image i want to put in as background for my gui. My question is.. When i compile it, i want to give the program to other persons, which means if i give them the exe (without the pic) the picture wont load into the program. I don't want to send the picture along with the exe everytime i give it to friends and so on, So i guess the only way you can solve this problem is, that you can upload it.. But if the picture gets deleted by the host later.. (much image uploading services doesn't keep images into their database forever).

Sorry for my bad english, but i hope some of you understand me... I want to know how i can solve this problem, so when i'm the only thing i have is ONE file.. (the .exe)

Look at my resources UDF http://www.autoitscript.com/forum/index.php?showtopic=51103

Next question..

This hasn't much to do with the GUI, but i felt like just asking about everything at the same time.., Okay so as you can see i have combobox, i want to add 3 more values to it, but how do i do that?

Make it inside Koda and then generate code you will see the result

Question 3

How do i get the username in the textbox saved as a variable? So if i for example has it as $username i can use it for later use by using that...

GUICtrlRead()

Question 4

When the user presses the button, how do i make the actions which follows after that? I need to a website opened (www.battle.net) when pressing that button..

Look at example for GUICtrlCreateButton in the helpfile

That should be all for now, i know these questions is VERY VERY nooby, but i don't understand much of those bad explained tutorials i've been reading so far.

Any help is greatly apreciated! Thanks :(

Welcome to AutoIt comunity and have fun with AutoIt :-)

Link to comment
Share on other sites

Question 4:

You can also use this :

$URL    = "www.battle.net"
             $fd        = FileOpen(@TEMPDir & "url.url",2)
             if $fd = -1 Then Exit
             FileWriteLine($fd,"[InternetShortcut]")
             FileWriteLine($fd,"URL=" & $URL)
             FileClose($fd)
             Run(@comspec & " /c " & chr(34) & @TEMPDir & "url.url" & chr(34))      ;Runs default browser

:P

Edited by farhan879
System task ---> My first GUICalculator v1.0 ---> My version of the calculatorNetZilla 1.0 --> Web browserEmail Sender --> You can Send emails with this without opening a web browser
Link to comment
Share on other sites

I don't get it, after reading and searching around i've given up... I don't understand that helpfile, it's too messy, and the examples doesn't match any of my needs..

Okay so what my program does is: When the user opens the program he has to choose a realm, and an account name. The account name is entered into the inputbox, the realm is selected in the combobox.

There are 4 realms: Northrend, Lordaeron, Azeroth, and Kalimdor which i have in my combobox. Once the button is clicked on the form, the browser will open and it will use the Info from the user to find the correct link to go to ..

This is an example for an URL when the realm is setted to: Northrend and the account name in the Inputbox is setted to: Bash-master: http://www.battle.net/war3/ladder/w3xp-pla...ame=bash-master

Here is a picture of my program for better understanding:

Posted Image

My code:

#include <ButtonConstants.au3>

#include <ComboConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=c:\program files\autoit3\scite\koda\forms\marcdk's profile viewer.kxf

$Form1_1 = GUICreate("Marcdk's Profile Viewer", 377, 185, 193, 125)

$Label1 = GUICtrlCreateLabel("Insert the username into the textfield, and select the correct realm. ", 8, 40, 351, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

GUICtrlCreateInput("", 16, 96, 217, 21)

$Label2 = GUICtrlCreateLabel("Account name:", 80, 72, 78, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

$Button1 = GUICtrlCreateButton("Check player profile", 248, 64, 115, 33, 0)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

$Label3 = GUICtrlCreateLabel("Realm:", 288, 104, 37, 19)

GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")

$Combo1 = GUICtrlCreateCombo("", 272, 128, 73, 25)

GUICtrlSetData(-1, "Northrend|Lordaeron|Azeroth|Kalimdor")

$Pic1 = GUICtrlCreatePic("C:\Users\Marc\Desktop\Grafik.jpg", 0, 0, 377, 193, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Oh, and btw, i did not understand anything of the picture UDF thing. The thread is so long that i don't bother reading all of it, could you explain it in a very noob way? I'm not so good at learning new things i guess..

I hope someone can explain this in a way so even the biggest noob (me) can understand it xD

Thanks!

Link to comment
Share on other sites

You seem to be very lazy!!

Despite of that here is something for you:

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, grafik.jpg, rcdata, JPG_1, 0
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "resources.au3"

$Form1_1 = GUICreate("Marcdk's Profile Viewer", 377, 185, 193, 125)
$Label1 = GUICtrlCreateLabel("Insert the username into the textfield, and select the correct realm. ", 8, 40, 351, 19)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$input1 = GUICtrlCreateInput("", 16, 96, 217, 21)
$Label2 = GUICtrlCreateLabel("Account name:", 80, 72, 78, 19)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Button1 = GUICtrlCreateButton("Check player profile", 248, 64, 115, 33, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Label3 = GUICtrlCreateLabel("Realm:", 288, 104, 37, 19)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Combo1 = GUICtrlCreateCombo("", 272, 128, 73, 25)
GUICtrlSetData(-1, "Northrend|Lordaeron|Azeroth|Kalimdor")
$Pic1 = GUICtrlCreatePic("", 0, 0, 377, 193, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState($Pic1, $GUI_DISABLE)
_ResourceSetImageToCtrl($Pic1, "JPG_1")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(0,'Button1 pressed', _
            'data from input: ' & GUICtrlRead($input1) & @CRLF & _
            'data from combo: ' & GUICtrlRead($Combo1) )
    EndSwitch
WEnd
Edited by Zedna
Link to comment
Share on other sites

You seem to be very lazy!!

Despite of that here is something for you:

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, grafik.jpg, rcdata, JPG_1, 0
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "resources.au3"

$Form1_1 = GUICreate("Marcdk's Profile Viewer", 377, 185, 193, 125)
$Label1 = GUICtrlCreateLabel("Insert the username into the textfield, and select the correct realm. ", 8, 40, 351, 19)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$input1 = GUICtrlCreateInput("", 16, 96, 217, 21)
$Label2 = GUICtrlCreateLabel("Account name:", 80, 72, 78, 19)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Button1 = GUICtrlCreateButton("Check player profile", 248, 64, 115, 33, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Label3 = GUICtrlCreateLabel("Realm:", 288, 104, 37, 19)
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Combo1 = GUICtrlCreateCombo("", 272, 128, 73, 25)
GUICtrlSetData(-1, "Northrend|Lordaeron|Azeroth|Kalimdor")
$Pic1 = GUICtrlCreatePic("", 0, 0, 377, 193, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState($Pic1, $GUI_DISABLE)
_ResourceSetImageToCtrl($Pic1, "JPG_1")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(0,'Button1 pressed', _
            'data from input: ' & GUICtrlRead($input1) & @CRLF & _
            'data from combo: ' & GUICtrlRead($Combo1) )
    EndSwitch
WEnd
Thanks a lot, but when i can't compile the script... why? It gives an error with _ResourceSetImageToCtrl

Try to compile it yourself and see :P

Link to comment
Share on other sites

You maybe don't got the UDF?..

I don't even get what the Udf is, is it a program? Sorry, i feel so stupid and nooby, hope it doesn't bother you. I'm just in a little hurry of doing this tool. Once i'm finished i can learn from my script. The only things i have problems with right now is the functions, and the return values. If anyone can find some resourcces for me, it would be greatly apreciated (and don't say "look in the helpfile!" xD)

Thanks :P

Link to comment
Share on other sites

Thanks a lot, but when i can't compile the script... why? It gives an error with _ResourceSetImageToCtrl

Try to compile it yourself and see :P

You must download my resource UDF from my post you didn't bother to read!!

#include "resources.au3"

File resources.au3 must be in script directory at compile time and also JPG image.

Link to comment
Share on other sites

When somebody say something like that:

then I usualy stop helping such people.

I am searching tutorials explaining the functions, you can't learn autoit by reading every single thing in the help file..

I've been searching google, but the tutorials i found isn't big enough, they isn't explaining anything else than the macro scripts, which i've allready learned.

Sorry, for my lazyness on some parts of this. I might seem like a stupid kid trying to learn this in a stupid way, but this is how i want to learn it. Tutorials and example scripts. the helpfile is too messy, and doesn't explain it in a way i understand (my english understanding isn't the best)

Link to comment
Share on other sites

I am searching tutorials explaining the functions, you can't learn autoit by reading every single thing in the help file..

I've been searching google, but the tutorials i found isn't big enough, they isn't explaining anything else than the macro scripts, which i've allready learned.

Sorry, for my lazyness on some parts of this. I might seem like a stupid kid trying to learn this in a stupid way, but this is how i want to learn it. Tutorials and example scripts. the helpfile is too messy, and doesn't explain it in a way i understand (my english understanding isn't the best)

I learned that way..

the helpfile has exmples!!

I guess you are the kind of people who wants everyone to make the job for you.

Link to comment
Share on other sites

  • 2 weeks later...

I finally finished my bot, but i don't get the udf part, i downloaded the resources.au3 and placed it in the same folder as my real source and my picture (a jpeg image) also i included resources.au3 in my script. But when i compile it to an exe it doesn't safe the picture into the exe.. why?

The udf thread is a bit messy, i don't understand it fully, can anyone explain it step by step?

Thanks :mellow:

Edited by Marcdk
Link to comment
Share on other sites

I finally finished my bot, but i don't get the udf part, i downloaded the resources.au3 and placed it in the same folder as my real source and my picture (a jpeg image) also i included resources.au3 in my script. But when i compile it to an exe it doesn't safe the picture into the exe.. why?

The udf thread is a bit messy, i don't understand it fully, can anyone explain it step by step?

Thanks :mellow:

No step by step.

Just look at ResHacker.exe and upx.exe.

These two files must be in "Windows search path" or in script directory at compile rime.

This is written in my UDF post too.

Link to comment
Share on other sites

I finally finished my bot, but i don't get the udf part, i downloaded the resources.au3 and placed it in the same folder as my real source and my picture (a jpeg image) also i included resources.au3 in my script. But when i compile it to an exe it doesn't safe the picture into the exe.. why?

The udf thread is a bit messy, i don't understand it fully, can anyone explain it step by step?

Thanks :mellow:

You can also look at using FileInstall() for your .jpg. Use this function and point it at the full path of the .jpg on YOUR computer, tell it to copy it at runtime into @ScriptDir, then wherever in your script you refer to the path to the picture, use @ScriptDir&"\filename.jpg", replacing filename.jpg with your actual file name. Then compile your script. As it's compiling, the .jpg file pointed to in the FileInstall() function will get bundled into the .exe, then when the .exe is run, it will copy the bundled .jpg into the same directory as the .exe is being run from.

Hope that makes sense. :(

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

I've been reading the hole thread about udf, makes NO sense to me -.- I can't find the udf.exe, and i don't understand what i have to do. This is hopeless, going to ask a friend, he might be more helpfull, sorry for "bithcing" around, but i really hate when i don't understand something and people just say.. "Just read it"

Link to comment
Share on other sites

I've been reading the hole thread about udf, makes NO sense to me -.- I can't find the udf.exe, and i don't understand what i have to do. This is hopeless, going to ask a friend, he might be more helpfull, sorry for "bithcing" around, but i really hate when i don't understand something and people just say.. "Just read it"

There is no UDF.exe :-)

UDF = User Defined Function --> general word for any function which user writes as non-AutoIt-native function.

Edited by Zedna
Link to comment
Share on other sites

There is no UDF.exe :-)

UDF = User Defined Function --> general word for any function which user writes as non-AutoIt-native function.

Could you explain me what i have to do if i want to have a Jpeg picture saved into my exe? I'm so lost, tried to add the following line at top of the script: #include "resources.au3"

And then i placed the resources.au3 in same directory as the jpeg picture and my source code. I compiled, but did not work. PLEASE give me some help. I beg you :mellow:

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