Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

proc variable usage 1

Status
Not open for further replies.

MJB969

Technical User
Jul 8, 2009
8
US
I hope this makes sense. If I define a variable in one proc (ie integer TaskId) can I call that same variable in a subsequent proc either within the original proc or external to it?

Example:

proc start_task
integer TaskId
run notepad.exe TaskId
end proc

proc change_window
winfocus TaskId
end proc

proc main
call start_task
run excel.exe
call change_window
end proc

Thanks.

Mike
 
Declare it globally.

Code:
integer TaskId

proc start_task
   integer TaskId
   run notepad.exe TaskId
end proc

proc change_window
   winfocus TaskId
end proc

proc main
   call start_task
   run excel.exe
   call change_window
end proc
 
Sorry, I meant:

Code:
integer TaskId

proc start_task
   run notepad.exe TaskId
end proc

proc change_window
   winfocus TaskId
end proc

proc main
   call start_task
   run excel.exe
   call change_window
end proc

You can assign and change the value of TaskID at any point this way.
 
So, when I assign notepad.exe as the value of TaskId in the first proc, then any future references to TaskId would have the same value, unless changed?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top