Is there a way to duplicate code in Dreamweaver?

4

In Notepad++ you can press CTRL+D to repeat selected code or the code on the same line when you press CTRL+D. This is very useful! Is there a similiar function in Dreamweaver CS6? I do have searched around, but did not find anything useful.

Thanks for your time.

kanarifugl

Posted 2013-09-24T19:28:18.623

Reputation: 161

repeat code or repeat html tags? – Austin T French – 2013-09-24T21:29:33.730

Not so convenient, but triple-click, ctrl-C, left arrow, ctrl-V...? – beroe – 2013-09-24T21:58:22.000

@AthomSfere duplicate selected text/code/html etc. – kanarifugl – 2013-09-25T22:27:12.660

Answers

0

As of Dreamweaver CC 2017, pressing CTR + D duplicates current line and is now fully supported (finally.)

kanarifugl

Posted 2013-09-24T19:28:18.623

Reputation: 161

4

CTRL+D in Notepad++ just means "Duplicate current line".

I don't believe there's an equivalent in DW.

Perhaps use Autohotkey (or alike) to create a macro that moves to the start of the line, then selects to the end of the line, then inserts a blank line below, and then inserts your copied line:

Then bind that to CTRL+D (or whatever).

^d::
SendInput {Shift Down}{Up}{Shift Up}{Ctrl Down}c{Ctrl Up}{Ctrl Down}v{Ctrl Up}{Ctrl Down}v{Ctrl Up}
return

Also, you probably can create a macro like this directly in DW using its "Commands" to do the automation.

If you get stuck writing your macro/script, come back with any questions relating to that and create a new question here (but please don't come back expecting us to write it for you ;) ).

Ƭᴇcʜιᴇ007

Posted 2013-09-24T19:28:18.623

Reputation: 103 763

Brilliant tip, I will definitely check it out. – kanarifugl – 2013-09-25T22:27:49.867

0

To create a duplicate selection and line keyboard shortcut do the following;

For windows 7 Professional:

  1. In windows explorer go to "C:\Users\USER_NAME\AppData\Roaming\Adobe\Dreamweaver CS6\en_US\Configuration\Menus"
  2. Locate the file named: "Menus.xml"
  3. Make a copy and lock it so you have the original
  4. Open "Menus.xml" in a text editor such as Notepad++ or open it in Dreamweaver CS6
  5. Scroll down the file until you find the following code (should be somewhere around line 67; that's where I found it in the original "Menus.xml") Find this Tag
  6. Just under this tag copy and paste the codeblock below do not remove the comment: Be sure to add the code in the (Add "xxx" Here). It won't let me post the code snippet on the forum with out doing this.

Copy from line below

(Add "comment opener" Here)
        Concept2FORM Duplicate Selection or Selected Line Keyboard Shortcut 
        Autor: Ryan Wainwright of Concept2FORM LLC :: 3D Printing and Industrial Design Solutions
        website: http://www.concept2form.com 
        contact: concept2form@gmail.com
(Add "comment closer" Here)

(Add "<" here)shortcut key="Cmd+R" domRequired="false" command="if (dw.getDocumentDOM() != null) dw.getDocumentDOM().source.startOfLine(false); if (dw.getDocumentDOM() != null) dw.getDocumentDOM().source.arrowDown(1, true); if (dw.canClipCopy()) { dw.clipCopy() }; if (dw.getDocumentDOM() != null) dw.getDocumentDOM().source.startOfLine(false); if (dw.getDocumentDOM() != null && dw.canClipPaste()){MM.event.notify('','dw.clipPaste()')}; if (dw.getDocumentDOM() != null) dw.getDocumentDOM().source.arrowUp(1, false);if (dw.getDocumentDOM() != null) dw.getDocumentDOM().source.endOfLine(false)" name="Concept2FORM Duplicate Selection" id="WD_Duplicator_DupLineDown" (Add "/>" Here)
  1. After pasting the above code block search for "CMD+R" in "Menus.xml" and locate it within the "shortcutlist" tag. The code line will begin with the tag:
  2. I just commented it out as it is the refresh shortcut for the CSS window. Not necceasry for me.
  3. Save the "Menus.xml" document
  4. Close and reopen Dreamweaver
  5. Open an HTML document and goto source view.
  6. Now select the code you wish to duplicate and press "CMD+R"
  7. That should do it.

If you find you have an error, reopen "Menus.xml" and search for other shortcut commands with "CMD+R" and change them as desired.

Took me a while to write and figure this out so if you share it, please leave the comment containing author and web address. Thanks!!

user280304

Posted 2013-09-24T19:28:18.623

Reputation: 1