Jump to content

Input and Function


Recommended Posts

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.1

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

;#include <image.au3>
#include "ImageSearch.au3"
#include <MsgBoxConstants.au3>


AutoItSetOption('MouseCoordMode', 0)

HotKeySet('e', 'Exception')

HotKeySet('`', 'ExitScript')

sleep(3000)

Global $s0 = 50, $s1 = 500, $s2 = 200, $s3 = 300, $s4 = 400, $s5 = 500, $s8 = 800
Global $sec = 1000, $min = 60000, $hour = 360000

Local $i = 1, $j = 1, $k = 1
Local $WorkToDo = 0

Global $LocInputTimer = 2000, $StoryStepTimer = 2000, $ReachLocTimer = 5 *$sec


While 1
   Local $WorkToDo = InputBox("WorkList", "What you want to run", "Notepad", "", _
                                    - 1, -1, 0, 0)
   MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.

   If $WorkToDo = Notepad Then
      MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
      Notepad()
   ElseIf $WorkToDo = PowerPoint Then
      MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
      PowerPoint()
   ElseIf $WorkToDo = Word Then
      MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
      Word()

   ElseIf $WorkToDo = Load_Data Then
      MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
      La_Pucelle_d_Orleans()


   ElseIf $WorkToDo = Mozilla Then
      MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
      Mozilla()

   Else
      Sleep(300)
   EndIf
WEnd


Func Notepad()
   Local $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED)

   ; Wait 10 seconds for the Notepad window to appear.
   WinWait("[CLASS:Notepad]", "", 10)
   ; Wait for 2 seconds.
   Sleep(2000)

   ; Close the Notepad process using the PID returned by Run.
   ProcessClose($iPID)

EndFunc

Func Mozilla()


EndFunc

Func PowerPoint()


EndFunc

Func Word()


EndFunc

Func Load_Data()


EndFunc


Func ExitScript()
   Exit
EndFunc

#Work - Copy.au3

Edited by Jos
added codebox
Link to comment
Share on other sites

8 minutes ago, ashraful089 said:

I am facing the problem, when i am giving string as input then it don't goes into the function. Help me to make solution of it, i think the problem is in variable declaration

just add after if .....:['] see below:

While 1
    Local $WorkToDo = InputBox("WorkList", "What you want to run", "Notepad", "", _
             -1, -1, 0, 0)
    MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.

    If $WorkToDo = 'Notepad' Then
        MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
        Notepad()
    ElseIf $WorkToDo = 'PowerPoint' Then
        MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
        PowerPoint()
    ElseIf $WorkToDo = 'Word' Then
        MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
        Word()

    ElseIf $WorkToDo = 'Load_Data' Then
        MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
        ; La_Pucelle_d_Orleans()


    ElseIf $WorkToDo = 'Mozilla' Then
        MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result.
        Mozilla()

    Else
        Sleep(300)
    EndIf
WEnd

 

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

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...