Register for your free account! | Forgot your password?

You last visited: Today at 12:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



AutoIt

Discussion on AutoIt within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
FizzeBu's Avatar
 
elite*gold: 6
Join Date: Mar 2010
Posts: 12,387
Received Thanks: 2,115
AutoIt

Hallo,

ich habe mehrere Bilder mit der gleichen Größe übereinander gelegt. Ich habe sie alle unsichtbar gemacht. Mit Random geb ich einer Variablen eine Zahl. Wenn die Zahl 1 ist, soll das erste Bild sichtbar werden, bei 2 das Zweite...
Ich habs schon mit einigen befehlen probiert, hat aber nie geklappt. Ich will eigentlich nur wissen welchen Befehl man benutzen muss.

Danke schonmal

FizzeBu
FizzeBu is offline  
Old 09/21/2010, 21:04   #2
 
elite*gold: 0
Join Date: Jul 2009
Posts: 2,241
Received Thanks: 848
$GUI_SHOW oô

Code:
$pic1 = GuiCtrlCreatePic(...)
GuiCtrlSetState(-1,$GUI_HIDE)
$pic2 = GuiCtrlCreatePic(...)
GuiCtrlSetState(-1,$GUI_HIDE)
$pic3 = GuiCtrlCreatePic(...)
GuiCtrlSetState(-1,$GUI_HIDE)

$select = Random(1,3,1)

If $select = 1 Then
GuiCtrlSetState($pic1,$GUI_SHOW+$GUI_ONTOP)
ElseIf $select = 2 Then
GuiCtrlSetState($pic2,$GUI_SHOW+$GUI_ONTOP)
ElseIf $select = 3 Then
GuiCtrlSetState($pic3,$GUI_SHOW+$GUI_ONTOP)
EndIf
Probiers mal, hab iMo kein AutoIt zur Verfügung xD
mipez is offline  
Thanks
1 User
Old 09/21/2010, 21:12   #3
 
FizzeBu's Avatar
 
elite*gold: 6
Join Date: Mar 2010
Posts: 12,387
Received Thanks: 2,115
nee hab ich schon probiert... ich hab keeinie ahnung was ich falsch mach ich posts hier mal:
Quote:
$background = Random (1,9)

If $background = 1 Then
GuiCtrlSetState($Pic1,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 2 Then
GuiCtrlSetState($Pic2,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 3 Then
GuiCtrlSetState($Pic3,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 4 Then
GuiCtrlSetState($Pic4,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 5 Then
GuiCtrlSetState($Pic5,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 6 Then
GuiCtrlSetState($Pic6,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 7 Then
GuiCtrlSetState($Pic7,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 8 Then
GuiCtrlSetState($Pic8,$GUI_SHOW+$GUI_ONTOP)
ElseIf $background = 9 Then
GuiCtrlSetState($Pic9,$GUI_SHOW+$GUI_ONTOP)
EndIf
FizzeBu is offline  
Old 09/21/2010, 22:17   #4
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
wenn das mit gui commands nich funzt dann auf jeden fall mit control commands.

angenommen du hast bilder die zb so beannt sind: 0.jpg, 1.jpg, 2.jpg, ..., 7.jpg

daraus könnte man dann diesen code bauen:
Code:
$gui = GUICreate("gui")
$size = WinGetPos($gui)
Dim $pic[8], $old
For $i=0 To 7
	$pic[$i] = GUICtrlCreatePic($i&".jpg", 0, 0, $size[2]-6, $size[3]-100)
	ControlHide($gui, '', $pic[$i])
Next
$btn = GUICtrlCreateButton("blah", 0, $size[3]-100, $size[2]-6, 68)
GUISetState()

While 1
	Switch GUIGetMsg()
		Case -3
			ExitLoop
		Case $btn
			For $i=0 To 7
				If ControlCommand($gui, '', $pic[$i], "IsVisible", "") Then 
					ControlHide($gui, '', $pic[$i])
					$old = $i
				EndIf
			Next
			Do
				$new = Random(0,7)
			Until $new<> $old
			ControlShow($gui, '', $pic[$new])
			ControlShow($gui, '', $btn)
	EndSwitch
WEnd
so wird auf button druck jedes mal ein anderer hintergrund aufgebaut, als der der gerade aktiv ist.
lolkop is offline  
Thanks
1 User
Old 09/22/2010, 14:41   #5
 
FizzeBu's Avatar
 
elite*gold: 6
Join Date: Mar 2010
Posts: 12,387
Received Thanks: 2,115
joo danke, habs hingekriegt
lag nicht an dem befehl, sondern am random befehl
trozdem danke an alle
FizzeBu is offline  
Reply




All times are GMT +2. The time now is 12:28.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.