Visiting Multiple Links and Auto-saving Screenshots - url

There is something I want and I want to know if it is possible.
What I want is to visit multiple URLs and automatically save screenshots.
And if possible, the save name of the screenshot should be the same as its URL.
For example, would it be possible to do this with Excel or EmEditor?
Maybe with macro?
Is it possible to do this?
And if possible how can I do it?
EXAMPLE:
URLS: 3 Pieces (Or More)
https://stackoverflow.com/questions/one
https://stackoverflow.com/questions/two
https://stackoverflow.com/questions/three
Visiting these links automatically and saving screenshots as below.
Screenshots:
stackoverflow.com-questions-one.jpg
stackoverflow.com-questions-two.jpg
stackoverflow.com-questions-three.jpg
Note: The HTTPS:// part may not be in the registration name, as : and / signs will not be accepted during registration.
Also the / symbol has been replaced with a - sign.
Screenshots 2:
questions-one.jpg
questions-two.jpg
questions-three.jpg
Note 2: Even if the entire URL is not the filename. Just like above.
I visited a similar question.
However, the information presented did not do exactly what I wanted.
I tried the sample codes provided.
For example this code.
I opened an excel file and created a macro with VBA and ran it.
When the macro ran Internet Explorer opened and became Full Screen.
The page that opened was www.google.com.
Then the screenshot was automatically taken and saved in the WORD document.
This is not what I want.
Also; The other code in the question didn't work at all.
If the above example doesn't explain exactly what I want, please see the steps below.
Multiple URLs will be opened one by one automatically.
(It could be Internet Explorer & Chrome or Edge or anyone.)
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.
Wait 7 seconds for the text "Press the F11 key to exit full screen" disappears on the screen.
A screenshot will be taken and pasted into Microsoft Paint.
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.
IMPORTANT
I do not expect any service from you; I just don't have enough coding knowledge to do them.
To be frank, I do not have any information under the name of Code Information.
I respect the knowledge of each of you very much and I want you to know that I am sincere about it.
I'm just someone looking for a way to do what I want.
I don't expect anything from scratch on this; I'm just waiting for someone who needs help on the same issue before to share if they have any solution on this issue.

First Method for Windows 7, 8.1, 10
Close all windows first.
Open your default web browser and maximize the browser window, and close the browser window.
Press Win+R, and type SnippingTool.exe to run the Snipping Tool. click Mode button (or press Alt+M) and select Full Screen. Press Ctrl+S to show the Save As dialog box. I recommend creating a new folder (for example, Scrn), and save a screenshot in the new created folder, such as Scrn\screenshot.png. This is just a dummy screenshot, and you can delete it later. Doing this allows the following screenshots saved into this new same folder. Close the Snipping Tool.
Open the text file with a list of URLs with EmEditor. Please don't maximize the EmEditor window. I would recommend testing with a few URLs first. The text file should look like this:
https://www.emeditor.com/
https://stackoverflow.com/
https://www.google.com/
Run the macro (Screenshot1.jsee) below, and please don't touch keyboard or mouse until you see Finished saving screenshots in a dialog box.
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" );
To run this, save this code as, for instance, Screenshots.jsee, and then select this file from Select... in the Macros menu. Finally, select Run Screenshots.jsee in the Macros menu.
Notes: If the same file names exist in the destination folder, the macro will stop when the Snippets Tools prompts for overwrite. Please make sure the destination folder is empty or that same file names don't exist in the destination folder.
If something went wrong, you can cancel the macro by pressing Ctrl+Break (or ESC twice consecutively) while EmEditor has the keyboard focus.
Second Method for Windows 10
This method should be more robust and faster than the first method.
First, press Win+PrintScrn and make sure a screenshot is saved in your personal Pictures/Screenshots folder. Delete this file, and ensure the folder is empty.
Close all windows.
Open your default web browser and maximize the browser window, and close the browser window.
Open the text file with a list of URLs with EmEditor. Run the macro below.
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" );
You will see screenshots saved in your personal Pictures/Screenshots folder. Note this folder path, and the first file name (and the index number). For example, if the file name is Screenshot (13).png, the index number is 13.
Copy the macro below to Screenshot3.jsee, and correct the folder name (sFolder) and index number (nIndex). If you are using non-English Windows and the file name is not Screenshot (...).png, you might also need to correct the file name (sFile1). Open the same text file with URLs, and then run this macro.
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" );

