Jump to content
Macro Express Forums

mebrown1110

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by mebrown1110

  1. Hi all. I've been using Macro Express rather lightly and while this is probably a lightweight macro compared to what others do, it was a really big deal for me that required bits of last weekend to build and that I'm still tweaking.

     

    I use the subject line "Macro Workshop" to hopefully indicate that this thread could be a learning lab for newbies. If old hands have suggestions, please do so! I ain't no programmer.

     

    SITUATION

    I'm at Amazon and would like to see if the book I'm looking at is available at my local library. Now, if my library's catalog was web-based, I could use the bookmarklets described at the LibraryLookup project page.

     

    But my library uses a Java-based lookup engine called Webpac. That requires going to the library site, starting Webpac, clicking a link, typing in the title, and blah. After a year of doing this, light dawned on Marblehead: why not write a macro?

     

    THE MACROS

    I use 3 macros:

    "Are Amazon books at Durham library?" -- the main routine. Highlight the book title on the Amazon page (or any other app) and then press the hotkey.

     

    {Launch Webpac} -- a subroutine I suppose I don't strictly need but it makes debugging much easier. I don't expect to reuse this routine anywhere else. Its job is to detect when Webpac is fully loaded. This is tricky because the time it takes the Java app to load is variable. Thanks to this forum for the Repeat loop trick.

     

    "Put book title into text file" -- I originally had this hanging off the end of the main routine. But could never get the timing right and decided it was better to make it a separate hotkey. It specifies which file to save the book title to: a "wishlist" for bargain books (though Amazon's wishlist would do as well) or "check out from the library" list, which I can print out when I next go to the library. I did this mainly to play with the multiple choice menu command.

     

    =====

     

    "Are Amazon books at Durham library?"

    // With the title text of a book selected on Amazon web page, feed that text

    // to the Durham Library Webpac to see if the book is available

    // ===============================

    // Copy selected text to variable

    Macro Run: { Save Clipboard }

    Clipboard Empty

    Clipboard Copy

    Variable Set String %T97% ""

    Variable Set String %T97% from Clipboard

    // If we have a webpac window already running, switch to it

    If Window Title "Dynix WebPAC - Mozilla Firefox" is running

    Activate Window: "Dynix WebPAC - Mozilla Firefox"

    Wait For Window Title: "Dynix WebPAC - Mozilla Firefox"

    Else

    Macro Run: {Launch Webpac}

    Wait For Window Title: "Dynix WebPAC - Mozilla Firefox"

    Delay 5 Seconds

    End If

    // Click on the Library Catalog link and enter the book title

    Activate Window: "Dynix WebPAC - Mozilla Firefox"

    Mouse Move Screen 127, 277

    Delay 2 Seconds

    Mouse Left Button Double Click

    Delay 2 Seconds

    Text Type: %T97%<ENTER>

     

    =====

    {Launch Webpac}

    // Set variable to the URL

    Variable Set String %T2% "http://www.durhamcountylibrary.org/webpacj/"

    // Launch a new firefox window

    Program Launch: "firefox.exe"

    Wait For Window Title: "Mike - Mozilla Firefox"

    Delay 2 Seconds

    Activate Window: "Mike - Mozilla Firefox"

    // Specify URL

    Text Type: <F6>%T2%<ENTER>

    Delay 2 Seconds

    // Wait for page to load

    Wait For Window Title: "Dynix WebPAC - Mozilla Firefox"

    Activate Window: "Dynix WebPAC - Mozilla Firefox"

    Repeat Until %N1% = 0

    Get Pixel: Screen Coords: 126,497 into %N1%

    Delay 10 Milliseconds

    Repeat End

     

    =====

    "Put book title into text file"

    // Put book title into a text list

    Variable Set String %T8% "A"

    Multiple Choice Menu: Processing Book Title

    If Variable %T8% = "A"

    Variable Modify String: Append %T97% to Text File <-"bookstogetfromthelibrary.txt"

    End If

    If Variable %T8% = "B"

    Variable Modify String: Append %T97% to Text File <-"bookstobuy.txt"

    End If

     

    =====

     

    Well, that's my little macro. It works for me :)

     

    Mike

  2. I wonder if some of the Copernic search tools would deliver what the original poster is requesting.

     

    So Copernic Agent (there's a free version) could search Google for keywords, search within those results, and then track changes to the Google search if new pages are found. Then you could use Copernic Summarizer on the returned pages.

     

    http://www.copernic.com/

     

    No affiliation with Copernic; in fact, I've never tried the software before. But it looks as if it will do most of the heavy-lifting that was requested.

     

    mike

  3. I'm not a Macro Express power user, but thought I'd share two very simple macros I use often. I don't do much error correction, but please sing out if you can see ways to bulletproof them.

     

    1) I saw a piece of shareware that corrects a simple defect in the Windows Explorer -- namely, no "Create New Folder" button on the toolbar and no easy key combination to create a new folder. I thought, "I can create a macro that does that." This is the command I use in Win 2000 and XP; I don't know if the File>New>Folder sequence is different in other systems.

     

    So when the Explorer window is open and I've clicked in the right pane, I press F12 to get a new folder.

     

    Scope: Explorer.exe

    Hotkey: F12

     

    Text Type: <ALTD>f<ALTU>wf

     

     

    2) I'm a tech writer and often have to hyphenate compound adjectives, or hyphenate a string of words in an email (like "hard-to-please"). So I wrote the following macro. Select the text to be hyphenated and press the hotkey.

     

    Scope: Global

    Hotkey: Ctrl+Alt+Shift+

     

    Clear Text Variables: All

    Clipboard Cut

    Variable Set String %T1% from Clipboard

    Replace " " with "-" in %T1%

    Variable Modify String: Save %T1% to Clipboard

    Clipboard Paste

     

    Thanks -- Mike

  4. Thanks for the prod, Joe. I should have thought of that. After some messing about, I got what I wanted.

     

    I created the printer shortcut and put it in my C:\ root and renamed it printer.lnk. But MEX's Program Launch didn't work; for some reason, it called up a Send To program I have and asked me to copy or move the printer.lnk file to another folder. (Curiously, even Mike's Command Line ((freeware command-line tool)) called up the Send To program when I entered "c:\printer.lnk." I guess they didn't see this as a launchable file.)

     

    What did work was using the Windows Run command to call the shortcut; that works, for some reason. So here's what I've got now:

     

    Text Type: <WIN>r<ENTER>

    Wait For Window Title: "Run"

    Text Type: <BACKSPACE>c:\printer.lnk<ENTER>

     

    I might want to play with the timing to speed it up some, but it does what I want it to do. Thanks for the help.

  5. I'm sure there's an easy way to do this and I'm just blind to it. I'd like to press a hotkey that would display the print queue for my default printer so I can adjust preferences, delete jobs, etc. Apart from having MEX click on lots of icons to get to it, I don't know how to precisely call it up.

     

    The MEX version I have (3.5.0.1) lets you select a printer, and the control panel options let me select various groups but NOT the Printers and Faxes group. But I haven't found a command that does precisely what I'm looking for.

     

    Any ideas?

     

    Thanks -- meb

×
×
  • Create New...