WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialogs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WinBatch Studio Menu - Edit Dialog in WIL Dialog Editor

 Keywords:  WinBatch Studio Context  Menu Edit Dialog Editor WSP-USER.MNU wFind wCopy wGotoLine

There is a special file called "C:\Program Files..\WinBatch\System\WSP-USER.MNU" that controls the context menu (the right click menu) in winbatch studio. If you install the following script there, you get a cool seamless way to jump back and forth from the dialog editor.

Be aware that WSP-USER.MNU is not a standard winbatch script -- it has some special formatting rules. Indentation is important to menu structure.

 Edit &Dialog in WIL Dialog Editor
    ; This WB Studio macro copies WIL Dialog template code lines from WB Studio Editor to the Clipboard.
    ; Then the WIL Dialog Editor will be started and loads the Dialog template automagically from the Clipboard data.
    ; Before starting this copy process the cursor should be positioned anywhere within the Dialog code block.
    ; After returning from WIL Dialog Editor the cursor is placed one line down the Dialog() function call.
    ; To copy the current template from within the WIL Dialog Editor as code lines back into the WB Studio Editor,
    ; you have to do it from within the WIL Dialog Editor.
    ; Open the "File" menu and choose "Save to Clipboard" resp. press [Alt+F], then [T].
    ; Then make WB Studio Editor the active window by pressing [Alt+Tab] or so ...
    ; and answer the "Waiting ..." message dialog with "OK" or "Abort" resp. press [Enter] or [Esc].
    ;
    ; Remove active selection, if any.
    ;
    ; kdmoyers.20110211  & Detlev Dalitz.20110213.
    ;------------------------------------------------------------------------------------------------------------------------------------------
    
    wClearSel ()

    ; Locate start of Dialog, search backward.
    ret = wFind ('Format *= *`WWWDLGED,6.', @FALSE, @TRUE, @TRUE, @FALSE) ; Forward?,matchcase?,regex?,wrap?
    If ret == 0 
       Pause('Error: Edit &Dialog in WIL Dialog Editor','Unable to locate Dialog Format. Please make sure there is Dialog code in this script.')
       Exit
   Endif
    wHome ()
    intDlgStartLine = wGetLineNo ()

    ; Locate end of Dialog, search forward.
    wFind ('= *Dialog *\(', @TRUE, @TRUE, @TRUE, @FALSE) ; Forward?,matchcase?,regex?,wrap?
   If ret == 0 
       Pause('Error: Edit &Dialog in WIL Dialog Editor','Unable to locate Dialog. Please make sure there is Dialog code in this script.')
       Exit
   Endif

   wHome ()
   wDownLine ()
   wInsLine ("; *** Dialog is in edit mode ***") ; The CRLF of this line provides consistent behaviour for all return cases to WB Studio editor.

   ; Select lines to copy.
   wStartSel ()
   wGotoLine (intDlgStartLine)
   wEndSel ()
   wCopy ()

   strAppDlg = "WIL Dialog Editor"
   strAppExe = DirHome () : strAppDlg : ".exe"
   If AppExist (strAppExe) Then WinActivate ("~" : strAppDlg)
      Else RunZoom (strAppExe, "/clipboard") ; Wait for closing manually.
   intResult = DllCall (DirWindows (1) : "User32.dll", long:"MessageBoxA", long:DllHwnd (""), lpstr:"Press OK when ready.", lpstr:"Waiting for Dialog code on clipboard ...", long:1|64) ; OKCANCEL = 1; INFO = 64.
   If intResult == 1 Then wPaste ()
   wClearSel ()

   ; Go to the line following the Dialog block.
   wGotoLine (intDlgStartLine)
   wFind ('= *Dialog *\(', @TRUE, @TRUE, @TRUE, @FALSE) ; Forward?,matchcase?,regex?,wrap?
   If ret == 0 
      Pause('Error: Edit &Dialog in WIL Dialog Editor','Unable to locate Dialog Format. Please make sure there is Dialog code in this script.')
      Exit
   Endif
   wHome ()
   wDownLine ()

   ; Remove info line.
   wStartSel ()
   wDownLine ()
   wEndSel ()
   wDelete ()
   wClearSel ()
   Return


Article ID:   W18259
Filename:   WinBatch Studio Menu - Edit Dialog in WIL Dialog Editor.txt
File Created: 2012:04:05:09:14:44
Last Updated: 2012:04:05:09:14:44