Jump to content
Macro Express Forums

terrypin

Members
  • Content count

    1,745
  • Joined

  • Last visited

  • Days Won

    11

terrypin last won the day on May 15 2017

terrypin had the most liked content!

Community Reputation

2 Neutral

1 Follower

About terrypin

  • Rank
    Master

Recent Profile Visitors

363 profile views
  1. Saving to Excel in background

    Pleased to report a successful solution. I chose the text file method for my MX Pro macro, which was tedious but simple to write. Here's the first part: // Set up ******* Variable Set to ASCII Char 13 to %CR% Variable Set to ASCII Char 10 to %LF% Variable Set to ASCII Char 9 to %TAB% Variable Set String %CRLF% to "%CR%%LF%" // Enable next command only when using a pre-prepared test set **************************************************** Variable Restore: Restore All Variables Text Box Display: Variables reported in 'GPX track - Display captured variables' // Get all variables into a text file as a list ********************************* // GPX filename =tTrackname.gpx Variable Modify String %tAllVariables%: Append Text (GPX file name) Variable Modify String %tAllVariables%: Append Text String Variable (%TAB%) Variable Modify String %tAllVariables%: Append Text String Variable (%tTrackname%) Variable Modify String %tAllVariables%: Append Text (.gpx) Variable Modify String %tAllVariables%: Append Text String Variable (%CRLF%) // tReportDate Variable Modify String %tAllVariables%: Append Text (ReportDate) Variable Modify String %tAllVariables%: Append Text String Variable (%TAB%) Variable Modify String %tAllVariables%: Append Text String Variable (%tReportDate%) Variable Modify String %tAllVariables%: Append Text String Variable (%CRLF%) // Track Descr'n = tTrackDescr Variable Modify String %tAllVariables%: Append Text (Track Descr'n) Variable Modify String %tAllVariables%: Append Text String Variable (%TAB%) Variable Modify String %tAllVariables%: Append Text String Variable (%tTrackDescr%) Variable Modify String %tAllVariables%: Append Text String Variable (%CRLF%) . . . // Profile Link GE (DEM) = tProfileLinkGE(DEM) Variable Modify String %tAllVariables%: Append Text (Profile Link GE(DEM)) Variable Modify String %tAllVariables%: Append Text String Variable (%TAB%) Variable Modify String %tAllVariables%: Append Text String Variable (%tProfileLinkGE(DEM)%) Variable Modify String %tAllVariables%: Append Text String Variable (%CRLF%) // Now save that list as a text file ************************************ Variable Modify String: Save %tAllVariables% to "C:\Users\terry\Dropbox\Excel+VBA (Sundry)\TEMP-VariableList.txt" // The reason for postponing the remaining entries for MM and Best Estimates (and any others) is to minimuse risk of havng to start afresh in the event of some problem or crash during those final stages. // Now switch to Excel and paste the entries from the list ********************************************** Macro Run: Open TrackData-New.xlsm Macro Run: VBA - ImportFile_1 The VBA macro proved easier than I'd thought. Tedious (50 copy/pastes, mainly to non-contiguous cells) but worthwhile as running it took 5 secs, compared with about 60 for the previous MX macro.
  2. Saving to Excel in background

    Thanks rberg. Is the assigning to variables, from the screen copy, manual or automated?
  3. Saving to Excel in background

    Thanks Alan, I've been exploring that, and have posted to the Excel forum. In those few cases where I've been able to use a VBA macro, it's been enormously faster, so I certainly have motivation. But my preferred approach of pasting directly after every capture is proving difficult to implement with a VBA macro. Every paste goes to a unique cell. It also means 50 switches to and from my Excel workbook. So I think I'm going to focus on the text file method. Wish I could put my current project on hold while I move up the VBA learning curve a bit, instead of being stuck mainly in copy/paste plus minor edits mode!
  4. Saving to Excel in background

    I've ruled out using MX Pro Controls in Excel (Excel 365 here). I've tested using Get Control and Capture Control. The simple test below is typical. No matter which option of Capture Control I choose, it captures only the name of the workbook. Ignores screen co-ordinates whether specified or using 'Beneath mouse', sheet - everything. No way to capture cell (address or content), worksheet name, etc. // Testing Controls in Excel. Capture Control from Specific Coordinates into %cCellA1% // Trackdate Get Control Text from %cCellA1% into %tCell% Text Box Display: // Display cCellA1 and tCell My grunt method below works reliably, but at about 1 sec per cell it's glacially slow. // This pastes a variable (here a fixed string) into cell B1 of blank spreadsheet ********************************************** Text Type (Simulate Keystrokes): <ALT>eg // Open the 'Go To' dialog Text Type (Simulate Keystrokes): b1 // Select target cell Text Type (Simulate Keystrokes): <ENTER> // Confirm Text Type (Use Clipboard and Paste Text): abc defgh ijkl mnopqrst uvwxyz // Paste the clipboard contents Text Type (Simulate Keystrokes): <ENTER> // Apply
  5. Saving to Excel in background

    Thanks Cory, appreciate the kind offer. But I already have a longish list of 'Must learn..' topics on the back burner and can't risk adding .NET to it!
  6. Before I get going seriously on this macro I'd appreciate knowing whether - it's impossible? - It's possibe and someone's already done something similar and happy to share code? I have a macro (with several submacros) working in a couple of mapping applications, operating on walks/hikes/trips etc, call them all 'tracks'. For each track I capture about 50 text strings. I could get each to the clipboard immediately after they are captured. Or I could generate a list as I proceed and save a file (TXT or CSV) at the end of all the captures. I want to get them all into 50 specified (not consecutive) cells of a single Excel worksheet. If I choose the 'copy one at a time' method, I'd have to repeatedly return to my macro after pasting each one into Excel. If instead I go for the 'accumulate in text file' method I'd have to switch to Excel, import the text file and paste each of its 50 entries into their corresponding cells. My preference is for the first method. 1. it's less extra code to add to my macro and 2. if I make a mistake in the capturing at some point, I don't lose everything. But is that possible with Excel staying in the background, not flashing up 50 times, using Controls? Terry, East Grinstead, UK
  7. Rename Folder Error

    Hi, Your macro does not appear to deal with option '1'. If Variable %T[1]% Equals "1" End If does nothing. Which is fine if you never, ever, want to revert to that option, but presumably sometime you will want to. That aside, even with your logic corrected, that seems an unnecessarily complicated way of running two separate programs IMO. Why not simply have two separate shortcuts?
  8. Problem pasting to PaintShop Pro

    Anyone with any version of PaintShop Pro able to test this oustanding problem please? My macro: Activate or Launch: Window "Jasc Paint Shop Pro", Program "Paint Shop Pro.exe", Parameters "" My code for PSP 8: <ACTIVATE OR LAUNCH Title="Jasc Paint Shop Pro" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\program Files (x86)\\Jasc Software Inc\\Paint Shop Pro 8\\Paint Shop Pro.exe" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12"/>
  9. Load non-sequential values into an array

    Hi Mark, Hope the screenshot, annotated command text and command code will show you one way of doing it. I've used commas to separate the nunbers, but any other sensible character would be OK too. If you were doing this with many different sets of numbers, with varying numbers of elements, then a more flexible approach would be to set up text files first. But the crucial part is the indexing, as illustrated. Variable Set String %tNumbers% to "0.6,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5,14.5,16,18.5,22.5,27.5,32.5,40,63.5" Split String "%tNumbers%" on "," into %tArray22%, starting at 1 // Then continue with your macro. Here I've simply displayed each of the 22 elements in the array. Repeat Start (Repeat 22 times) Text Box Display: Result End Repeat <VARIABLE SET STRING Option="\x00" Destination="%tNumbers%" Value="0.6,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5,14.5,16,18.5,22.5,27.5,32.5,40,63.5" NoEmbeddedVars="FALSE"/> <SPLIT STRING Source="%tNumbers%" SplitChar="," Dest="%tArray22%" Index="1"/> <COMMENT Value="Then continue with your macro. Here I've simply displayed each of the 22 elements in the array."/> <REPEAT START Start="1" Step="1" Count="22" Save="TRUE" Variable="%nCount%"/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 tArray22[%nCount%] = %tArray22[%nCount%]%\r\n\\par \r\n\\par }\r\n" Left="Center" Top="425" Width="278" Height="258" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <END REPEAT/>
  10. Editing the contents of a string

    OK, Cory, here's a couple of screenshots. (I assume you were replying to me?) And as you may have noticed, I too had no response from the OP in the six weeks since offering my macro. But see also my 26th November post here
  11. Problem pasting to PaintShop Pro

    Thanks, appreciate the reply. But, yes, I did try compatibility mode (XP) last year, after similar discussions here. And just tried it again (for every option listed since XP too!) But that persistency issue remains. Also tried by first opening PSP 8 with a simple batch file as suggested in an older thread, but no change. Beginning to think that the last Win10 update is the cause. Apart from being otherwise happy with this ancient version, I have almost a hundred macros wriiten for use with it. Maybe a score in frequent use. So have been reluctant to update to current version. May reconsider if I can't fix this though! EDIT: The issue is the Activate or launch command. Unrelated to pasting. Running the folowing one-line macro Activate or Launch: Window "Jasc Paint Shop Pro", Program "Paint Shop Pro.exe", Parameters "" consistently: - prevents the macro from stopping - prevents MX Pro from closing - severely affects keystroke speed - and possibly other symptoms
  12. This problem started recently, with a macro that I've used without trouble for years in XP and the last 18 months in Win 10. It copies whatever image is on the clipboard to Paint Shop Pro 8. Here's the macro reduced to its essentials: Activate or Launch: Window "Jasc Paint Shop Pro", Program "Paint Shop Pro.exe", Parameters "" Clipboard Paste It does open PSP 8 and paste (slower than before) but then it refuses to stop. Running man continues. I have to close PSP 8 to stop it. In contrast, this macro opens, pastes to MS Paint, and the macro closes. Activate or Launch: Window "- Paint", Program "mspaint.exe", Parameters "" Clipboard Paste (No change with delays or using Ctrl+V instead of paste. Use Clipboard Hook is disabled. No change if enabled.) That points to PSP 8 as the culprit, or Win 10, or a combination. Yet if I manually paste into PSP 8, it works perfectly. I'll post in the Corel forum, but expect its experts will point to my macro program. Any thoughts please?
  13. Ensuring 'stacked' windows are not obscured?

    Pleased to report I seem to have found a very simple solution. I didn't think it could cover all scenarios. But so far, no matter how I arrange or minimise my three target windows, the edited macro delivers an unobscured result. I simply added this command at the end. All target files end with -Elev.jpg, so presumably this acts on all three. Not sure how it does it, without a Repeat or similar, but hey, if it works... Window Show: -Elev.jpg
  14. I've posted this query in a couple of newsgroups and forums, such as here, https://www.tenforums.com/general-support/100596-ensuring-stacked-windows-not-obscured.html#post1239805 but I'm beginning to doubt I'll get a neat solution. So I'm wondering if a macro could contribute to achieving it. Any ideas please? Particularly about getting recently opened windows 'on top'. Terry, East Grinstead, UK
  15. Excel: macro fails consistently

    Thanks Alan. Curiosity and my discomfort over unsolved puzzles may get me back on the case later. But happily (after great help from the VBA experts) I now have a working VBA macro that extracts the full hyperlink and uses it to select that file (i.e. highlight it) in its File Explorer folder. And all very fast, of course. What I'm about to do next (hopefully with Macro Express) is to open that in MediaInfo, capture its size (in GB to 1 dp) and enter that into my worksheet. If you're curious, I've attached an illustration. It might have been possible to approach it another way, which may even have worked with Macro Express. Namely to open the video file directly from the hyperlink, which by file association plays it in MPC HC, right click to get the context menu, select Properties and copy paste the size from there, etc.
×