Reply to topic  [ 6 posts ] 
Pausing a Macro for User Interaction 
Author Message

Joined: 2003-07-22 01:31:29
Posts: 32
How can I set up a pause for interaction with the option to continue or stop the macro?

#SAMPLE:
$theResult = Find "Something", "vEa"
Prompt "$theResult instances found."

if $theResult = > 0
Select All
Select Start
Find and Replace "Something", "" "!Ea" #
Show Find...
##WAIT FOR USER INTERACTION TO COMPLETE, THEN CONTINUE OR QUIT.
end

How can I implement my commented pseudocode?


2007-07-13 13:10:43
Profile

Joined: 2003-07-22 01:31:29
Posts: 32
Post 
In case my intent isn't clear enough, I want the user to be able to manually screen or operate individually through a manual Find routine which may repeat an unknown number of times. Since the manual find routine may involve attribute sensitivity, embedding all of this into a Perl routine is not an option.

The problem with just aborting the macro if user interaction is required means picking it up midstream afterwards.

Strategy?


2007-07-13 13:38:12
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
To answer your specific question, it is not possible to pause the macro execution until the user closes the Find dialog. However, I bet what you want to do can be accomplished using a While loop and some customized prompts. Eg:

Code:
$action = "Continue"
While $action == "Continue"
   if Find "whatever"
      $action = Prompt Options "Would you like to continue?", "", "OK", “Continue”, "Stop"
   else
      $action = "Stop"
   end
End


As for your specific macro, I'm not sure I understand what you want to do exactly. If you could describe it more, I might be able to give you some better advice.


2007-07-13 14:22:14
Profile WWW

Joined: 2003-07-22 01:31:29
Posts: 32
Post 
I didn't include a real-life scenario, but I am trying to use NWP for processing coded text (as I have for years with NW Classic).

Since this forum will not all attribute sensitive code to make any sense, let me just pose this scenario.

Prior to this search, within the same text processing macro, all code text has been tagged with a character style, for reference and viewing purposes. (Think syntax coloring. Many other elements have been colored, and a bunch of cleanup has already occurred.)

I set up a search to first of all search for text in the standard style to remove multiple spaces automatically.

Then I check for the existence of multiple spaces within text styled as code, and then allow the user (i.e., me) to manually search through those, so that I can deal with them in a way that I need to determine from the context. (Is it accidental or extraneous? Should the be converted to tabs or single spaces?)

Then I want to continue with my text processing macro.


2007-07-13 16:18:48
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
Thanks for the extra explanation. Unfortunately there's not currently any way to accomplish this. A macro continues running uninterrupted until it finishes or is cancelled.

I might suggest that you structure your macro so it can easily resume its work from the last point that required manual user interaction. The best would be to apply a bookmark in the file at the restart point. Then when the macro is started it can check for the existence of this custom bookmark and restart there.


2007-07-13 16:31:39
Profile WWW

Joined: 2003-07-22 01:31:29
Posts: 32
Post 
OK. I'll start making extensive use of bookmarks in my macros. I've got some other questions, but I'll post them so they're not buried under the wrong topic.


2007-07-13 16:50:47
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot 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:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software