cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

IsoDraw Macro for "Revert"

bgraffmann
1-Newbie

IsoDraw Macro for "Revert"

If you record a macro in IsoDraw and select the "Revert" command form the File Menu , something  like

 

Close confirm_no

Open "C:\MyPath\MyFile.iso"

 

is recorded. Truely this is what happend - the current file was closed and opend again.

If you want to create an IsoDraw macro for your macro library this is probably too specific.

More likely you don't want to load the file recorded, but the actual file when executing the macro.

So you could replace the recorded lines by

 

Menu "Revert"

 

which does exactly the same as if you manually select the "Revert" command from the File Menu.

This method has two drawbacks:

  1. It only works on an English Language Version of IsoDraw.
  2. You can't switch off the "Do you really want to lose your changes?" message.
        

An other approach is to store the path and name of the file before closing and than open the same file:

 

Define sDoc as String

sDoc = activeDoc.Path

Close confirm_no

Open sDoc

 

Sounds good…

  • But what if we want to have the warning message?
  • What happens if no file is open or the file is not already changed?

 

Here is a complete SubMacro for your macro library that handles all this.

(Anyhow - no warranties!)

 

SubMacro Revert( Boolean bQuiet )

# Implements a substitute for

# MENU "Revert"

# that is language independend

# and can be quiet or not.

 

If ( exists(activeDoc) ) then

If ( activeDoc.modified = 0 ) then

If ( bQuiet = false )

Message "Document is saved - can not revert."

End If

Else

Define bClear as Boolean

If ( bQuiet = false ) then

bClear = Get Boolean "Do you really want to revert all changes?"

Else

bClear = true

End If

If ( bClear = true ) then

Define sDoc as String

sDoc = activeDoc.Path

Close confirm_no

Open sDoc

End If

End If

Else

If ( bQuiet = false )

Message "No open document - can not revert."

End If

End If

End SubMacro

 

Macro Test_Revert

# Do Revert with User Messages:

Run Revert(false)

 

# Do silent Revert:

Run Revert(true)

End Macro

0 REPLIES 0
Top Tags