xsh.Screen.Synchronous ์—ญํ• 

PROBLEM DESCRIPTION or QUESTION


xsh.Screen.Synchronous๊ฐ€ ํ•˜๋Š” ์—ญํ• ์ด ๋ญ”๊ฐ€์š”? true์ผ ๋•Œ์™€ false์ผ ๋•Œ์˜ ์ฐจ์ด์ ์„ ์•Œ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.

RESOLUTION


๋™๊ธฐํ™”๋Š” ํ„ฐ๋ฏธ๋„์˜ ์ถœ๋ ฅ์ด ๋ฉ”์‹œ์ง€ ์ƒ์ž์™€ ๊ฐ™์€ ์ผ๋ถ€ ์™ธ๋ถ€ ์ถœ๋ ฅ๊ณผ ๋™๊ธฐํ™”๋จ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

ํ„ฐ๋ฏธ๋„์— ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฉ”์‹œ์ง€๊ฐ€ ์ถœ๋ ฅ๋˜๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

$ cat test.txtย  Netsarang => the first match blah blah blah blah blah blah Computer => the second match

ย 

์˜ˆ์ œ ์Šคํฌ๋ฆฝํŠธ:

Sub Main ย  ย  xsh.Screen.Synchronous = true ย  ย  xsh.Screen.WaitForString("Netsarang") ย  ย  xsh.Dialog.MsgBox("1st match") ย  ย  xsh.Screen.WaitForString("Computer") ย  ย  xsh.Dialog.MsgBox("2nd match") End Sub

ย 

๊ฐ’์ด true๋กœ ์„ค์ •๋œ ๊ฒฝ์šฐ ์ฒซ ๋ฒˆ์งธ ์ผ์น˜ํ•˜๋Š” ๋ฉ”์‹œ์ง€ ์ƒ์ž๊ฐ€ ๋‚˜ํƒ€๋‚  ๋•Œ ํ„ฐ๋ฏธ๋„ ์ถœ๋ ฅ์ด ์ค‘์ง€๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ์Šคํฌ๋ฆฝํŠธ๋Š” ์ฐพ๊ณ ์ž ํ•˜๋Š” ๋‘ ๋ฒˆ์งธ ํ•ญ๋ชฉ์„ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋Ÿฌ๋‚˜ ๊ฐ’์„ false๋กœ ์„ค์ •ํ•˜๋ฉด ์ฒซ ๋ฒˆ์งธ ์ผ์น˜ ๋Œ€ํ™” ์ƒ์ž๊ฐ€ ๋‚˜ํƒ€๋‚˜๋”๋ผ๋„ ๋‚˜๋จธ์ง€ ๋ฉ”์‹œ์ง€๋Š” ํ„ฐ๋ฏธ๋„์— ๋ฟŒ๋ ค์ง‘๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ฒซ ๋ฒˆ์งธ ๋ฉ”์‹œ์ง€ ์ƒ์ž๋ฅผ ๋‹ซ์€ ํ›„ ๋‘ ๋ฒˆ์งธ ๋ฉ”์‹œ์ง€ ์ƒ์ž๋Š” ๋‚˜ํƒ€๋‚˜์ง€ ์•Š์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

ย