Related

Pointer Stuck at the Edge of Iframe Image in Clarity-Devtool

Dear Microsoft Clarity Team,
I hope this message finds you well. I have been testing the Clarity-Devtool and I noticed an issue while using it. When I move my pointer over an iframe image, the pointer gets stuck at the edge of the image and does not move inside the iframe.
I was wondering if there is a way to resolve this issue so that the pointer can move inside the iframe image as well. I understand that Clarity does not support viewing the content of the iframe, but I believe that moving the pointer over the iframe area should be allowed.
This would greatly enhance my experience with the Clarity-Devtool and provide me with more accurate insights into user behavior.
I also added it sandbox="allow-same-origin allow-scripts allow-pointer-lock" but it does not work also
enter image description here
function mouse(event: Event, root: Node, evt: MouseEvent): void {
let frame = iframe(root);
let d = frame ? frame.contentDocument.documentElement : document.documentElement;
let x = "pageX" in evt ? Math.round(evt.pageX) : ("clientX" in evt ? Math.round(evt["clientX"] + d.scrollLeft) : null);
let y = "pageY" in evt ? Math.round(evt.pageY) : ("clientY" in evt ? Math.round(evt["clientY"] + d.scrollTop) : null);
// In case of iframe, we adjust (x,y) to be relative to top parent's origin
if (frame) {
let distance = offset(frame);
x = x ? x + Math.round(distance.x) : x;
y = y ? y + Math.round(distance.y) : y;
}
console.log('pointer.ts Intersection x:' + x + ' y:' + y);
// Check for null values before processing this event
if (x !== null && y !== null) { handler({ time: time(), event, data: { target: target(evt), x, y } }); }
}
I added console.log('pointer.ts Intersection x:' + x + ' y:' + y); to the \src\interaction\pointer.ts
to track the pointer location
I see it in the console the coordinates but tbe pointer does not move into the frame image.
Here is the link to my test website https://thankful-pond-0d14a730f.2.azurestaticapps.net/
I'm using the Clarity Devtool Extension
It contains two iframes.
The Iframe on the top (green) has a source URL to a local file on the same domain src="/myLocalIframe.html, and it works as expected.
enter image description here
The one on bottom (red) has a source URL to a different website https://kind-moss-07698f50f.2.azurestaticapps.net/ , and it does not work
enter image description here
Here is the [Decoded Data (Page)]
enter link description here
Let me know if this help you debug it from your end.

(Adobe Animate ActionScript) how can iRemove specific Symballl's from the stage using name, arry, and lib()?

