macros

How can I write a Visual Studio macro to perform an Extract Class refactoring?

I'm trying to build a macro for Visual Studio 2008 that behaves thusly: (Extract Class Macro) I highlight some text in the currently open document and call the Macro (using a keybinding or whatever). The macro runs "Project.AddClass" for the current active project, allowing me to specify the Class name. The macro adds the text I origi...

EnvironmentEvent macro doesn't complete

I'm working in Visual Studio 2008 and I would like for Edit > Outlining > Collapse to Definitions to be run whenever I open a file. It would be nice if, after that, all regions were expanded. I tried the code that Kyralessa offered in a comment on The Problem with Code Folding, and that works very nicely as a macro that I have to run m...

macro problem

I'm trying to run the below mentioned code in VB(Excel Macro) but i m stuck with an error which pops up on running saying "Automation Error". strComputer = "." Set objNetwork = CreateObject("Wscript.Network") Set fs = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2"...

Visual Studio macro -- detect if a region is collapsed

Hi, I am writing a macro, and I would like to determine if the current line where the cursor resides is a collapsed area or not. Can someone show me a way to do this? ...

Unable to understand a statement about customizing Python's Macro Syntax

Cody has been building a Pythonic Macro Syntax. He says These macros allow you to define completely custom syntax, from new constructs to new operators. There's no facility for doing this in Python as it stands. I am not sure what he means by new constructs to new operators: Does he prefer to binary operators such as +, -...

Writing an auto-memoizer in Scheme. Help with macro and a wrapper.

I am facing a couple of problems while writing an auto-memoizer in Scheme. I have a working memoizer function, which creats a hash table and checks if the value is already computed. If it has been computed before then it returns the value else it calls the function. (define (memoizer fun) (let ((a-table (make-hash))) (λ(n) ...

Dynamic Automatic Text Inserting

Does such a thing exist where you can set up automatic text insertion shortcuts, but they can be dynamic? A lot of work I'm doing involves a lot of changes to code, and I've found that I'm copy-pasting my MOD-string hundreds of times, and it can get lost in the other copy-paste objects. Basically, I want to know if there's something I ...

C multi-line macro: do/while(0) vs scope block

Possible Duplicates: Whats the use of do while(0) when we define a macro? Why are there sometimes meaningless do/while and if/else statements in C/C++ macros? do { } while (0) what is it good for? I've seen some multi-line C macros that are wrapped inside a do/while(0) loop like: #define FOO \ do { \ do_stuff_here...

Macro to copy select rows to another worksheet and sort by month

Does anyone have a macro that will take data from a compiled list, sort out a particular month, the paste only the sorted month into a new worksheet? What I am setting up is a log where the samples are placed in the "Full List" by all employees and then when the boss wants to view only a certain months samples say January, he will be ...

A Macro to wrie a Private Macro in ThisWorkBook

I was wondering if there was a way I could write a macro that would write a macro to the ThisWorkBook Workbook Open module??? ...

Strange behavior for macro parts on umbraco site

Umbraco version: umbraco v 4.0.0 (Assembly version: 1.0.3327.20280) Asp.Net: .Net framework 2.0 Windows server 2008 with IIs7 Sometimes when viewing a page with a contained macro, the macro part of that page is completely removed, not rendered, no error no nothing only a incomplete page. Loading the same page again, it's rendered corr...

Running a macro in excel

I don't think this is technically a macro but I don't know what else to call it: Users want to print individual sections from a report on a sheet. These sections are just named ranges. Some points: The file is an xlt file. It is used as a template to generate an xls file. I am using Excel 2007, but the users will run a mixture of ...

How to create a Visual Studio macro that works with Team System work items

I need to create a macro or VS.net Addin that will insert the current date and time and user name in a field in a TFS work item. The sample macro does not work and I cannot find any way to programaticaly access a TFS work item that is open in the IDE. Is this possible? ...

Copying Data's from workbook to another workbook

Does anyone have the Macro code for copying from one excel workbook sheet data's to another excel workbook sheet but that should be date and time conditioned? ex: Date Time Fruits 4/22/2009 7:30:34 Apple 4/22/2009 7:30:37 Orange 4/22/2009 7:31:19 Mango 4/22/2009 7:31:37 Grapes 4/22/2009 7:32:37 Bana...

How to generate random variable names in C++ using macros?

I'm creating a macro in C++ that declares a variable and assigns some value to it. Depending on how the macro is used, the second occurrence of the macro can override the value of the first variable. For instance: #define MY_MACRO int my_variable_[random-number-here] = getCurrentTime(); The other motivation to use that is to avoid sel...

Is it possible to treat macro's arguments as regular expressions?

Suppose I have a C++ macro CATCH to replace the catch statement and that macro receive as parameter a variable-declaration regular expression, like <type_name> [*] <var_name> or something like that. Is there a way to recognize those "fields" and use them in the macro definition? For instance: #define CATCH(var_declaration) <var_type> <...

Add partial class with EnvDTE.CodeModel

Hi, I try generate source code from Visual Studio macros using CodeModel. All works fine, but I don't know how to create class with "partial" modifier. I would like to set "partial" via CodeModel, not with text maniuplation in TextDocument. Is it possible? And How? Thanks ...

C++: instantiate class from name?

Hi, imagine I have a bunch of C++ related classes (all extending the same base class and providing the same constructor) that I declared in a common header file (which I include), and their implementations in some other files (which I compile and link statically as part of the build of my program). I would like to be able to instantia...

Excel VBA Macro: Check content (of clipboard?) before pasting

Hi, I've had some serious issues with pasting data from various sources into Excel. Excel tends to try to be smart and does all kinds of silly formating. We need the data as text. The problem is that we have a lot of users, and many of them are not very experienced with computers, so asking them to use right-click and 'Paste Special' ...

How to get next IP in range from Excel

I know there has to be a way: I need help getting any hot excel module/trick/script/macro that would look at a range of IPs and give me the next address up? e.g. (192.168.1.128) --> (192.168.1.129) Not sure i need sub nets, but will throw it out there as well. ( 192.168.1.255) --> ( 192.168.2.1) I bet is has to be done with vbscript...