Search Results

Search found 786 results on 32 pages for 'macros'.

Page 11/32 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Resharper Live Template Macro that changes variable name upon exit

    - by Luhmann
    I would like to create a Resharper Live Template that changes all spaces to underscores ind my "fact" Live template variable $testname$: <Fact()> _ Public Sub $testnames$() ' Arrange $END$ ' Act ' Assert End Sub I have this: [Macro("applyRegex", ShortDescription = "Run on {#0:variable}", LongDescription = "")] class ApplyRegexMacro : IMacro { public string EvaluateQuickResult(IHotspotContext context, IList<string> arguments) { return Regex.Replace(arguments[0], " ", "_", RegexOptions.IgnoreCase); } public HotspotItems GetLookupItems(IHotspotContext context, IList<string> arguments) { return null; } public string GetPlaceholder() { return "placeholder"; } public bool HandleExpansion(IHotspotContext context, IList<string> arguments) { return false; } public ParameterInfo[] Parameters { get { return new[] { new ParameterInfo(ParameterType.String), new ParameterInfo(ParameterType.String), new ParameterInfo(ParameterType.VariableReference) }; } } } But this only runs when i press tab. I want the macro to run after I tab out of $testname$. I want to be able to just write the test name in a single line of text with spaces, and then the Macro turns all the spaces into underscores. Is this possible?

    Read the article

  • Visual Studio - How to disable autoformat/correct while running macro?

    - by Sam
    When running a macro that changes the selected text, tags are automatically closed and the text formatted. How can I prevent that from happening? For example, wrapping text in a tag: DTE.ActiveDocument.Selection.Text = String.Format("<tag>{0}</tag>", DTE.ActiveDocument.Selection.Text) Ends up with two closing tags: <tag>Text</tag></tag> Even stranger, multiple lines fails: <li>One</li> <li>Two</li> <li>Three</li> An ends up as <ul> <li>One</li> <li>Two</li> <li>Three</li></li></ul> How can I prevent that? As can be seen by the last example, the formatting is wrong and there is an extra </li>

    Read the article

  • How to prevent latex memory overflow

    - by drasto
    I've got a latex macro that makes small pictures. In that picture I need to draw area. Borders of that area are quadratic bezier curves and that area is to be filled. I did not know how to do it so currently I'm "filling" the area by drawing a plenty of bezier curves inside it... This slows down typeseting and when a macro is used multiple times (so tex is drawing really a lot of quadratic bezier curves) it produces following error: ! TeX capacity exceeded, sorry [main memory size=3000000]. How can I prevent this error ? (by freeing memory after macro or such...) Or even better how do I fill the area determined by two quadratic bezier curves? Code that produces error: \usepackage{forloop} \usepackage{picture} \usepackage{eepic} ... \linethickness{\lineThickness\unitlength}% \forloop[\lineThickness]{cy}{\cymin}{\value{cy} < \cymax}{% \qbezier(\ax, \ay)(\cx, \value{cy})(\bx, \by)% }% Here are some example values for variables: \setlength{\unitlength}{0.01pt} \lineThickness=20 %cy is just a counter - inital value is not important \cymin=450 \cymax=900 %from following only the difference between \ax and \bx is important \ax=0 \ay=0 \bx=550 \by=0 Note: To reproduce the error this code have to execute approximately 150 times (could be more depending on your latex memory settings). Thanks a lot for any help

    Read the article

  • Insert a snippet from a Visual Studio macro

    - by Kyralessa
    I have a situation where I want to run a Visual Studio macro that has the user type something in an InputBox, then inserts a snippet and includes that text somewhere in it. Unfortunately, I can't figure out how to insert the snippet from macro code. It seems like it'd be something like DTE.ExecuteCommand("Edit.InvokeSnippetFromShortcut") or DTE.ExecuteCommand("Edit.InvokeSnippetFromShortcut", "theSnippetName") but those don't work. Any ideas?

    Read the article

  • Visual Studio macro to read compilation errors and fix implicit conversions automatically in VB.NET

    - by eckesicle
    I am converting a large project in VB.NET that is using Option Strict Off into Option Strict On Naturally I am running into the same compilation error over and over. Strict On does not allow implicit conversion from Object to String/Integer/Double Is it possible to to access the compilation errors with a macro and automatically append .ToString() to the erroneous implicit conversion. Essentially my question is a duplicate off http://stackoverflow.com/questions/2532340/tools-to-convert-option-strict-off-code-into-option-strict-on but that question had no answers. Cheers.

    Read the article

  • Writing preprocessor directives to get string

    - by Dave18
    Can you write preprocessor directives to return you a std::string or char*? For example: In case of integers: #define square(x) (x*x) int main() { int x = square(5); } I'm looking to do the same but with strings like a switch-case pattern. if pass 1 it should return "One" and 2 for "Two" so on..

    Read the article

  • Modelsim (XE III/Starter 6.4b) not allowing me to define a macro function

    - by montooner
    I'm working on a Xiling FPGA for a course project. Normally we use the lab computers, but I'm trying to install on my own computer. So, I'm trying to include a macro file using line: `include "Const.v" But the following macro function doesn't work. Any ideas why? `ifdef synthesis // if Synplify `define SYNPLIFY `define SYNTHESIS `define MACROSAFE `else // if not Synplify `ifdef MODELSIM `define SIMULATION `define MACROSAFE `else `define XST // synthesis translate_off // if XST then stop compiling `undef XST `define SIMULATION `define MODELSIM // synthesis translate_on // if XST then resume compiling `ifdef XST `define SYNTHESIS `define MACROSAFE `endif `endif `endif //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Section: Log2 Macro // Desc: A macro to take the log base 2 of any number. Useful for // calculating bitwidths. Warning, this actually calculates // log2(x-1), not log2(x). //------------------------------------------------------------------------------ `ifdef MACROSAFE `define log2(x) ((((x) > 1) ? 1 : 0) + \ (((x) > 2) ? 1 : 0) + \ (((x) > 4) ? 1 : 0) + \ (((x) > 8) ? 1 : 0) + \ (((x) > 16) ? 1 : 0) + \ (((x) > 32) ? 1 : 0) + \ (((x) > 64) ? 1 : 0) + \ (((x) > 128) ? 1 : 0) + \ (((x) > 256) ? 1 : 0) + \ (((x) > 512) ? 1 : 0) + \ (((x) > 1024) ? 1 : 0) + \ (((x) > 2048) ? 1 : 0) + \ (((x) > 4096) ? 1 : 0) + \ (((x) > 8192) ? 1 : 0) + \ (((x) > 16384) ? 1 : 0) + \ (((x) > 32768) ? 1 : 0) + \ (((x) > 65536) ? 1 : 0) + \ (((x) > 131072) ? 1 : 0) + \ (((x) > 262144) ? 1 : 0) + \ (((x) > 524288) ? 1 : 0) + \ (((x) > 1048576) ? 1 : 0) + \ (((x) > 2097152) ? 1 : 0) + \ (((x) > 4194304) ? 1 : 0) + \ (((x) > 8388608) ? 1 : 0) + \ (((x) > 16777216) ? 1 : 0) + \ (((x) > 33554432) ? 1 : 0) + \ (((x) > 67108864) ? 1 : 0) + \ (((x) > 134217728) ? 1 : 0) + \ (((x) > 268435456) ? 1 : 0) + \ (((x) > 536870912) ? 1 : 0) + \ (((x) > 1073741824) ? 1 : 0)) `endif

    Read the article

  • How to get a particular part of a String

    - by Harish
    I am writing a macro in Excel where I need to get a substring from a String. Its like this. ~/tester/test/hai/bye ~/stack/overflow/hai/bye In the above cases I need to take the String tester from the first one and stack from the second one.I tried using the Instr but its not useful.Can anyone help this?

    Read the article

  • What is the difference between #ifdef __IPHONE_3.2 and #if __IPHONE_3.2?

    - by Jonathan
    Hi, I have an iphone app that needs to work for 3.1.3 for the iPhone and 3.2 for the iPad. It is an iPhone app that I want to work on the iPad. The main difference is the MPMoviePlayerController which introduces/and deprecates lots of things in 3.2. Since, the iPhone OS only goes up to 3.1.3 and the iPad is on 3.2, I need to seperate my code so it only compiles the required code for the respective OS. I can't use [[UIDevice currentDevice] model] because I end up with deprecated warnings on the 3.1.3 code. Also, UIUserInterfaceIdiomPad is new in 3.2 so it doesn't work well with 3.1.3... So, I decided to use this, which only compiles what is necessary for the particular OS: #if __IPHONE _3_2 //do 3.2 iPad stuff #else //do 3.1.3 iPhone/iPod Touch stuff #endif My question is... What is the difference between these? #ifdef __IPHONE_3_2 and #if __IPHONE_3_2 Thank you

    Read the article

  • Can I make clojure macro that will allow me to get a list of all functions created by the macro?

    - by Rob Lachlan
    I would like to have a macro which I'll call def-foo. Def-foo will create a function, and then will add this function to a set. So I could call (def-foo bar ...) (def-foo baz ...) And then there would be some set, e.g. all-foos, which I could call: all-foos => #{bar, baz} Essentially, I'm just trying to avoid repeating myself. I could of course define the functions in the normal way, (defn bar ...) and then write the set manually. A better alternative, and simpler than the macro idea, would be to do: (def foos #{(defn bar ...) (defn baz ...)} ) But I'm still curious as to whether there is a good way for the macro idea to work.

    Read the article

  • Delete all rows that do not have the value: Criteria 1 or Criteria 2 or Criteria 3 in Column D --> Using VBA Macro for excel

    - by JDS
    I am new to Macro's/VBA and cannot seem to figure out how to do this action for multiple criteria. I am trying to Delete all rows that do not have the value: Identify Fail or Identify Success in Column D. I write the following code and it works for one criteria "Identify Fail": '***********************************************' Sub DeleteRows() 'Action 1 --> Delete all Rows without Identify Fail in column D' Application.ScreenUpdating = False For i = Range("D" & Rows.Count).End(xlUp).Row To 1 Step -1 If Range("D" & i).Value <> "Identify Fail" Then Rows(i).Delete shift:=xlUp Next i Application.ScreenUpdating = True End Sub '***********************************************' Once I try to add 'OR' with another criteria it does not work: '***********************************************' Sub DeleteRows() 'Action 1 --> Delete all Rows without Identify Fail in column D' Application.ScreenUpdating = False For i = Range("D" & Rows.Count).End(xlUp).Row To 1 Step -1 If Range("D" & i).Value <> "Identify Fail" Or "Identify Success" Then Rows(i).Deleteshift:=xlUp Next i Application.ScreenUpdating = True End Sub '***********************************************' Any suggestions would be appreciated as I have been scouring this website and have not found an efficient code that will do the trick.

    Read the article

  • Alerting for incorrect cell values

    - by Allan
    My problem: I have two ranges R16 and R01. These ranges were set up by swiping each range and then renaming them in the upper left panel of the sheet. Each range requires users to fill in each cell with a value. R16 requires users to enter a number of 0 through 5. The range R01 requires a value of 0 or 1 to be entered. NO cell can be left blank in any cell within these two ranges. These ranges and requirements are specific to this sheet only. It would be nice if at the time of user entering a number, an error message appeared like [invalid entry] if the value inputted was outside parameters set. For example, in R16, if someone entered 12 or -1 they would be alerted. Finally when the user presses a button on the page to use these values in a separate process, it is essential to check that no cell is left blank. I am trying to find a way to halt the running of the marco (via the button) if these parameters above are not met. Thank you

    Read the article

  • Can I have a macro in Visual Studio 2005 call a DOS command and redirect the output to a file?

    - by Mark
    I'd like to have a macro in Visual Studio 2005 that calls a DOS command and redirects the output (stdout and stderr) to a file. Just calling the command and "" redirecting it will not capture stderr, so there are two parts to this: calling a DOS command capturing both stderr and stdout to a file during that call I'd then like to open this file in Visual Studio after the command completes. I'm new to Visual Studio 2005 macro writing, and VB/VBA, so that's the kind of help that I'm looking for. Thanks, Mark

    Read the article

  • LibreOffice UNO Java API: how to open a document, execute a macro and close it?

    - by MarcoS
    I'm working on LibreOffice server-side: on the server I run soffice --accept=... Then I use Java LibreOffice client API's to apply a macro on a document (calc or writer). The java execution does not give any error, but I do not get the job done (macro code is executed, but it's effects are not in the output file). More, after macro script is invoked, the Basic debugger window appears, apparently stopped on the first line of my macro; F5 does not restart it... This is the relevant code I'm using: try { XComponentContext xLocalContext = Bootstrap.createInitialComponentContext(null); System.out.println("xLocalContext"); XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); System.out.println("xLocalServiceManager"); Object urlResolver = xLocalServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", xLocalContext); System.out.println("urlResolver"); XUnoUrlResolver xUrlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, urlResolver); System.out.println("xUrlResolve"); try { String uno = "uno:" + unoMode + ",host=" + unoHost + ",port=" + unoPort + ";" + unoProtocol + ";" + unoObjectName; Object rInitialObject = xUrlResolver.resolve(uno); System.out.println("rInitialObject"); if (null != rInitialObject) { XMultiComponentFactory xOfficeFactory = (XMultiComponentFactory) UnoRuntime.queryInterface( XMultiComponentFactory.class, rInitialObject); System.out.println("xOfficeFactory"); Object desktop = xOfficeFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xLocalContext); System.out.println("desktop"); XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, desktop); System.out.println("xComponentLoader"); PropertyValue[] loadProps = new PropertyValue[3]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "Hidden"; loadProps[0].Value = Boolean.TRUE; loadProps[1] = new PropertyValue(); loadProps[1].Name = "ReadOnly"; loadProps[1].Value = Boolean.FALSE; loadProps[2] = new PropertyValue(); loadProps[2].Name = "MacroExecutionMode"; loadProps[2].Value = new Short(com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN); try { XComponent xComponent = xComponentLoader.loadComponentFromURL("file:///" + inputFile, "_blank", 0, loadProps); System.out.println("xComponent from " + inputFile); String macroName = "Standard.Module1.MYMACRONAME?language=Basic&location=application"; Object[] aParams = null; XScriptProviderSupplier xScriptPS = (XScriptProviderSupplier) UnoRuntime.queryInterface(XScriptProviderSupplier.class, xComponent); XScriptProvider xScriptProvider = xScriptPS.getScriptProvider(); XScript xScript = xScriptProvider.getScript("vnd.sun.star.script:"+macroName); short[][] aOutParamIndex = new short[1][1]; Object[][] aOutParam = new Object[1][1]; @SuppressWarnings("unused") Object result = xScript.invoke(aParams, aOutParamIndex, aOutParam); System.out.println("xScript invoke macro" + macroName); XStorable xStore = (XStorable)UnoRuntime.queryInterface(XStorable.class, xComponent); System.out.println("xStore"); if (outputFileType.equalsIgnoreCase("pdf")) { System.out.println("writer_pdf_Export"); loadProps[0].Name = "FilterName"; loadProps[0].Value = "writer_pdf_Export"; } xStore.storeToURL("file:///" + outputFile, loadProps); System.out.println("storeToURL to file " + outputFile); xComponent.dispose(); xComponentLoader = null; rInitialObject = null; System.out.println("done."); System.exit(0); } catch(IllegalArgumentException e) { System.err.println("Error: Can't load component from url " + inputFile); } } else { System.err.println("Error: Unknown initial object name at server side"); } } catch(NoConnectException e) { System.err.println("Error: Server Connection refused: check server is listening..."); } } catch(java.lang.Exception e) { System.err.println("Error: Java exception:"); e.printStackTrace(); }

    Read the article

  • VBA Macro to save an excel file to a different backup location

    - by Joe Taylor
    I am trying to create a Macro that either runs on close or on save to backup the file to a different location. At the moment the Macro I have used is: Private Sub Workbook_BeforeClose(Cancel As Boolean) 'Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 'Saves the current file to a backup folder and the default folder 'Note that any backup is overwritten Application.DisplayAlerts = False ActiveWorkbook.SaveCopyAs Filename:="T:\TEC_SERV\Backup file folder - DO NOT DELETE\" & _ ActiveWorkbook.Name ActiveWorkbook.Save Application.DisplayAlerts = True End Sub This creates a backup of the file ok the first time, however if this is tried again I get: Run-Time Error '1004'; Microsoft Office Excel cannot access the file 'T:\TEC_SERV\Backup file folder - DO NOT DELETE\Test Macro Sheet.xlsm. There are several possible reasons: The file name or path does not exist The file is being used by another program The workbook you are trying to save has the same name as a... I know the path is correct, I also know that the file is not open anywhere else. The workbook has the same name as the one I'm trying to save over but it should just overwrite. Any help would be much appreciated. Joe

    Read the article

  • Visual Studio: Add necessary using directives with macro

    - by Kiril
    Hello guys, I am trying to do the following. Imagine you are reading some LINQ article and you decide to copy/paste some code from the article to a newly created project. In most cases, if you directly compile you will probably get an error for missing a using directives or assembly reference. I am trying to optimize the process where I have to go each keyword, click on it with the mouse and hit Shift + Alt + F10 to add the using directive. I know that it is not that much pain, but for the sake of optimization, is it possible and at what cost? Best Regards, Kiril

    Read the article

  • How to keep material on one double page in latex ?

    - by drasto
    I have two side document(so I use twoside option) in latex. I need to keep some material(text, pictures...) on one double page. In another words I want to allow page break from odd to even page but I want to prohibit breaks from even to odd page. I tried to write macro: \newcommand{\nl}{ \\ \ifodd\c@page \relax \else \nopagebreak \fi} and use it instead of \ (I don't use any other line breaks commands in my document) but it does not work. Thanks for all answers.

    Read the article

  • How to delete VB code from an Excel sheet using C#?

    - by Bashir Magomedov
    Does anyone know how to delete all VB code form an Excel workbook using C#? This code doesn’t work. It removes first (last one) VBComponent, but rises ArgumentException on second one. VBProject project = workbook.VBProject; int componentsCount = project.VBComponents.Count; for (int i = componentsCount; i >= 1; i--) { VBComponent component = project.VBComponents.Item(i); project.VBComponents.Remove(component); } Any suggestions? :)

    Read the article

  • How to bind "rest" variables to list of values in macro in Scheme

    - by Slartibartfast
    I want to make a helper macro for writing match-extensions. I have something like this: (define-match-expander my-expander (? (stx) (let* ([dat (cdr (syntax-e stx))] [var1 (car dat))] [var2 (cadr dat)]) ;transformer goes here ))) So I wanted a macro that will do this let binding. I've started with something like this: (define-syntax-rule (define-my-expander (id vars ...) body) (define-match-expander id (? (stx) (match-let ([(vars ...) (cdr (syntax-e stx))]) body)))) but match-let isn't defined in transformation time. First question would be is there any other way of doing this (making this expanders, I mean)? Maybe there is already something similar in plt-scheme that I'm not aware of, or I'm doing it wrong in some way. Regardless of answer on the first question, if I ever want to bound list of variables to list of values inside of a macro, how should I do it? EDIT: In combination with Eli's answer macro now looks like this: (define-syntax-rule (define-my-expander (id vars ...) body) (define-match-expander id (? (stx) (syntax-case stx () [(_ vars ...) body]))))

    Read the article

  • Excel macro send rich mail using LotusNotes

    - by CC
    Hi everybody. I'm working on a small macro to send mail from excel 2007 using my Lotus Notes session. The sending mail part is working fine. Now I need to send in the body part, a part of a stylesheet (for instance the area from A1:B20). This area has colors, bold font. To send my email here is the code: Set oSess = CreateObject("Notes.NotesSession") Set oDB = oSess.GETDATABASE("", "") Call oDB.OPENMAIL flag = True If Not (oDB.IsOpen) Then flag = oDB.Open("", "") If Not flag Then MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH End If On Error GoTo err_handler 'Building Message Set oDoc = oDB.CREATEDOCUMENT Set oItem = oDoc.CREATERICHTEXTITEM("BODY") oDoc.Form = "Memo" 'mail subject oDoc.Subject = "subject" 'mail body oDoc.sendto = "[email protected]" oDoc.body = "my text" oDoc.postdate = Date oDoc.SaveMessageOnSend = True oDoc.visable = True 'Sending Message oDoc.SEND False Does anybody has an idea about how to send a stylesheet ? Thanks alot.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >