Bilder anzeigen über DropdownList

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

nacken012
Posts: 90
Joined: 22 Jul 2016, 14:39

Bilder anzeigen über DropdownList

18 Sep 2019, 07:10

Hallo, habe mal wieder eine kleine Frage

Habe vor ein kleines Hilfe Programm zu erstellen für ein Spiel und wollte über eine DropDownList die Bilder auswählen
lassen und dann per Klick auf dem Button "GO" das Bild anzeigen lassen.

Es klappt aber nicht ganz so wie ich möchte, man muss 2 x den GO Button drücken damit ein anderes Bild angezeigt wird, wenn vorher
schon 1 Bild angezeigt wurde.

Es klappt nur, wenn ich die Zeile:
Gui, Add, Picture, x0 y45, Bilder/%Material%.jpg
2 x ausführen lasse

Wo liegt hier mein Gedanken Fehler oder wie kann man es schöner machen ?

Code: Select all

#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
FileCreateDir, Bilder

Gui, 1: Add, Text, x20 y20, Welches Material soll ich anzeigen ?
Gui, 1: Add, DropDownList, x200 y17 h220 w200 vMaterial, Amphore|Aqualith|Band|Batist|Alter Leuchtturm
Gui, 1: Add, Button, x420 y16 ggo, GO

Gui, 1: Show, w714 h757, Knights & Brides Hilfe © by Sonja | Version 1.0

return

go:

Gui, 1: submit ,nohide

If Material = Amphore
UrlDownloadToFile, https://abload.de/img/amphore4gkdw.jpg, Bilder\Amphore.jpg
If Material = Aqualith
UrlDownloadToFile, https://abload.de/img/aqualith9gjh7.jpg, Bilder\Aqualith.jpg
Gui, Add, Picture, x0 y45, Bilder/%Material%.jpg
;Gui, Add, Picture, x0 y45, Bilder/%Material%.jpg ; funktioniert nur wenn ich diese Zeile auch ausführe

return




guiclose:
FileRemoveDir, Bilder, 1
exitapp

F8::
ExitApp
lg Horst
garry
Posts: 3763
Joined: 22 Dec 2013, 12:50

Re: Bilder anzeigen über DropdownList

18 Sep 2019, 09:28

weiss auch nicht warum man 2-mal klicken muss
Dies scheint zu funktionieren

Code: Select all

#Warn
#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode,Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir,%A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines,-1
Gui,1:default
Gui,1: -DPIScale
Gui,1: +HwndAId  +0x2000000

fd=%a_scriptdir%\Bilder
ifnotexist,%fd%
{
FileCreateDir,%fd%
UrlDownloadToFile, https://abload.de/img/amphore4gkdw.jpg,%fd%\Amphore.jpg
UrlDownloadToFile, https://abload.de/img/aqualith9gjh7.jpg,%fd%\Aqualith.jpg
}

Gui, 1: Color,Black,Black
Gui, 1: Add, Text, x20 y20 cYellow, Welches Material soll ich anzeigen ?
Gui, 1: Add, DropDownList, x400 y17 h220 w200 vMaterial, Amphore|Aqualith|Band|Batist|Alter Leuchtturm
Gui, 1: Add, Button, x620 y16 gGo, GO
Gui, 1: Show,x500 y10 w1000 h900, Knights & Brides Hilfe © by Sonja | Version 1.0
return
;------------------------
Guiclose:
;FileRemoveDir,%fd%, 1
exitapp
;------------------------
F8::
ExitApp
;------------------------
GO:
Gui,1:submit,nohide
Gui,2: -DPIScale
Gui,2: Color,Black,Black
Gui,2: +HwndBId  +AlwaysOnTop -Caption -Border
Gui,2: Margin, 0, 0
Gui,2:Add, Picture, x0 y0,%fd%\%material%.jpg
Gui,2:Show,x50 y70 ,Test2
Gui,2:+Parent%AId%
return
;=========================================
Last edited by garry on 18 Sep 2019, 10:57, edited 1 time in total.
nacken012
Posts: 90
Joined: 22 Jul 2016, 14:39

Re: Bilder anzeigen über DropdownList

18 Sep 2019, 10:15

Ja echt komisch.....

Deins Funktioniert perfekt, vielen vielen Dank
Ahk_fan
Posts: 237
Joined: 31 Aug 2018, 14:34
Contact:

Re: Bilder anzeigen über DropdownList

18 Sep 2019, 13:45

Hi,
so gehts:

Code: Select all

#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
FileCreateDir, Bilder

Gui, 1: Add, Text, x20 y20, Welches Material soll ich anzeigen ?
Gui, 1: Add, DropDownList, x200 y17 h220 w200 vMaterial gGo, Amphore|Aqualith|Band|Batist|Alter Leuchtturm
;Gui, 1: Add, Button, x420 y16 ggo, GO
Gui, 1: Add, Picture, x0 y45 h721 w713 vBild 
Gui, 1: Show, w714 h757, Knights & Brides Hilfe © by Sonja | Version 1.0

return

go:
Gui, 1: submit ,nohide

If Material = Amphore
{
	SplashTextOn , 400, 100, Meldung, Bild am laden
	UrlDownloadToFile, https://abload.de/img/amphore4gkdw.jpg, Bilder\Amphore.jpg
	While !FileExist("Bilder\Amphore.jpg")
	{
		SplashTextOn , 400, 100, Meldung, Bild am laden
		Sleep, 200
	}
}
If Material = Aqualith
{
	SplashTextOn , 400, 100, Meldung, Bild am laden
	UrlDownloadToFile, https://abload.de/img/aqualith9gjh7.jpg, Bilder\Aqualith.jpg
	While !FileExist("Bilder\Aqualith.jpg")
	{
		Sleep, 200
	}
}
SplashTextOff
GuiControl, ,Bild, Bilder/%Material%.jpg
;Gui, Add, Picture, x0 y45, Bilder/%Material%.jpg ; funktioniert nur wenn ich diese Zeile auch ausführe

return




guiclose:
FileRemoveDir, Bilder, 1
exitapp

F8::
ExitApp
mit GuiControl ...
So must du auch kein GO-Button klicken,einfach auswählen
regards,
AHK_fan :)
https://hr-anwendungen.de
garry
Posts: 3763
Joined: 22 Dec 2013, 12:50

Re: Bilder anzeigen über DropdownList

18 Sep 2019, 15:03

danke Ahk_fan , ist einfacher ohne GO-button ( und mit Guicontrol )
nacken012
Posts: 90
Joined: 22 Jul 2016, 14:39

Re: Bilder anzeigen über DropdownList

18 Sep 2019, 20:56

Vielen Dank, sehr schön gemacht, da kann ich ja gleich mal weiter stricken :-)

Danke

Return to “Ich brauche Hilfe”

Who is online

Users browsing this forum: 355 113 and 55 guests