I'm super frustrated with this.
first for you to understand my code - My goal here is for the user to get randomly selected word appear to them in a way that every letter sits inside of a box.
Then if the user clicks on a button called "Pick a word", another word will be selected and the correct number of boxes will appear.
I have an array of words like this:
var word_group_1 = ["abolsh", "absorbent", "betrayal", "frutish", "commensurate", "eonfident", "zite"]
I'm using this function to select a random word from that array then splice it.. works perfectly:
function random_word_genereator() {
random = randomNumber(0, word_group_1.length);
//putting the chosen word from array in the chosen word variable
chosen_word = word_group_1[random]
//after we used the chosen word were removing it from the away
word_group_1.splice(random, 1)
//splitting the chosen word into an array
chosen_word_letters_arry = chosen_word.split("")
}
in a button click of "pick a word"- I'm creating 5 instances of a Movieclip I have in my library (just a blue box to put text in it) with text in at like this:
function create_boxes(e)
{
//to know which word has been displayed to the user//
old_word=chosen_word
random_word_genereator()
for (i=0;i<chosen_word.length;i++){
cell_boxes = new lib.cell_box();
stage.addChild(cell_boxes)
cell_boxes.name="cell_box"+i;
cell_boxes.x=(xlocation * i) + 50
cell_boxes.y = 80;
output = new createjs.Text();
cell_boxes.addChild(output)
output.text=chosen_word_letters_arry[i]
}
everything works fine on the first click As You Can View Here.
The word being selected and displayed on the stage
my problem is when I'm clicking Again on the button "pick a word"
its not deleting the correct number of boxes.
I'm putting visible false to the boxes which holds the "Old word" (the one I need to delete)
but As you can se here After I click again its getting messed up.
sometimes its's working, switches from 12 letter word, to a 4 one.
but it should be luck. I'm dying to get this to WORK! its for my school project.
Please help me!
Easy answer that will plug and play into your code:
js
...
//to know wichh word has been displayed to the user//
old_word=chosen_word
random_word_genereator()
for (i = 0; i < stage.numChildren; i++) // Loop through all children of the stage
if (stage.getChildAt(i) is lib.cell_box) // Checks if the child is a lib.cell_box
stage.removeChildAt(i--); // Removes child from stage and decrements i
for (i=0;i<chosen_word.length;i++){
...
Original answer (cleaner code, some restructuring):
It's best to break this kind of logic down into steps.
var boxes:MovieClip = new MovieClip();
boxes.y = 80;
addChild(boxes);
...
function createBoxes(word:String):void {
// Remove boxes first
while (boxes.numChildren > 0)
boxes.removeChildAt(0);
// Add boxes
for each(var c:String in word.split("")) {
var box:Box = new Box(c);
box.x = boxes.width + 50;
boxes.addChild(box);
}
}
Then set the text inside a Box class.

Can't calculate the right Volume RSI in MQL4 with a functioning Pine-Script Example

I want to "translate" a Pine-Script to MQL4 but I get the wrong output in MQL4 compared to the Pine-Script in Trading-view.
I wrote the Indicator in Pine-Script since it seems fairly easy to do so.
After I got the result that I was looking for I shortened the Pine-Script.
Here the working Pine-Script:
// Pinescript - whole Code to recreate the Indicator
study( "Volume RSI", shorttitle = "VoRSI" )
periode = input( 3, title = "Periode", minval = 1 )
VoRSI = rsi( volume, periode )
plot( VoRSI, color = #000000, linewidth = 2 )
Now I want to translate that code to MQL4 but I keep getting different outputs.
Here is the MQL4 code I wrote so far:
// MQL4 Code
input int InpRSIPeriod = 3; // RSI Period
double sumn = 0.0;
double sump = 0.0;
double VoRSI = 0.0;
int i = 0;
void OnTick() {
for ( i; i < InpRSIPeriod; i++ ) {
// Check if the Volume is buy or sell
double close = iClose( Symbol(), 0, i );
double old_close = iClose( Symbol(), 0, i + 1 );
if ( close - old_close < 0 )
{
// If the Volume is positive, add it up to the positive sum "sump"
sump = sump + iVolume( Symbol(), 0, i + 1 );
}
else
{
// If the Volume is negative, add it up to the negative sum "sumn"
sumn = sumn + iVolume( Symbol(), 0, i + 1 );
}
}
// Get the MA of the sump and sumn for the Input Period
double Volume_p = sump / InpRSIPeriod;
double Volume_n = sumn / InpRSIPeriod;
// Calculate the RSI for the Volume
VoRSI = 100 - 100 / ( 1 + Volume_p / Volume_n );
// Print Volume RSI for comparison with Tradingview
Print( VoRSI );
// Reset the Variables for the next "OnTick" Event
i = 0;
sumn = 0;
sump = 0;
}
I already checked if the Period, Symbol and timeframe are the same and also have a Screenshoot of the different outputs.
I already tried to follow the function-explanations in the pine-script for the rsi, max, rma and sma function but I cant get any results that seem to be halfway running.
I expect to translate the Pine-Script into MQL4.
I do not want to draw the whole Volume RSI as a Indicator in the Chart.
I just want to calculate the value of the Volume RSI of the last whole periode (when new candel opens) to check if it reaches higher than 80.
After that I want to check when it comes back below 80 again and use that as a threshold wether a trade should be opened or not.
I want a simple function that gets the Period as an input and takes the current pair and Timeframe to return the desired value between 0 and 100.
Up to now my translation persists to provide the wrong output value.
What am I missing in the Calculation? Can someone tell me what is the right way to calculate my Tradingview-Indicator with MQL4?
Q : Can someone tell me what is the right way to calculate my Tradingview-Indicator with MQL4?
Your main miss of the target is in putting the code into a wrong type of MQL4-code. MetaTrader Terminal can place an indicator via a Custom Indicator-type of MQL4-code.
There you have to declare so called IndicatorBuffer(s), that contain pre-computed values of the said indicator and these buffers are separately mapped onto indicator-lines ( depending on the type of the GUI-presentation style - lines, area-between-lines, etc ).
In case you insist on having a Custom-Indicator-less indicator, which is pretty legal and needed in some use-cases, than you need to implement you own "mechanisation" of drawing lines into a separate sub-window of the GUI in the Expert-Advisor-code, where you will manage all the settings and plotting "manually" as you wish, segment by segment ( we use this for many reasons during prototyping, so as to avoid all the Custom-Indicator dependencies and calling-interface gritty-nitties during the complex trading exosystem integration - so pretty well sure about doability and performance benefits & costs of going this way ).
The decision is yours, MQL4 can do it either way.
Q : What am I missing in the Calculation?
BONUS PART : A hidden gem for improving The Performance ...
In either way of going via Custom-Indicator-type-of-MQL4-code or an Expert-Advisor-type-of-MQL4-code a decision it is possible to avoid a per-QUOTE-arrival re-calculation of the whole "depth" of the RSI. There is a frozen-part and a one, hot-end of the indicator line and performance-wise it is more than wise to keep static records of "old" and frozen data and just update the "live"-hot-end of the indicator-line. That saves a lot of the response-latency your GUI consumes from any real-time response-loop...

MQL4 iCustom returns always the same (wrong) value (0x7FFFFFFF)

I wrote a custom indicator Speed.mq4 as follows:
double SpeedBuffer[]; // a Custom Indicator BUFFER
int OnInit() {
SetIndexBuffer( 0, SpeedBuffer ); // an access INDEX 0->BUFFER
...
}
int OnCalculate( const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
) {
int start;
if ( prev_calculated == 0 ) start = 1;
else start = prev_calculated - 1;
for ( int i = start; i < rates_total - 1 ; i++ ) { // CPU-WASTED BY AN INEFFICIENT BACK-STEPPING IN TIME
double curTypical = typical( high[i], low[i], close[i] );
double prevTypical = typical( high[i+1],low[i+1],close[i+1] ); // CPU-WASTED, NO NEED TO RECALC ...
double curSpeed = curTypical - prevTypical;
SpeedBuffer[i] = curSpeed;
}
//--- return value of prev_calculated for next call
return( rates_total );
}
The indicator works fine in the application and the chart is plotted correctly.
When I try retrieving the last value in the ExpertAdvisor I always receive the same value:
double speed = iCustom( NULL, 0, "Speed", 2, 0, 0 );
Print( "speed is: " + speed );
prints:
speed is: 2147483647
It's always the same number. I'm not sure where's the problem.
from the Print in the indicator I can see the values are calculated correctly. but when I use iCustom I receive only that value.
MQL4 Custom Indicator iCustom() mechanics
MQL4 and even the New-MQL4 ( sometime called an MQL4.5 ) use a rather complicated interfacing model to handle Expert Advisor call / Custom Indicator computations.
A first thing to realise is, that iCustom() is not a call to a function, but rather a method, that indirectly "asks" a by-a-filename referred Custom Indicator to retrieve one, specific, value from a "pre-calculated" DataSTORE.
While it may sound complicated, it is the very nature of a CPU-efficient calculation factory, that the Custom Indicators were designed for in the early days of MQL4 world.
iCustom() is thus just a syntax-sugar to initiate the retrieval method, that gets the relevant piece of pre-calculated value back into the hands of Expert Advisor.
Custom Indicators put all the pre-calculated values into BUFFER(s), co-aligned with the TimeSeries style of ordering the DataSTORE cells ( [0] == "Now, the current Bar", going forwards [1], [2], [3], ... deeper and deeper back into the history )
The iCustom() passes the shift value, as a number of bars -- i.e. how deep into the history the retrieving method has to go, so as to pick the requested value from the respective BUFFER, and also the BUFFER identification INDEX ( 0 in our case above, as there is just a single BUFFER, with INDEX == 0 ). This is used for the sake of the EA being fully agnostic of the Custom Indicator internal variable names et al.
Just ask which BufferINDEX for which BarNUMBER one wants the value to be read from.
The Buffer is the one, who is to be blamed for the (wrong) value
The first line of the code says:
double SpeedBuffer[]; // a Custom Indicator BUFFER
If not handled otherwise in OnInit(){} all cells in the SpeedBuffer will have
EMPTY_VALUE
Empty value in an indicator buffer has by default this value == 2147483647 (0x7FFFFFFF) as has been objected above.
Q.E.D.
One may state in OnInit(){ ArrayInitialize( SpeedBuffer, 0.123456 ); } to have any other value for a cell-initialisation ( that for a TimeSeries-alligned BUFFERs happens upon each new-Bar event ( all cells get reshuffled by one backwards & cell[0] becomes "empty", pre-loaded with a default value discussed here ) ).
One may also add a step in an indicator OnCalculate(){ ... SpeedBuffer[0] = -9.87654; ...} so as to avoid leaving the cell[0] in a context-inconsistent state, not in a "just"-initialised state / value.
Caller-side interface ( how to reduce a risk on a weak-integration interface )
Nevertheless, the responsibility of the value retrieval is on the Expert Advisor side, as it fills the parameters of the iCustom() interface-proxy.
One may use preventive steps as shown in >>> https://stackoverflow.com/a/26389823/3666197
to minimise a risk of improper parameters ordering / values once calling an external Custom Indicator(s) to retrieve a set of values.
This simple method may save you literally tens of man*days of testing/debugging once a rich-extern-parametrised Custom Indicator with several indicator buffers has fallen into suspects due to serving "wrong" numbers ( just due to iCustom() call parameters being "invisibly" out of proper order/context )
Another thing to keep in mind when a custom indicator shows different values on the chart then are reported to the ExpertAdvisor, is that the execution flow through OnCalculate() needs to be different for an ExpertAdvisor than it is for a chart; specifically, the chart initially kicks off a call to OnCalculate() with prev_calculated = 0, whereas an EA (whether run with Strategy Tester or live) will always have prev_calculated = rates_total-1, so that the number of bars to compute the indicator value for is rates_total - prev_calcualted = 1 (ie. just the current bar).
You do account for this in your code, by setting start, but in general for a complicated indicator (that often involves referencing more than just the previous bar) one needs to be mindful of this difference and never assume that if the indicator looks good on the chart that means it's actually working. It needs to be tested separately with an EA.
I reviewed my code and finally figured that:
double speed=iCustom(NULL,0,"Speed",2,0,0);
was using the last value, which was not yet calculated by the custom indicator,
changing it to:
double speed=iCustom(NULL,0,"Speed",2,0,1);
did the trick.

simple action script 2.0 click 4 check boxes

I have an action script 2.0 request.
I have a flash movie with 7 check boxes. When the user has selected a total of 4 check boxes the flash movie goes to another frame.
I'll contain all the checkboxes in a movie clip called mcCheckBox.
I just need to the code to make it go to a new frame once four check boxes have been selected.
you need to create a counter that is incremented each time a checkbox is clicked , when the counter value is 4 , go to the next frame.
also you may have to keep an array of the boxes have been checked, in case a second click unchecks the box , in which case you would decrement the counter.
edit:
i don't use as2 , so i can only give you an example in as3...
i've added an Array of all the checkboxes names in order to filter the click events, if you click outside a checkbox, the event would be registered but you don't want to proceed with the code
import flash.events.MouseEvent;
var counter:int;
var allNames:Array = ['cb1', 'cb2' , 'cb3' , 'cb4'];
var boxesList:Array = [];
stop();
addEventListener(MouseEvent.CLICK , clickHandler );
function clickHandler(event:MouseEvent):void
{
var boxName:String = event.target.name;
//make sure the target is one of the checkboxes
if(allNames.indexOf(boxName ) != -1 )
updateCounter(boxName);
}
function updateCounter(bName:String):void
{
var index:int = boxesList.indexOf(bName);
if( index == -1 )
{
//add to the list of checked boxes
boxesList.push(bName );
//increment counter
++counter;
}else{
//remove from the list of check boxes
boxesList.splice(index , 1 );
//decrement counter
--counter;
}
if(counter == 4 )
gotoAndStop('nextFrame');
trace( counter );
}

Resources