Skip several steps if condition is met - macros

I am automating the process of downloading information off of a site. As I can only search for (and then download) data from two days at a time, sometimes there is no data to be downloaded.In this instance, when the macro clicks the "download button, the following dialog box appears.
If there are listings to export, the macro proceeds through selecting a few options and downloading a file. However, if the dialog box above appears I would like the macro to skip the next few steps and proceed to a step several lines ahead. Is there any way to do this?

In brief, there can be several ways to do that which depend on your browser and 'iMacros'.
Here is one of them:
SET !EXTRACT_TEST_POPUP NO
SET msgText "No listings to export"
SET !ERRORIGNORE YES
TAG POS=1 TYPE=* ATTR=TXT:{{msgText}} EXTRACT=TXT
SET nextPos EVAL("'{{!EXTRACT}}'.match(/{{msgText}}/) ? '0' : '1';")
' your next steps
TAG POS={{nextPos}} TYPE=A ATTR=...
' ...
SET !ERRORIGNORE NO
If you play this code in loop mode, it's possible
to skip the next few steps and proceed to a step several lines ahead.

Related

Visual Studio Code select same position above and below not the whole line before and after (see image)

I'm using visual studio code and run into a weird problem. I'm not sure how I got here - I could have accidently pressed a shortcut unknowingly.
I'm trying to select a phrase, link or anything that crosses multiple lines (whether the lines are true lines or due to word wrap). When I select multiple lines, it doesn't automatically select the text at the start and end between the two points. Rather, it just selects the length of text for that line and repeats it in the subsequent lines. See the image below to understand.
Image of issue
As you can see, I am trying to select the words from "the" to the end of "sub". Instead of selecting all the words between the two, it selects the text "the instru" and selects every line with the same amount of characters/length.
In order to show what I am expecting, I have pasted the text into Notepad and done the same thing.
What I am expecting
As you can see, all the words between "the" and "sub" are selected.
If anyone has any idea about how to fix this, I would be greatly appreciative.
Below is a copy of the text if the images don't display.
Follow the instructions below for a click guide to retire and/or add 'School'.
Best practice if there is a change in 'School' structure would be to 'retire' any existing school setup that is no longer required and add the new sub school information. The reason why we don't just edit existing school names (typically) is due to leaving historical data intact.
Try using ctrl+shift+P and typing "Toggle Column Selection Mode"

Microsoft Word restart page numbering

In MS Word for Windows 10, if you wish to restart page numbering from "1" in the middle of a large document, doing so is currently a 7 step process. For example, let's say you have a document with 4 sections and on each section you wanted to restart the page numbering from "1".
I had two related questions:
Is there a way that, not involving adding any code to the source material, that a user can restart page numbering with 1 or 2 steps as opposed to 7?
If no, did anybody have a script that would allow the functionality described above?
Thanks
You can set the page numbers to restart by right-clicking on the page number, selecting Format Page Numbers... from the context menu and then, in the dialog now opening, entering the desired start value. Seems easy enough to me actually.
If you want to make it simpler you can add the below macro to your Normal.dotm file. You can then add a button to your Quick Access Toolbar that you bind to the macro and the command will be a single click away.
Note that page numbering always works per section, so your document will already have to contain the respective sections.
Sub RestartPageNumbers()
Dim startingNumber As Integer
startingNumber = InputBox("Start page number at: ", "Restart Page Numbers", 1)
ActiveWindow.View.SeekView = WdSeekView.wdSeekCurrentPageFooter
With Selection.HeaderFooter.PageNumbers
.RestartNumberingAtSection = True
.startingNumber = startingNumber
End With
ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument
End Sub

Select one word, then have all matching words automatically select?

I have been working in Notepad++ recently, and last night, spent at least an hour manually selecting many of the same phrase with Ctrl+Select. I needed to select all occurrences of 'yyty' (Just a phrase so I could easily find it), but could not see or find a quick way to do that. I ended up just using the Ctr+Select method, but when doing this 80 times, it gets quite annoying. I need something that will allow me to select a word, then have all matching words become selected (NOT highlighted or marked, as I need to be able to run the column editor tool on the selection to auto-number all of the selections) automatically (by automatically, I mean after clicking something to run the auto-selector). I am willing to install a plugin for NP++ if needed.

Extracting H1 title from list of web pages

I have a long list of URLs and I want to extra the title from each one and save it into an Microsoft Excel file.
I tried looking around for the code to do this but could not find it. I'm using iMacros for Firefox.
I would suggest using internet explorer object along with MSHTML object library in excel VBA itself which may take off using 3rd party applications.
You need first the list of URLs in a file (one URL in each line). Let's call it listOfUrls.csv (save as from Excel or just use a plain text file). You place that file in the iMacros/Datasources folder.
Then the macro itself:
SET !DATASOURCE listOfUrls.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
TAB T=1
URL GOTO={{!COL1}}
TAG POS=1 TYPE=TITLE ATTR=* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=openThisInExcel.csv
Now you have to play the macro as Loop (look for "Play (Loop)"). Play is as many times as URLs you have in the list (set that in "Max:"). Then the macro will take you to each URL and get the title and save it into openThisInExcel.csv. That's it.
You may also want to keep the URL in the result CSV (so you know which Title correspond to which URL). Add the following before the last line or the line before that one (depending on the column order you want):
ADD !EXTRACT {{!URLCURRENT}}

Searching in eclipse always fails first time, always succeeds seconds time with identical search string

I've noticed that if I search for something in Eclipse (using it for Android development thus has the Android plugin) then the first time I search for a search string it always says there are no matches, but if I immediatly report the same search, then there are matches.
Using: Search/Search/File Search - then enter something in the "Containing text:" box (Case sensitvie is off, regular expression is off, file name patterns are .).
It will report "'search term' - 0 matches in workspace(.).
If I search again it will fail again unless I retype the search term or copy and paste it (no, I'm not mistyping it, if I enter it the first time when it fails, then copy and paste the term for the next successful search its obviously an identical search term).
This happens 100% of the time. Why is it doing this? Its really bugging me, when I search something I have to enter it twice it in order to get the results which is irritating.
Check the search scope at the bottom and make sure the correct one is selected:
Workspace
Selected resources
Enclosing projects
Working set
If you have a project highlighted in your workspace when you open the search dialog, it will default to the selected resource, otherwise it will default to the workspace, so that may be why you are seeing different results the second time around.
Hope this helps.