访问多个链接和自动保存屏幕截图

Visiting Multiple Links and Auto-saving Screenshots

有我想要的东西,我想知道是否可以实现。

我要的是访问多个URL并自动保存截图。 如果可能的话,截图的保存名称应该和它的URL.

一样

例如,是否可以使用 ExcelEmEditor 来执行此操作? 也许用宏?

这可以吗? 如果可能的话我该怎么做?

示例:

URLS: 3 件(或更多)

  1. https://whosebug.com/questions/one
  2. https://whosebug.com/questions/two
  3. https://whosebug.com/questions/three

自动访问这些链接并保存截图如下。

截图:

  1. whosebug.com-questions-one.jpg
  2. whosebug.com-questions-two.jpg
  3. whosebug.com-questions-three.jpg

注意:HTTPS://部分可以不在注册名称中,因为注册时不接受:/标志。 / 符号也已替换为 - 符号。

截图2:

  1. questions-one.jpg
  2. questions-two.jpg
  3. questions-three.jpg

注2:即使整个URL也不是文件名。和上面一样。

我访问了一个类似的question。 然而,所提供的信息并没有完全符合我的要求。 我尝试了提供的示例代码。 例如 this code.

我打开了一个 excel 文件并用 VBA 和 运行 创建了一个宏。 当宏运行Internet Explorer打开后变成了Full Screen。 打开的页面是 www.google.com。 然后自动截图保存在WORD文档中

这不是我想要的。 还;问题中的 other code 根本不起作用。 如果上面的例子不能准确说明我想要的,请看下面的步骤。

  1. Multiple URLs will be opened one by one automatically.

(It could be Internet Explorer & Chrome or Edge or anyone.)

  1. The screen will be enlarged and switched to full screen mode. Note: What I'm talking about at this point is the action performed with the F11 key.
  2. Wait 7 seconds for the text "Press the F11 key to exit full screen" disappears on the screen.
  3. A screenshot will be taken and pasted into Microsoft Paint.
  4. The screenshot will be saved with the URL name. Sample: Screenshots should be saved with the part of the current URL after .com. The / sign in the links will cause problems when creating the filename. Therefore, when saving the screenshot, it will be necessary to automatically replace the / with a - sign and save it as such.

重要

我不期待你的任何服务;我只是没有足够的编码知识来完成它们。 f运行k,我没有Code Information这个名字下的任何资料。 我非常尊重你们每个人的知识,我想让你们知道我对此是真诚的。 我只是一个正在寻找一种方法来做我想做的事情的人。

我不希望从头开始做任何事情;我只是在等待在同一问题上需要帮助的人分享他们是否对此问题有任何解决方案。

第一种方法 Windows 7, 8.1, 10

  1. 先关闭所有windows。

  2. 打开默认网络浏览器并最大化浏览器 window,然后关闭浏览器 window。

  3. Win+R,然后键入 SnippingTool.exe 到 运行 截图工具。单击 Mode 按钮(或按 Alt+M)和 select Full Screen。按Ctrl+S显示Save As对话框。我建议创建一个新文件夹(例如Scrn),并在新创建的文件夹中保存屏幕截图,例如Scrn\screenshot.png。这只是一个虚拟屏幕截图,您可以稍后将其删除。这样做可以将以下屏幕截图保存到这个新的同一文件夹中。关闭截图工具。

  4. 使用 EmEditor 打开包含 URL 列表的文本文件。请不要最大化 EmEditor window。我建议首先使用几个 URL 进行测试。文本文件应如下所示:

https://www.emeditor.com/
https://whosebug.com/
https://www.google.com/
  1. 运行 下面的宏 (Screenshot1.jsee),在对话框中看到 Finished saving screenshots 之前请不要触摸键盘或鼠标。

Screenshot1.jsee

