Reyzor

Mouth on InputBox Edit

12 posts in this topic

#1 ·  Posted (edited)

Hello Guys,

 

Im new on Autoit and i need help.

My english is not good but i will try to explain what i pretend.

 

In a Inputbox i pretend a Date! Like this:  12 September 2015.        But show me this: 12 09 2015.   I want in a Portuguese Language too.

I use this:

$TribunalLabel = GUICtrlCreateLabel("Tribunal da Comarca de Lisboa Norte", 8, 232, 301, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Dia = GUICtrlCreateLabel("Dia", 8, 256, 31, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$DiadeTribunal = GUICtrlCreateInput((@MDAY+1 & "-" & @MON & "-" &@YEAR), 72, 256, 241, 21)  

 

finally the best, if someone can help me to make this: Saturday, 12 September 2015.

 

 

thanks very much!

 

 

Full text autoit:

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\reyz\desktop\autoit\novo detenção.kxf
$DN = GUICreate("DN", 498, 286, 272, 179)

 

;NIP
$NIP = GUICtrlCreateLabel("NIP", 48, 8, 33, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$NipSistema = GUICtrlCreateInput("NIP", 96, 8, 73, 21)

 

;Nome
$Nome = GUICtrlCreateLabel("Nome", 8, 32, 50, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$NSuspeito = GUICtrlCreateInput("Nome", 72, 32, 417, 21)

;DN mitra
$DN = GUICtrlCreateLabel("DN", 8, 56, 29, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$DataNascimento = GUICtrlCreateInput("DN", 72, 56, 97, 21)

;BI
$BICC = GUICtrlCreateLabel("BI/CC", 8, 80, 51, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$CartaoCidadao = GUICtrlCreateInput("BI", 72, 80, 97, 21)

;Morada
$Moradas = GUICtrlCreateLabel("Morada", 8, 176, 64, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Morada = GUICtrlCreateInput("Morada", 72, 176, 417, 21)


;Nº Porta
$Numero = GUICtrlCreateLabel("Nº", 8, 200, 23, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$NPorta = GUICtrlCreateInput("nPorta", 72, 200, 73, 21)


;Localidade de residencia
$Localidade = GUICtrlCreateInput("LocaldeMorada", 264, 200, 113, 21)
$Local = GUICtrlCreateLabel("Localidade", 168, 200, 91, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

;Naturalidade
$Natural = GUICtrlCreateLabel("Natural", 8, 152, 62, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Naturalidade = GUICtrlCreateInput("Natural", 72, 152, 417, 21)

;Nome Pai
$Pai = GUICtrlCreateLabel("Pai", 8, 104, 29, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$NPai = GUICtrlCreateInput("Pai", 72, 104, 417, 21)

;Nome da mae
$Mae = GUICtrlCreateLabel("Mae", 8, 128, 38, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$NMae = GUICtrlCreateInput("Mae", 72, 128, 417, 21)

;Codigo Postal
$CP = GUICtrlCreateLabel("CP", 384, 200, 27, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$CodigoPostal = GUICtrlCreateInput("CP", 416, 200, 73, 21)


;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

;Dia de Tribunal
$TribunalLabel = GUICtrlCreateLabel("Tribunal da Comarca de Lisboa Norte", 8, 232, 301, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Dia = GUICtrlCreateLabel("Dia", 8, 256, 31, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$DiadeTribunal = GUICtrlCreateInput((@MDAY+1 & "-" & @MON & "-" &@YEAR), 72, 256, 241, 21)

;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

 

; Data Presente
$PData = GUICtrlCreateLabel("Data", 376, 232, 37, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$DataPresente = GUICtrlCreateInput((@MDAY & "-" & @MON & "-" &@YEAR), 416, 232, 73, 21, $ES_READONLY)

 


$Radio1 = GUICtrlCreateRadio("10H00", 320, 256, 73, 25)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Radio2 = GUICtrlCreateRadio("14H00", 400, 256, 81, 25)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

 

 

Edited by Reyzor
submit autoit text

Share this post


Link to post
Share on other sites



First of all welcome to autoit forums

may this code help you:

#include <Date.au3>

GUICreate("")
$TribunalLabel = GUICtrlCreateLabel("Tribunal da Comarca de Lisboa Norte", 8, 232, 301, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Dia = GUICtrlCreateLabel("Dia", 8, 256, 31, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$DiadeTribunal = GUICtrlCreateInput(_convertweek() &"," &(@MDAY + 1 & " " & _covertmonth(@MON) & " " & @YEAR), 72, 256, 241, 21)

GUISetState(@SW_SHOW)
Sleep(1000)

Func _convertweek($vr = @MDAY)
Return _DateDayOfWeek (_DateToDayOfWeek ( @YEAR, @MON, $vr ), 2 )
EndFunc

Func _covertmonth($var = @MON)
    Switch $var
        Case 1
            Return "January"

        Case 2
            Return "February"

        Case 3
            Return "March"

        Case 4
            Return "April"

        Case 5
            Return "May"

        Case 6
            Return "June"

        Case 7
            Return "July"

        Case 8
            Return "August"

        Case 9
            Return "September"

        Case 10
            Return "October"

        Case 11
            Return "November"

        Case 12
            Return "December"

    EndSwitch
EndFunc   ;==>_covert

 


No matter whatever the challenge maybe control on the outcome its on you its always have been.

MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)

Share this post


Link to post
Share on other sites

Yes it also does the job (Its Simple)

#include <Date.au3>

GUICreate("")
$TribunalLabel = GUICtrlCreateLabel("Tribunal da Comarca de Lisboa Norte", 8, 232, 301, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Dia = GUICtrlCreateLabel("Dia", 8, 256, 31, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$DiadeTribunal = GUICtrlCreateInput( _DateTimeFormat(_NowCalc(), 1),10,10,100)
GUISetState(@SW_SHOW)
Sleep(1000)

 


No matter whatever the challenge maybe control on the outcome its on you its always have been.

MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)

Share this post


Link to post
Share on other sites

But give me an error with a funcion.. :/

Share this post


Link to post
Share on other sites

is this version: v3.3.14.1

 

yes i tryied :s

Share this post


Link to post
Share on other sites

@reyzor, please dont say you have an error but always tell us the exact error you get and show the code you use! Only then we will be able to help. Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

please post the error:

 

Code more simplified here:

#include <Date.au3>

GUICreate("")
$TribunalLabel = GUICtrlCreateLabel("Tribunal da Comarca de Lisboa Norte", 8, 232, 301, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Dia = GUICtrlCreateLabel("Dia", 8, 256, 31, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")

$DiadeTribunal = GUICtrlCreateInput(_convertweek() &"," &(@MDAY + 1 & " " & _covertmonth(@MON) & " " & @YEAR), 72, 256, 241, 21)

GUISetState(@SW_SHOW)
Sleep(1000)

Func _convertweek($vr = @MDAY)
    $vrs = _DateToDayOfWeek ( @YEAR, @MON, $vr )
    Switch $vrs
        Case 1
            Return "Sunday"

        Case 2
            Return "Monday"

        Case 3
            Return "Tuesday"

        Case 4
            Return "Wednesday"

        Case 5
            Return "Thursday"

        Case 6
            Return "Friday"

        Case 7
            Return "Saturday"

    EndSwitch
EndFunc

Func _covertmonth($var = @MON)
    Switch $var
        Case 1
            Return "January"

        Case 2
            Return "February"

        Case 3
            Return "March"

        Case 4
            Return "April"

        Case 5
            Return "May"

        Case 6
            Return "June"

        Case 7
            Return "July"

        Case 8
            Return "August"

        Case 9
            Return "September"

        Case 10
            Return "October"

        Case 11
            Return "November"

        Case 12
            Return "December"

    EndSwitch
EndFunc   ;==>_covert

 


No matter whatever the challenge maybe control on the outcome its on you its always have been.

MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

 

this is the error guys :S

"C:\Users\Reyz\Desktop\autoit\cenas.au3"(85,48) : error: _DateToDayOfWeek(): undefined function.
    $vrs = _DateToDayOfWeek ( @YEAR, @MON, $vr )

 

23r4hgx.jpg

Edited by Reyzor

Share this post


Link to post
Share on other sites

Did you copy & run the whole script, making sure it had #include <Date.au3> at the top?

What value does $vr have? If it is not a number you may get an error.

Using a MsgBox to check on values in a variable is very helpful.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Guys, im so dumb!! i dont use the #include <Date.au3> at the top... damm lool

Thanks very much guys!!

 

But now i have another question :/ i want to do this:

Sunday, 01 of January 2015. (today)

In autoit scrit i need: Monday 02 Of January of 2015 (the day is correct in  my script except the name day and moth if is day 31)

More one day in relation of the present day, and jump Saturday and Sunday to Monday. 

 

is that possible?

i do that:

$DiadeTribunal = GUICtrlCreateInput(_convertweek() &"" & " de " & _covertmonth(@MON) & " " & @YEAR & " pelas, ", 72, 256, 241, 21)

GUISetState(@SW_SHOW)
Sleep(1000)

Func _convertweek($vr = @MDAY)
    $vrs = _DateToDayOfWeek ( @YEAR, @MON, $vr )
    Switch $vrs
        Case 1
            Return "Segunda-Feira" & "," & (@Mday +1 )

        Case 2
            Return "Segunda-Feira"

        Case 3
            Return "Terça-Feira"

        Case 4
            Return "Quarta-Feira"

        Case 5
            Return "Quinta-Feira"

        Case 6
             Return "Segunda-Feira" & "," & (@Mday +3 )

        Case 7
            Return "Segunda-Feira" & "," & (@Mday +2 )

    EndSwitch

Edited by Reyzor

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

  • Similar Content

    • akira2891
      By akira2891
      Hi,
      I was wondering is this all inputs can be done in 1 box with 3 fields and not to use another gui.
      And how can i validate data for example if i don't enter username he prompt me a message box all time until field is empty.
      I try like this but it give me a msgbox and continue on another field.
      $username = InputBox("Add new user", "Username", "", "", 200, 130, Default, Default, 0) if $username <> " " then msgbox(0, "", "Please enter username") endif $email = InputBox("Add new user", "Email", "", "", 200, 130, Default, Default, 0) $password = InputBox("Add new user", "Password", "", "*", 200, 130, Default, Default, 0)  
    • kneze
      By kneze
      Hi all,
      i would like to enter a vlaue to Inputbox 1 an press button1. Script should search value in a text file and put value after "; " to Inputbox 2.
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <file.au3> $Form1 = GUICreate("Form1", 257, 119, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 15, 35, 121, 21) $Input2 = GUICtrlCreateInput("Input2", 15, 60, 121, 21) $Button1 = GUICtrlCreateButton("Button1", 145, 35, 75, 25) GUISetState(@SW_SHOW) $iLines = _FileCountLines(@ScriptDir & "\data.txt") ;MsgBox(0, "Char read:", $ilines) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 EndSwitch WEnd can anyone help?
      data.txt
    • GeorgeB
      By GeorgeB
      I'm having trouble in making an input box where I can limit the characters that can be inputted.  Anybody have an idea how this can be done in Auto IT?
      Specifically I would like to create an input field where the user would enter a MAC address.  What I would like to do is to limit the characters that can be inputted to only HEX values (A-F and 0-9 as well as the - character).  This is so that the user cannot input invalid characters. The program is going to be used by very non-technical people, so the idea is to remove as many chances for errors that we can think of.  I would also prefer to limit the field to only 17 characters, so that there is only enough space to enter the MAC address with the - character as the separator.
      Thank you all in advance for any suggestions!
    • DavidFigueroa
      By DavidFigueroa
      I'm trying to create an inputbox that automatically formats numbers with leading zeroes when the updown control is used.  I found an example from Melba23 (see below) that shows a step incremented inputbox, and based on that, I tried to create one that would work, but it does not.
      I am creating separate inputs for hours and minutes, and I want to make sure the inputbox is always 2 digits. And right up front, I don't pretend to really understand the DLLStruct* calls.. 
      Melba23's sample:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <UpDownConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("5000", 10, 10, 100, 20) $hUpDown = GUICtrlCreateUpdown($hInput, BitOR($UDS_WRAP, $UDS_NOTHOUSANDS)) GUICtrlSetLimit($hUpDown, 6000, 5000) GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)     ; Is it from the UpDown?     If BitAND($wParam, 0xFFFF) = $hUpDown Then         ; Create NMUPDOWN structure         Local $tStruct = DllStructCreate("hwnd;long;int;long;long", $lParam)         ; Is it a change message?         If DllStructGetData($tStruct, 3) = 0xFFFFFD2E Then ; $UDN_DELTAPOS             ; Alter the change value             DllStructSetData($tStruct, 5, 100 * DllStructGetData($tStruct, 5))         EndIf     EndIf EndFunc ;~ The NMUPDOWN structure holds: ;~ 1 - Handle of UpDown ;~ 2 - ControlID of UpDown ;~ 3 - Message type sent by UpDown ;~ 4 - Current value of UpDown ;~ 5 - Change to apply to input (+/-1) And here is my non-working sample (it runs, and the initial value shows correctly, but when you hit the updown, you lose the leading zeroes.
      #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate("Window", 300, 100, -1, -1) $Count = 1 Global $hEdit = GUICtrlCreateInput($Count, 15, 15, 100, 30) GUICtrlSetFont(-1, 12, 400, "", "Tahoma") GUICtrlSetData(-1, StringFormat("%03u",$Count)) Global $hUpDown = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 100, 0) GUISetState() While 1     $hMsg = GUIGetMsg()     Switch $hMsg         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)     ; Is it from the UpDown?     If BitAND($wParam, 0xFFFF) = $hUpDown Then         ; Create NMUPDOWN structure         Local $tStruct = DllStructCreate("hwnd;long;int;long;long", $lParam)         ; Is it a change message?         If DllStructGetData($tStruct, 3) = 0xFFFFFD2E Then ; $UDN_DELTAPOS             ; Alter the change value             $ValueToSet = DllStructGetData($tStruct, 4)             $ValueToSet = StringFormat("%03u", $ValueToSet)             GUICtrlSetData($hEdit, $ValueToSet)         EndIf     EndIf EndFunc  
    • farhadrahman2
      By farhadrahman2
      hey guys, i have a problem .
      I want to search a file in a particular folder and after inserting the name  in the input box i want to make a drop down menu of all the matches and then select it and open it.
      I need the full code .
      so please anyone help me on this one.