Sign in to follow this  
Followers 0
kalya

need help

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

use GuiCreate and GUICtrlCreatePic..

Or simply use KODA

Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 me

Please 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

Share this post


Link to post
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
Sign in to follow this  
Followers 0