document.selection.StartOfDocument();
nLines = document.GetLines();
for( y = 1; y <= nLines; ++y ) {
    str = document.GetLine( y );   // retrieve an URL at a line
    if( str.length != 0 ) {
        str = str.replace("http://", "");  // remove "http://" and "https://"
        str = str.replace("https://", "");
        if( str.charAt( str.length - 1 ) == '/' ) {  // remove the last slash character
            str = str.substr( 0, str.length - 1 );
        }
        str = str.replace("/", "-");   // replace invalid characters with "-"
        str = str.replace("~", "-");
        str += ".png";   // append ".png"
        
        document.selection.OpenLink();
        document.selection.LineDown(false,1);
        Sleep( 5000 );  // wait for the browser to become active and show the webpage completely

        WshShell = new ActiveXObject( "WScript.Shell" );
        WshShell.Run( "SnippingTool.exe" );
        Sleep( 2000 );  // wait for the Snipping Tools appears
        shell.SendKeys( "%M" );  // Press Alt+M
        Sleep( 100 );
        shell.SendKeys( "s" );  // Press s
        Sleep( 100 );
        shell.SendKeys( "%n" );  // Press Alt+N
        Sleep( 1000 );
        shell.SendKeys( "~" );  // Press Enter
        Sleep( 100 );
        shell.SendKeys( "~" );   // Press Enter
        Sleep( 1000 );
        shell.SendKeys( "%{F4}" );  // Press Alt+F4 to close Snipping Tools
        Sleep( 1000 );
        shell.SendKeys( "y" );   // select YES
        Sleep( 1000 );
        shell.SendKeys( str + "~" );   // enter file name
        Sleep( 1000 );
        
        shell.SendKeys( "%{F4}" );  // Press Alt+F4 to close web browser
        Sleep( 1000 );
    }
}
alert( "Finished saving screenshots" );

到运行这个,保存这个代码,比如Screenshots.jsee,然后select这个文件从Select... 菜单中。最后,select运行Screenshots.jseeMacros菜单中。

注意:如果目标文件夹中存在相同的文件名,当代码段工具提示覆盖时,宏将停止。请确保目标文件夹为空或目标文件夹中不存在相同的文件名。

如果出现错误,您可以通过按 Ctrl+Break(或 ESC 连续两次) 而 EmEditor 有键盘焦点。

第二种方法 Windows 10

这种方法应该比第一种方法更可靠、更快速。

  1. 首先,按Win+PrintScrn,确保截图保存在你的个人Pictures/Screenshots 文件夹。删除此文件,并确保文件夹为空。

  2. 全部关闭windows.

  3. 打开默认网络浏览器并最大化浏览器 window,然后关闭浏览器 window。

  4. 使用 EmEditor 打开包含 URL 列表的文本文件。 运行下面的宏。

Screenshot2.jsee

document.selection.StartOfDocument();
nLines = document.GetLines();
for( y = 1; y <= nLines; ++y ) {
    str = document.GetLine( y );   // retrieve an URL at a line
    if( str.length != 0 ) {
        document.selection.OpenLink();
        Sleep( 5000 );  // wait for the browser to become active and show the webpage completely

        shell.SendKeys( "{LWIN DOWN}{PRTSC}{LWIN UP}" );
        Sleep( 500 );
        
        shell.SendKeys( "%{F4}" );  // Press Alt+F4 to close web browser
        Sleep( 500 );
    }
    document.selection.LineDown(false,1);
}
alert( "Finished saving screenshots" );
  1. 您将看到保存在个人 Pictures/Screenshots 文件夹中的屏幕截图。请注意此文件夹路径和第一个文件名(和索引号)。例如文件名为Screenshot (13).png,索引号为13.

  2. 将下面的宏复制到Screenshot3.jsee,并更正文件夹名称(sFolder)和索引号(nIndex)。如果您使用的是非英语 Windows 并且文件名不是 Screenshot (...).png,您可能还需要更正文件名 (sFile1)。打开带有 URL 的同一个文本文件,然后 运行 这个宏。

Screenshot3.jsee

sFolder = "C:\Users\...\Pictures\Screenshots\";  // Screenshots folder where files are saved on [Win]+[PrintScrn]. Use double-backslashes "\".
sFile1 = "Screenshot (";   // screenshot file name before index number
nIndex = 13;               // index number of first screenshot, for example, 13 for Screenshot (13).png
sFile2 = ").png";          // screenshot file name after index number

fso = new ActiveXObject( "Scripting.FileSystemObject" );

document.selection.StartOfDocument();
nLines = document.GetLines();
for( y = 1; y <= nLines; ++y ) {
    str = document.GetLine( y );   // retrieve an URL at a line
    if( str.length != 0 ) {
        str = str.replace("http://", "");  // remove "http://" and "https://"
        str = str.replace("https://", "");
        if( str.charAt( str.length - 1 ) == '/' ) {  // remove the last slash character
            str = str.substr( 0, str.length - 1 );
        }
        str = str.replace(/[/<>:\|?*\"]/g, "-");   // replace invalid characters with "-"
        str += ".png";   // append ".png"
        
        sSrc = sFolder + sFile1 + nIndex + sFile2;
        sDest = sFolder + str;
        fso.MoveFile( sSrc, sDest );
    }
    document.selection.LineDown(false,1);
    ++nIndex;
}
alert( "Finished renaming screenshots" );