I used that trick today, RW, and it worked poifectly. Thanks again for the great idea. What I did was this:
1. Created the entire MoveMsgWindow .wbt script as a string in a variable (using %@CRLF% between lines)
2. filePut() the string into a file on disk, preserving the file name in a variable
3. Used run() to run the script just saved to disk
4. Executed the message (in my case, calling an instance of Sean Dorn's _udfMessage)
5. The message was instantly relocated, with no visible flash or movement
6. fileDelete() the .wbt that moved the message window
Here's the code:
_killMe = udfMoveAlarmToMon2(_almTitle) ;only moves alarm if _zoomActive and _numMons > 1 (both defined inside udf)
_udfMsgTitle = _almTitle
_udfMsgText = _alarmMsg
_udfMsgJust = `Center`
_udfTimeOut = 8
_udfButtons = `OK|Remind 5m|Remind 15m|Remind 30m|Msg2ClipBd|Reschedule|Cancel`
_udfPositon = `0,0,1000,1000`
_almUserClick = udfMessage(_udfMsgTitle,_udfMsgText,_udfMsgJust,_udfTimeout,_udfButtons,_udfPositon)
if _killMe != 0 then fileDelete( dirScript() : _killMe : `.wbt` )
and the udf:
#DEFINEFUNCTION udfMoveAlarmToMon2(_almTitle) ;---------------------------------------
debugTrace(22)
_numMons = winMetrics(80)
_zoomActive = winExist(`ConfMeetingNotfiyWnd`)
IF _numMons > 1 && _zoomActive
;debugTrace(22)
_dtCode = timeFormat(timeYmdHms(), `yyMMdd_hhmmss`)
_f = `_st = timeYmdHms()` : @CRLF : `while 1` : @CRLF : `if winExist('%_almTitle%')` : @CRLF : `_pp = arrayize(winPosition('%_almTitle%'), ",")` : @CRLF : `_tx = _pp[0] - 1000` : @CRLF : `_bx = _pp[2] - 1000` : @CRLF : `winPlace( _tx, _pp[1], _bx, _pp[3], '%_almTitle%' )` : @CRLF : `return` : @CRLF : `endif` : @CRLF : `yields(250)` : @CRLF : `if timeDiffSecs(timeYmdHms(), _st) > 20 then Break` : @CRLF : `endwhile`
filePut(dirScript() : _dtCode : `.wbt`, _f)
yields(20)
run(dirScript() : _dtCode : `.wbt`, ``)
return _dtCode
ENDIF
return 0
#ENDFUNCTION ;udfMoveAlarmToMon2() ---------------------------------------------------
PS: You might wonder why I prefix my varnames with an underscore... It just makes them easier to search for... e.g. searching for _message will not return all instances of message()