Jump to content

Recommended Posts

Posted

Hi people,

I have an input box at the start of my script that asks the user which function they want to use within the script. The global taken from this is $choice. Then later in the script I use the command below in the hope that it will call the function the user specified.

$choice()

However when I try to run my script it isn't calling a function at all and in the error mentions something about '='. I wondered if anyone knew where I was going wrong?

Thankyou for your help

Mark

Posted

Hi people,

I have an input box at the start of my script that asks the user which function they want to use within the script. The global taken from this is $choice. Then later in the script I use the command below in the hope that it will call the function the user specified.

$choice()

However when I try to run my script it isn't calling a function at all and in the error mentions something about '='. I wondered if anyone knew where I was going wrong?

Thankyou for your help

Mark

<{POST_SNAPBACK}>

its in the beginning... so show us the beginning of the code

8)

NEWHeader1.png

Posted

Here is my code:-

(sorry if its a bit long and not very well formatted...im pretty rubbish at this!)

;

; AutoIt Version: 3.0

; Language: English

; Platform: Win9x/NT

; Author: Jonathan Bennett (jon@hiddensoft.com)

;

; Script Function:

; Moves mouse cursor to appropriate point.

;

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("{ESC}", "Terminate")

MsgBox(0, "EK-Rechner - Field Input Script", "To pause at any time press 'Pause/Break' button. To exit the script press 'ESC'")

$choice = InputBox("Field Choice", "Enter the field which you want to populate, select from the following options: (DeliveryLeadTime, ReturnCode, WeekTerm, Royalty)", "",)

$input = InputBox("Input Choice", "Enter the value you want to input", "",)

EnterItem()

Func EnterItem()

WinActivate("Stern MARKP@EKP")

$choice()

Send("{F8}")

While MouseGetCursor() = 15

sleep(10)

WEnd

If WinActive("Warning") Then

Send("{PAUSE}")

EndIf

Send("{F6}")

If WinActive("Confirm") Then

Send("{RIGHT}")

Send("{ENTER}")

While MouseGetCursor() = 15

sleep(10)

WEnd

EndIf

If WinActive("Information") Then

Send("{PAUSE}")

EndIf

While MouseGetCursor() = 15

sleep(10)

WEnd

EndFunc

Func DeliveryLeadTime()

WinActivate("Stern MARKP@EKP")

Mouseclick("left", 258, 176, 1)

Mouseclick("left", 282, 489, 1)

Send($input)

Send("{F8}")

EndFunc

Func Royalty()

WinActivate("Stern MARKP@EKP")

MouseClick("left", 203, 174, 1)

MouseClick("left", 740, 311, 3)

Send("{BS 5}")

Send($input)

EndFunc

Func ReturnCode()

WinActivate("Stern MARKP@EKP")

MouseClick("left", 258, 176, 1)

MouseClick("left", 284, 522, 1)

Send($input)

EndFunc

Func WeekTerm()

WinActivate("Stern MARKP@EKP")

MouseClick("left", 203, 174, 1)

MouseClick("left", 740, 278, 3)

Send($input)

EndFunc

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

Func ShowMessage()

MsgBox(4096,"","This is a message.")

EndFunc

; Finished!

Posted

I think call($choice) should work... i just read somthing about this sort of thing...

but i think what you need to use is call, look in the help file for specifics

autoit doesnt allow for variable in the function name when using the XXXX() syntax

Posted

I see what you're trying to do. Consider this alternate:

$choice = InputBox("Field Choice", "Enter the field which you want to populate, select from the following options: (DeliveryLeadTime, ReturnCode, WeekTerm, Royalty)", "",)

$input = InputBox("Input Choice", "Enter the value you want to input", "",)
Select
  Case $choice = "DeliveryLeadTime"
    WinActivate("Stern MARKP@EKP")
    Mouseclick("left", 258, 176, 1)
    Mouseclick("left", 282, 489, 1)
    Send($input)
    Send("{F8}")
  Case $choice = "ReturnCode"
    WinActivate("Stern MARKP@EKP")
    MouseClick("left", 258, 176, 1)
    MouseClick("left", 284, 522, 1)
    Send($input)
 ;Case... etc...
EndSelect

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
×
×
  • Create New...