kalya Posted February 15, 2009 Posted February 15, 2009 hello , My problem is : I must create a GUI where to put 2 folders with pictures and I want to randomly mix and displaying them on screen
Manjish Posted February 15, 2009 Posted February 15, 2009 (edited) use GuiCreate and GUICtrlCreatePic..Or simply use KODA Edited February 15, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
BrettF Posted February 15, 2009 Posted February 15, 2009 Welcome the forum Kalya.I imagine you are new, so have a look at my tutorial and AutoIt 1-2-3. The links for both are in my signature.Steps to achieve this are:1. Create your GUI using Koda. It is in the full version of scite. Link again is in signature.2. After you display the GUI, use _FileListToArray() and a function to concentrate the 2 arrays with the full paths. Basically get the size of the 2 arrays, create a new array and set the data of the new array using for loops. If you need some help with this, have a go first. Then we can help put you back on track 3. Use something like $array[Random(0,Ubound($array),1)] to get the file path randomly, and use GUICtrlSetImage to set the image.3. Your done!I took this as you wanted to display 2 images from a folder in 2 picture controls. If it was different then you have learnt something- always post your full question, with as much detail as possible, and with code too!Cheers,Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
kalya Posted February 15, 2009 Author Posted February 15, 2009 Welcome the forum Kalya. I imagine you are new, so have a look at my tutorial and AutoIt 1-2-3. The links for both are in my signature. Steps to achieve this are: 1. Create your GUI using Koda. It is in the full version of scite. Link again is in signature. 2. After you display the GUI, use _FileListToArray() and a function to concentrate the 2 arrays with the full paths. Basically get the size of the 2 arrays, create a new array and set the data of the new array using for loops. If you need some help with this, have a go first. Then we can help put you back on track 3. Use something like $array[Random(0,Ubound($array),1)] to get the file path randomly, and use GUICtrlSetImage to set the image. 3. Your done! I took this as you wanted to display 2 images from a folder in 2 picture controls. If it was different then you have learnt something- always post your full question, with as much detail as possible, and with code too! Cheers, Brett Thank you for help .You make a great job I try to do that and if i have any questions i post it here
BrettF Posted February 16, 2009 Posted February 16, 2009 Hi there. Please do not PM me requesting help. You have a wonderful forum here with many people, so use it! In response to your PM: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form1", 801, 601, 225, 14) $Button1 = GUICtrlCreateButton("Button1", 48, 528, 177, 49, $WS_GROUP) GUICtrlSetBkColor(-1, 0xFF0000) $Button2 = GUICtrlCreateButton("Button2", 256, 528, 161, 49, $WS_GROUP) GUICtrlSetBkColor(-1, 0x0054E3) $Button3 = GUICtrlCreateButton("Button3", 448, 528, 169, 49, $WS_GROUP) GUICtrlSetBkColor(-1, 0x00FF00) $User = GUICtrlCreateLabel("User", 696, 32, 26, 17) $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\lungu\Desktop\14.08.28.jpeg", 8, 8, 673, 505, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Progress1 = GUICtrlCreateProgress(632, 560, 161, 17) GUICtrlSetBkColor(-1, 0xC0C0C0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd something like this but ... 1) I must add more images (2 folder) in the same place like my example 2) must view a name under de User Name will be introducing befor run the program 3) 4) if you can pls help mePlease follow the steps I have outlined. You have done step 1, now do the rest. I'm feeling very generous so here is some code that you can use to get pictures from different folders. #include <Array.au3> Global $aFiles[1] _FileGetInFolders(@MyDocumentsDir & "\My Pictures", "JPG|JPEG|BMP", $aFiles) _FileGetInFolders(@MyDocumentsDir & "\My Pictures\thundercats", "JPG|JPEG|BMP", $aFiles) _ArrayDisplay ($aFiles) Func _FileGetInFolders ($folder, $type, ByRef $array) $count = UBound ($array) -1 $hFirst = FileFindFirstFile ($folder & "\*.*") While 1 $hFile = FileFindNextFile ($hFirst) If @error Then ExitLoop If StringRegExp ($hFile, "(?i)^.+\.(" & $type & ")") Then $count += 1 ReDim $array[$count + 1] $array[$count] = $folder & "\" & $hFile EndIf WEnd $array[0] = $count EndFunc Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now