AutoHotkey Community

It is currently May 26th, 2012, 10:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: October 28th, 2009, 1:58 pm 
Offline

Joined: September 21st, 2009, 1:25 am
Posts: 10
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 October 28th, 2009, 2:03 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 2:02 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 2:14 pm 
Offline

Joined: September 21st, 2009, 1:25 am
Posts: 10
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. :)

_________________
StoreyQuickNotes - An AutoHotkey Project for Radiation Oncology


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: AndyJenk, Bing [Bot], JSLover, Leef_me, Miguel, patgenn123, rbrtryn and 69 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group