AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Function call

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Thu Feb 11, 2010 3:29 pm    Post subject: Function call Reply with quote

Is there a better way to write this?

This first code works....
Code:

selection := OMSeTopMenu("LSROrder")

OMSeTopMenu(action)
{
   ;NoMenu = 1
   if(action = "CSRInquiry")
   {
      action = 2
   }
   if(action = "Search")
   {
      action = 3
   }
   if(action = "OrderSearch")
   {
      action = 4
   }   
   if(action = "OrderSearchAll")
   {
      action = 5
   }   
   if(action = "TaskManagement")
   {
      action = 6
   }   
   if(action = "ServiceQuery")
   {
      action = 7
   }   
   if(action = "SeasonalAccounts")
   {
      action = 8
   }   
   if(action = "QCCTaskManagement")
   {
      action = 9
   }   
   if(action = "QCCSearch")
   {
      action = A
   }
   If(action = "Create")
   {
      action = S1
   }
   If(action = "DigitalPhoneOrder")
   {
      action = T1
   }
   If(action = "LSROrder")
   {
      action = U1
   }
   If(action = "ProvisioningOrder")
   {
      action = V1
   }
   If(action = "PortOutOrder")
   {
      action = 02
   }
   if(action = "PICChangeOrder")
   {
      action = 12
   }
   if(action = "ResetPIN")
   {
      action = 22
   }
   if(action = "RefreshService")
   {
      action = 32
   }
   if(action = "SeasonalOrder")
   {
      action = 42
   }
   if(action = "TransferDevice")
   {
      action = 52
   }
   Return action
}


I originally had OMSeTopMenu written like this but this does not work it just returns the word:
Code:

OMSeTopMenu(action)
{
   Search = 3
   OrderSearch = 4
   OrderSearchAll = 5
   TaskManagement = 6
   ServiceQuery = 7
   SeasonalAccounts = 8
   QCCTaskManagement = 9
   QCCSearch = A
   Create = S1
   DigitalPhoneOrder = T1
   LSROrder = U1
   ProvisioningOrder = V1
   PortOutOrder = 02
   PICChangeOrder = 12
   ResetPIN = 22
   RefreshService = 32
   SeasonalOrder = 42
   TransferDevice = 52
   Return action
}


What I wanted was when I put say for example LSROrder in as the action, I wanted to return LSROrder's value which is U1. Same thing if I put in ProvisioningOrder it should return V1....Make sense?

Maybe I'm just not understanding something or I'm missing something. I tried ByRef and I don't get any value at all.
Back to top
View user's profile Send private message Visit poster's website
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Thu Feb 11, 2010 3:36 pm    Post subject: Reply with quote

Question
Code:

MsgBox % OMSeTopMenu("OrderSearchAll")
MsgBox % OMSeTopMenu("WhatIsThis")
MsgBox % OMSeTopMenu("ResetPIN")

OMSeTopMenu(action)
{
Actions=
(
Search=3
OrderSearch=4
OrderSearchAll=5
TaskManagement=6
ServiceQuery=7
SeasonalAccounts=8
QCCTaskManagement=9
QCCSearch=A
Create=S1
DigitalPhoneOrder=T1
LSROrder=U1
ProvisioningOrder=V1
PortOutOrder=02
PICChangeOrder=12
ResetPIN=22
RefreshService=32
SeasonalOrder=42
TransferDevice=52
)
Loop, Parse, Actions, `n, `r
{
 StringSplit, Action, A_LoopField, =
 If (Action1 = action)
    Return Action2
}
Return 0
}

_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu Feb 11, 2010 4:03 pm    Post subject: Reply with quote

Code:
MsgBox % OMSeTopMenu("QCCSearch")
 . "`n" OMSeTopMenu("PortOutOrder")
 . "`n" OMSeTopMenu("Bet This Won't Work")

OMSeTopMenu(action) {
  return (action = "CSRInquiry") ? 2
   : (action = "Search") ? 3
   : (action = "OrderSearch") ? 4
   : (action = "OrderSearchAll") ? 5
   : (action = "TaskManagement") ? 6
   : (action = "ServiceQuery") ? 7
   : (action = "SeasonalAccounts") ? 8
   : (action = "QCCTaskManagement") ? 9
   : (action = "QCCSearch") ? "A"
   : (action = "Create") ? "S1"
   : (action = "DigitalPhoneOrder") ? "T1"
   : (action = "LSROrder") ? "U1"
   : (action = "ProvisioningOrder") ? "V1"
   : (action = "PortOutOrder") ? "02"
   : (action = "PICChangeOrder") ? 12
   : (action = "ResetPIN") ? 22
   : (action = "RefreshService") ? 32
   : (action = "SeasonalOrder") ? 42
   : (action = "TransferDevice") ? 52
   : "an appropriate selection was not made"

}

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Thu Feb 11, 2010 4:20 pm    Post subject: Reply with quote

Don't I feel dumb...
both of those worked...

Thanks for the help!!!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group