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 

Send %variable% not working like Send text

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



Joined: 21 Sep 2009
Posts: 10

PostPosted: Wed Oct 28, 2009 12:58 pm    Post subject: Send %variable% not working like Send text Reply with quote

Code:

; ***************************
; Toggle Schedule - shared
; ***************************
ToggleSchedule(state)
{
   if (state<0)
      state=2
   else if (state>2)
      state=0   
   
   if (!state)
   {
      Send {tab 9}
      Send 21a-nlr
      Sleep 50           
      Send {tab}
   }   
   else if (state=1)
   {
      Send {tab 9}
      Send nlr-nurses station
      Send {tab}
   }
   else if (state=2)
   {
      Send {tab 9}
      Send nlr-simulation
      Send {tab}
   }
   return state   
}


This works (Above)

Code:

; ***************************************************************************
; TOGGLE SCHEDULE DETAILS
; ***************************************************************************
sched1=21a-nlr
sched2=nlr-nurses station
sched3=nlr-simulation

; ***************************
; Toggle Schedule - shared
; ***************************
ToggleSchedule(state)
{
   if (state<0)
      state=2
   else if (state>2)
      state=0   
   
   if (!state)
   {
      Send {tab 9}
      Send %sched1%
      Sleep 50           
      Send {tab}
   }   
   else if (state=1)
   {
      Send {tab 9}
      Send %sched2%
      Send {tab}
   }
   else if (state=2)
   {
      Send {tab 9}
      Send %sched3%
      Send {tab}
   }
   return state   
}


This does not. (Above)

Current Version with: SendMode Input at the top of script.

I can do simple exchanges like this on short test pieces of code for Notepad with no trouble.

But, when I roll it into my larger project, I'm running the code over to a Citrix client and honestly it is a bit fussy. Notice the odd Sleep 50 command in the working example that is clearly inconsistent but required (trust me) based on testing.

Am I missing anything (like hopefully a space or simple typo) or does this just look like something where the network and lag is mucking things up when I try to roll the send command into a variable? Any other ideas on things that I can try to pull those sends into configurable pieces of code?

Thanks in advance.
_________________
StoreyQuickNotes - An AutoHotkey Project for Radiation Oncology


Last edited by mstorey20 on Wed Oct 28, 2009 1:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Wed Oct 28, 2009 1:02 pm    Post subject: Reply with quote

You're not declaring schedX as global variables inside your function.
You could also add them as parameters.
_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
mstorey20



Joined: 21 Sep 2009
Posts: 10

PostPosted: Wed Oct 28, 2009 1:14 pm    Post subject: Reply with quote

Blah....

Yes. Thanks. If there was only a smart compiler that knew what I wanted and would write and edit the code for me, it would be soooo much easier. Smile
_________________
StoreyQuickNotes - An AutoHotkey Project for Radiation Oncology
Back to top
View user's profile Send private message
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