Jump to content
Sign in to follow this  
hanzz

GUICtrlread

Recommended Posts

hanzz

I made a question over here.

meanwhile, I wanted to start on trying to figure it out. How do I read the different settings from combo's or radiobuttons and inputfields?

I think I need to have GUICtrlread,or do I need variables to pour it into a path, to open the files?

I have a year, a month, and a number, wich should lead me to a JPG-file,that needs to be opened.

Share this post


Link to post
Share on other sites
SmOke_N

Case $msg = $Search
        $YearRead = GUICtrlRead($year)
        $MonthRead = GUICtrlRead($month)
       ;whatever you do here to run for the year and month jpg


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Valuater

heres an effort

#include <GUIConstants.au3>
; == GUI generated with Koda ==

Dim $Radio[7], $Radios = 6
$Form1 = GUICreate("zoekgereedschap", 320, 291, 192, 125)
GUICtrlCreateLabel("JAAR", 40, 24, 31, 17)
$Radio[1] = GUICtrlCreateRadio("2005", 32, 48, 65, 17)
$Radio[2] = GUICtrlCreateRadio("2006", 32, 72, 65, 17)
$Radio[3] = GUICtrlCreateRadio("2007", 32, 96, 65, 17)
$Radio[4] = GUICtrlCreateRadio("2008", 32, 120, 65, 17)
$Radio[5] = GUICtrlCreateRadio("2009", 32, 144, 65, 17)
$Radio[6] = GUICtrlCreateRadio("2010", 32, 168, 65, 17)
GUICtrlCreateLabel("MAAND", 112, 24, 43, 17)
$List1 = GUICtrlCreateList("", 112, 48, 49, 84)
GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12")
GUICtrlCreateLabel("Gemaakt door Hans Deconinck", 40, 0, 159, 17)
GUICtrlSetColor(-1, 0xC0C0C0)
$Input1 = GUICtrlCreateInput("", 176, 48, 121, 21)
GUICtrlCreateLabel("BTW-Nummer", 176, 24, 71, 17)
$Button1 = GUICtrlCreateButton("ZOEK !", 120, 224, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        Read_Data()
;;;;;;;
    EndSelect
WEnd
Exit

; --------------------- Functions ------------------

Func Read_Data()
    $Year = StringSplit("2005,2006,2007,2008,2009,2010", ",")
    For $x = 1 To $Radios
        If BitAnd(GUICtrlRead($Radio[$x]),$GUI_CHECKED) = $GUI_CHECKED Then
            $year = $Year[$x]
            $Month = GUICtrlRead($List1)
            $File = GUICtrlRead($Input1)
            MsgBox(64, "Your info is", "Year " & $year & @CRLF & "Month " & $Month & @CRLF & "File " & $File )
        EndIf
    Next
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
SmOke_N

heres an effort

:geek: Bash! :o

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Valuater

:geek: Bash! :o

that was his file in the other post that nobody responded to

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
hanzz

Thanks Valuater!

It was really what I needed.After a few hours tweaking( i'm a newbie! :"> ) I could make it a working exe file.

Works even faster than I expected.

#include <GUIConstants.au3>
; == GUI generated with Koda ==

Dim $Radio[7], $Radios = 6
$Form1 = GUICreate("zoekgereedschap", 320, 291, 192, 125)
GUICtrlCreateLabel("JAAR", 40, 24, 31, 17)
$Radio[1] = GUICtrlCreateRadio("2005", 32, 48, 65, 17)
$Radio[2] = GUICtrlCreateRadio("2006", 32, 72, 65, 17)
$Radio[3] = GUICtrlCreateRadio("2007", 32, 96, 65, 17)
$Radio[4] = GUICtrlCreateRadio("2008", 32, 120, 65, 17)
$Radio[5] = GUICtrlCreateRadio("2009", 32, 144, 65, 17)
$Radio[6] = GUICtrlCreateRadio("2010", 32, 168, 65, 17)
GUICtrlCreateLabel("MAAND", 112, 24, 43, 17)
$List1 = GUICtrlCreateList("", 112, 48, 49, 84)
GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12")
GUICtrlCreateLabel("Gemaakt door Hans Deconinck", 40, 0, 159, 17)
GUICtrlSetColor(-1, 0xC0C0C0)
$Input1 = GUICtrlCreateInput("", 176, 48, 121, 21)
GUICtrlCreateLabel("BTW-Nummer", 176, 24, 71, 17)
$Button1 = GUICtrlCreateButton("ZOEK !", 120, 224, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        Read_Data()
;;;;;;;
    EndSelect
WEnd
Exit

; --------------------- Functions ------------------

Func Read_Data()
    $Year = StringSplit("2005,2006,2007,2008,2009,2010", ",")
    For $x = 1 To $Radios
        If BitAnd(GUICtrlRead($Radio[$x]),$GUI_CHECKED) = $GUI_CHECKED Then
            $year = $Year[$x]
            $Month = GUICtrlRead($List1)
            $File = GUICtrlRead($Input1)
            MsgBox(64, "klopt dit?", "Jaar " & $year & @CRLF & "Maand " & $Month & @CRLF & "nummer " & $File )
            Run("C:\Program Files\Internet Explorer\iexplore.exe")

Sleep(500)
Send("{CAPSLOCK off}")
Send("!d")
;Nu enkel nog de manier vinden om het juiste pad samen te stellen
Send("G:\INTRANET02\SCANS\kaartenbackup\")
send($year)
send("\")
send($year)
send("_")
send($Month)
Send(".html")
Send("{enter}")
sleep(1000)
;zoeken
Send("^f") 
send($File)
Send("{enter}")
Send("{ESC}")
Send("{TAB}")
Send("{enter}")
        EndIf
    
    Next
EndFunc

Thanks again.

Edited by hanzz

Share this post


Link to post
Share on other sites
Valuater

Welcome..

did you get everything... you wanted it to do??

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
hanzz

Yes , it does, I did make a little "detour" .

The actual files are stored by day, :o and I have a html page combining them together in a month-review.

So I made it first open the explorer,and the make a path to where the hyperlinks in a "month-html page"are . Have a search there and then open the file.

Once I figure out how to directly open a picture file , or make it search in subfolders, I will change it again.But for now, it does the trick as needed.

Share this post


Link to post
Share on other sites
hanzz

This program is really making a huge difference !

But now I'm facing a little problem.I was doing the search via internet explorer, where we had all scans stored month by month(html page with hyperlinks).

Actually they are stored day by day/month.That was no problem, because of the detour I made.

Now the html pages will be closed down.

So I had to think of a new wayto do this .I made a calendar,to choose year/month/day at once,and an inputfield to write the name.

Folowing is an example to the path.

"G:\sanitel\2006_03\0103\246200.jpg"

= g:\sanitel\year_month\day+month\file.jpg

would this be possible?Or do I need to stick with the previous design,and add a days radiobutton?

nclude <GUIConstants.au3

; == GUI generated with Koda ==);

$Form1 = GUICreate("AForm1", 289, 224, 192, 125)

;kalender

$Date1 = GUICtrlCreateDate("2006/03/07 10:37:40", 48, 32, 177, 25)

GUICtrlCreateLabel("Kies Datum", 48, 16, 58, 17)

;invulvak voor datum

$Input1 = GUICtrlCreateInput("", 48, 96, 177, 21)

GUICtrlCreateLabel("Kies BTW-Nummer", 48, 72, 94, 17)

;zoek knop

$Button1 = GUICtrlCreateButton("ZOEK", 48, 144, 177, 25)

GUICtrlCreateLabel("Hans Deconinck", 48, 192, 84, 17)

GUICtrlSetColor(-1, 0xD4D0C8)

;;programma zelf.

GUISetState(@SW_SHOW)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;;;;;

EndSelect

WEnd

Share this post


Link to post
Share on other sites
CyberSlug

Maybe this? You will need to edit getMonthNumber if month names are not English:

#include <GUIConstants.au3>
; == GUI generated with Koda ==);

$Form1 = GUICreate("AForm1", 289, 224, 192, 125)

;kalender
$Date1 = GUICtrlCreateDate("2006/03/07 10:37:40", 48, 32, 197, 25)
GUICtrlCreateLabel("Kies Datum", 48, 16, 58, 17)
;invulvak voor datum
$Input1 = GUICtrlCreateInput("", 48, 96, 177, 21)
GUICtrlCreateLabel("Kies BTW-Nummer", 48, 72, 94, 17)

;zoek knop
$Button1 = GUICtrlCreateButton("ZOEK", 48, 144, 177, 25)
GUICtrlCreateLabel("Hans Deconinck", 48, 192, 84, 17)
GUICtrlSetColor(-1, 0xD4D0C8)

;;programma zelf.
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Date1
        GuiCtrlSetData($Input1,  filenameFromDate(GuiCtrlRead($Date1)) )
    
;;;;;;;
    EndSelect
WEnd

Func filenameFromDate($text)
    Local $i
    $text = StringSplit($text, ", ");split on space and comma
    
    Local $weekName = $text[1]
    Local $monthName = $text[3]
    Local $day = $text[4]
    Local $year = $text[6]
    
    Local $month = getMonthNumber($monthName)
    
    Return "g:\sanitel\" & $year & "_" & $month & "\" & $day & $month & "\file.jpg"
EndFunc

Func getMonthNumber($monthName)
    $months = StringSplit("January,February,March,April,May,June,July,August,September,October,November,December",",")
    For $i = 1 to 12
        If $months[$i] = $monthName Then Return StringFormat ("%02u", $i);pad with leading zero if necessary
    Next
    Return "??"
EndFunc

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
hanzz

THanks for the quick response.

I needed indeed to change thte monthnames into dutch.But on cliking in the calendar, I immediatly got this in the outputwindow.

>"D:\Program Files\AutoIt3\autoit3.exe" /ErrorStdOut "D:\Documents and Settings\Hans\Mijn documenten\autoIt\zoeker2.au3"

D:\Documents and Settings\Hans\Mijn documenten\autoIt\zoeker2.au3 (39) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Local $year = $text[6]Local $year = ^ ERROR

D:\Documents and Settings\Hans\Mijn documenten\autoIt\zoeker2.au3 (39) : ==> Error in expression.:

Local $year = $text[6]

Local $year = ^ ERROR

>Exit code: 0 Time: 5.548

Share this post


Link to post
Share on other sites
CyberSlug

I might have wrong assumptions with StringSplit.

Please replace the filenameFromDate function with:

Func filenameFromDate($text)
return $text
EndFunc

Then, when I click a date, I get something like this in the textbox:

Tuesday, March 07, 2006

So that is:

TEXT comma space TEXT space TEXT comma space TEXT

Does Dutch use a period instead of a comma seperator?

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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  

×