Melinda Posted November 22, 2022 Report Share Posted November 22, 2022 Hello, I copy text to then insert it into software but the problem is that I often have a space before (not always) which suddenly makes me crash my macro. How please to "format" the copied text and remove the spaces. Thanks in advance, have a nice day. Quote Link to comment Share on other sites More sharing options...
Cory Posted November 22, 2022 Report Share Posted November 22, 2022 Variable Modify > Trim. See the help for instruction and options for Variable Modify. Quote Link to comment Share on other sites More sharing options...
acantor Posted November 22, 2022 Report Share Posted November 22, 2022 After you copy the text to the clipboard, you will need to do three things: 1. Transfer the contents of the clipboard into a variable. 2. Do as Cory suggests: "trim" the variable. Trim means to delete spaces from the start and end. 3. Transfer the contents of the variable back to the clipboard. For example, if this is in your clipboard at the start: " Hello World " The clipboard will be there after you've completed the three steps: "Hello World" The Macro Express code looks something like this: // 1. Transfer clipboard to string variable %Clip% Variable Set String %Clip% from the clipboard contents // 2. Trim %Clip% Variable Modify String %Clip%: Trim // 3. Transfer %Clip% to the clipboard Clipboard Start Copy Text Type (Simulate Keystrokes): %Clip% Clipboard End Copy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.