Jump to content

ok, what am i missing here? button and input


pezo89
 Share

Recommended Posts

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#Include <Date.au3>
$sDate = _NowDate()
Opt('MustDeclareVars', 1)
Global $Paused
sleep ("1000")
HotKeySet("{Insert}", "TogglePause")
ToolTip ("Insert-Outlooksend",0,10,"outlooksend")






; example 1

Example()

Func Example()

    
    Local  $Input1, $Input2, $Button_1, 






    GUICreate("Test",400,100,-1,-1,-1) ; will create a dialog box that when displayed is centered
    GUISetState(@SW_SHOW) ; will display an empty dialog box

   $Input1 = GUICtrlCreateInput("",80,-1,-1,-1,-1,"m2")
    $Input2 = GUICtrlCreateInput("",80,25,-1,-1,-1,"m2")
    $Button_1 = GUICtrlCreateButton("Send", 80,45,80,-1)

     GUICtrlCreateLabel("Epostadresse = ", 0,0);<--Label
     GUICtrlCreateLabel("Stillingstype=", 0,25);<--Label


send ("{Insert}")



;;Scriptet _--------[b]Button starts from here, [/b]


WinActivate ("Inbox in pezo89@hotmail.com - Microsoft Outlook")
WinWaitActive ("Inbox in pezo89@hotmail.com - Microsoft Outlook")

Opt("MouseClickDelay", 400)      ;10 milliseconds
Opt("MouseClickDownDelay", 400)  ;10 milliseconds
Opt("MouseClickDragDelay", 250) ;250 milliseconds
Opt("SendKeyDelay", 5)          ;5 milliseconds
Opt("SendKeyDownDelay", 5)      ;1 millisecond


sleep (1000)
send ("^{n}")
sleep (1000)
send ($Input1)
sleep (1000)
send ("{Tab 2}")
sleep (1000)
Send ("Sender herved en søknad på den utlyste stillingen hos dere som")
Send ($Input2)


sleep (1000)
send ("{tab}")
send ("xxNicolai xx")
send ("{Enter}")
send ("xx7")
send ("{Enter}")
send ("xxOslo")
send ("{Enter}")
send ("Tlf: xxxx")
send ("{Enter}")
send ($sDate)









send ("{Enter}")

send ("{Enter}")

send ("{Enter}")
send ("Jeg viser til annonsen på xxx.no den ")
send ($sdate)
send (" og søker med dette den ledige stillingen som xxx hos dere.")
send ("{Enter}")

send ("{Enter}")
send ("Stillingen er interessant for meg av flere grunner.")
send ("{Enter}")
send ("{Enter}")
send ("•  jeg liker å være i kontakt med mennesker og er en serviceminded person")
send ("{Enter}")
send ("•  ønsker å jobbe i et effektivt og godt arbeidsmiljø, noe jeg tror dere har muligheten til å kunne gi. ")
send ("{Enter}")
send ("•  Jeg trives dessuten godt både i teamarbeid og i selvstendig arbeid  noe som denne jobben innebærer")
send ("{Enter}")
send ("•  Og jeg ønsker å utdype min jobberfaring innen dette yrkesområdet.")
send ("{Enter}")

send ("{Enter}")

send ("{Enter}")
send ("Litt om meg;")
send ("{Enter}")
send ("Jeg er en mann på xxx år, bosatt i xxx per dags dato, hvor jeg er elev på xxx Privatist Gymnasium der jeg tar opp xxxfag for å tilegne meg kompetanse for et videre bachelor studium innenfor Informatikk ")
send ("{Enter}")
send ("{Enter}")
send ("xxxxx")
send ("{Enter}")
send ("Som person er jeg en utadvendt og energisk godt voksen person, kan vell også se på meg selv som en idèskapende person, og gir 110% for jobben,            ")
send ("{Enter}")
send ("{Enter}")
send ("Vil også legge ved at jeg er også en person som setter mål i henhold til jobben, det å lære nye ting, bedre kompetansen min, og bli flinkere innenfor det området jobben er fokusert rundt. .")
send ("{Enter}")
send ("{Enter}")
send ("Jeg jobber for tiden som kundekonsulent / driftsentermedarbeider  hos x.as")
send ("{Enter}")
send ("{Enter}")
send (" Vil også legge ved at til tross for ordinær 1 måned oppsigelsestid kan jeg gå ifra stillingen på en ukes varsel. ")
send ("{Enter}")
send ("{Enter}")
send ("Men grunnet et ønske om personlig videreutvikling innenfor et nytt område og uaktuelle arbeidstider ser jeg herved med dette etter en ny stilling og søker med dette på deres utlyste stilling")
send ("{Enter}")
send ("{Enter}")
send ("Håper at min søknad er av interesse og stiller gjerne til intervju om ønskelig")
send ("{Enter}")
send ("{Enter}")
send ("Kan kontaktes på telefon xx-xx-xx.")
send ("{Enter}")
send ("{Enter}")
send ("Med vennlig hilsen       ")
send ("{Enter}")
send ("xxxx")
send ("{Enter}")
send ("{Enter}")
send ("{Enter}")
send (" VedLegg:")
send ("{Enter}")
 send (" -Cv")
 send ("{Enter}")
  send ("-Attest ifra xxx.AS")
send ("{Enter}")
sleep (1000)
MouseClick ("left", 547,77,1,10)
sleep (1000)
mouseclick ("Left", 324,41,1,15)
sleep (1000)
send ("C:\Users\xxxx")
sleep (1000)
send ("{Enter}")
sleep (1000)
MouseClickDrag ("Left", 171,119,432,155,10)
sleep (1000)
send ("{enter}")









send ("{Pause}")











    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ;toolTip('Script -  "Scriptet er - AV"',0, 40)
    WEnd
    ToolTip("")
EndFunc
Hi there, what exactly am i missin in this script?

when running it, the inputfields gives only 3, i assume thats and error :D

and the button, how can i have it wait until fields are inputed, and button is pushed.

ps removed some sensitive information, reson somthing is gone

Link to comment
Share on other sites

  • Moderators

pezo89,

the inputfields gives only 3

This line:

Send($Input2)

sends the ControlID of the input control - which happens to be 3. You need:

Send(GUICtrlRead($Input2))

and the button, how can i have it wait until fields are inputed, and button is pushed

You need to look for the button in your GetMessage loop like this:

While 1
    Switch GUIGetMsg()
        Case$GUI_EVENT_CLOSE
            ExitLoop
        Case $Button_1
            Button_Function()
    EndSwitch
WEnd

Then you need to put all your code for what happens when you press the button into a function called Button_Function.

If you want to check the inputs have something in them, you start that function like this:

Func Button_Function()

    If GUICtrlRead($Input1) = "" And GUICtrlRead($Input2) = "" Then
        MsgBox(0, "Error", "Please input the data")
        Return
    Else
        ; All the code you want to run when the button is pressed
    EndIf

EndFunc

I hope that helps. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...