How to add click actions to go through list of links inside a variable ? Power automate desktop - power-automate

I have simple flow:
1- Launch new Chrome with url `https://www.google.com/search?q=2022+games`
2- Extract data from web page into variable `%DataFromWebPage%`
Here is the flow
Here is the data:
How I can visit or click each link in the %DataFromWebPage% variable ?

Not really sure if you just want to know how to access the items in the variable %DataFromWebPage% or need to navigate to the urls in the list and then extract data from each page.
It looks like you extracted the information into a data table/list so you can access the values using the index or the name. see the microsoft website
In your example you can use a loop or for each loop and navigate to each page.
Copy either of the 'code' sections below and paste it in your flow.
LOOP FOREACH currentRow IN DataFromWebPage
WebAutomation.GoToWebPage.GoToWebPage BrowserInstance: Browser Url: currentRow[1] WaitForPageToLoadTimeout: 60
END
or use a loop
LOOP LoopIndex FROM 0 TO DataFromWebPage.Count - 1 STEP 1
WebAutomation.GoToWebPage.GoToWebPage BrowserInstance: Browser Url: DataFromWebPage[LoopIndex][1] WaitForPageToLoadTimeout: 60
END

This worked with me with for each loop and %currentitem[1]%

Related

Optimize multiple http calls in each item in listview Flutter

I have have an infinite listview in flutter and each item on that list need to make http call to get some data from server. I want to optimize call when user scroll i want to prevent item from making http call.
Any idea to make that
A great solution, used by most of mobile apps is to fetch your cells depending on the scroll. Initially, you can load for instance 20 cells and when the user reaches the end of the list, make another call in order to load 20 more cells.
You can handle the user's scroll like so:
var scrollController = ScrollController();
scrollController.addListener(scrollListener);
double maxScroll = listScrollController.position.maxScrollExtent;
double currentScroll = listScrollController.position.pixels;
if (maxScroll == currentScroll) {
// fetch more cells
}
Two ways to optimize could be:
ListView.builder(): Use the builder to construct items lazily. This can be used to avoid having bulk http calls at the beginning (items are built as user scrolls).
Cache: Cache the http calls for the duration based on your needs.
I found litle solution for my problem.
I used library visibility_detector (https://pub.dev/packages/visibility_detector)
In each item ,I wait for 2 second if the item still visible I make http call if not i do nothing

how can i retrieve 10 random documents on docpad?

I have a folder called 'clients' with 30 images inside, and i want to return from docpad 10 random images every time I load the page. is that possible? I've searched for returning random stuff with docpad and didn't find any documentation about it.
The docpad skeleton "Kitchen Sink" has an example of generating a random number on each page load. See the Dynamic Content page.
The key point is to set the dynamic property in the page metadata to true (dynamic: true). You will also need to make sure you have the docpad plugin "cleanurls" installed (docpad-plugin-cleanurls) - not immediately obvious.
After that its just a matter of using the standard javascript Math.random. I'm using something like this to get a random post in my .eco file
<%=i = Math.floor((Math.random()*10))%>
<% document = #getCollection('posts').toJSON()[i] %>
Hope that helps
Edit - Jade Example
- var i = Math.floor((Math.random()*10))
- var doc = getCollection('posts').toJSON()[i]
The dash before the 'var' statements is important. see https://github.com/visionmedia/jade#a8

Path to CKEditor in CakePHP app on Zeus server

I'm integrating CKEditor into a CakePHP app which is running on a Zeus server (and therefore can't use .htaccess - I have to use rewrite.script instead). Problem is, the paths that CKEditor puts into the head section of the page don't work, so the editor won't load.
For instance, one generated path is:
http://www.example.com/js/ckeditor/config.js?t=B8DJ5M3
If I go to
http://www.example.com/js/ckeditor/config.js
I can see the file, but as soon as I add the ?t=B8DJ5M3 on the end, Cake complains that it can't find the jsController.
I'm not sure what to do about this - whether to dig around in CakePHP, CKEditor or the rewrite.script files! What should I try next?
That query string on the end of your URL is used to make sure the file isn't cached. Seems like something in your GET request configuration/routing on the Zeus server is trying to locate that exact file including the query string. You're going to need to create a Rewrite that performs a goto on the URL minus the query string. I found a pretty solid article in the Drupal forums where someone put together a script that may help you: http://drupal.org/node/46508
RULE_0_START:
# get the document root
map path into SCRATCH:DOCROOT from /
# initialize our variables
set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}
# see if theres any queries in our URL
match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:
And from there, handle your goto minus the query string. Hope that helps
You can do this
In the view where you want to display the editor, put the following script on the top of the page (or somewhere before textarea which you want to contain editor):
<?php echo $this->Html->script('ckeditor/ckeditor');?>
This scipt will include the "webroot/js/ckeditor.js" file to your view.
Create the textarea and give it a class named "ckeditor"
<?php echo $this->Form->textarea('content',array('class'=>'ckeditor'))?>
Voila! The editor is now displaying instead of raw textarea.

Changing Views in a Module pops me into the Admin Skin

This question has probably been the most covered question in all of DotNetNuke's lifetime but I'm going to ask it here in StackOverflow because I need an answer, a really good one that doesn't make me look the other way. Thanks in advance to all DNN experts.
I've researched many ways of making this work for me and i've seen Michael Washington's solutions (Panels, MultiViews, ...) and Will's (Strohl) blog post on DotNetNuke's personalization engine through setting SkinSrc which is useful, as well as reading through Default.aspx's code which has given me more insight, however, i'm still faced with the problem that calling EditUrl()/NavigateUrl() brings me to a page with a single module in admin skin or a page with nothing respectively.
The specific version is DotNetNuke 6.0.1 (DNN). This Module has 4 other views in addition to the main view which I desire to navigate through sequentially. e.g.
Begin Checkout -> Collection of Delivery Details -> Confim Order
Have you found a solution?
I want to achieve
1) Module loads with other modules around. No module isolation
2) Views in a module that don't Preload e.g. Page_Load in each view gets called when the Module loads up
Help!
Assuming you are asking this as the module developer, the solution is to not use DNN's mechanism for specifying a control. So, you can't use EditUrl or specify the ControlKey in the NavigateURL call (which both generate "ctl=mycontrol" in the URL). Instead you need to have your module display your various controls based on the Query String parameters. So, you'll generally have a control in your module who's primary purpose is to dynamically load other controls based on the query string. So, for instance:
You will start with your control that lists items. You'll have a "Buy Now" button for each item. The hyperlink for each item can be generated by calling
NavigateURL(TabID, "", "View=BeginCheckout", "itemid=" & id, "mid=" & mid)
2.) On the page load of the handler control, it looks to see if anything is specified for the "View" Querystring parameter. If not it displays the listing control, if so, it displays the corresponding control.
Dim controlPath As String
Dim path as String = "~/DesktopModules/MyModule/Controls"
Select Case Request("View")
Case "BeginCheckout"
ControlPath = path + "BeginCheckout.ascx"
Case "DeliveryDetails"
ControlPath = path + "DeliveryDetails.ascx"
Case "ConfirmOrder"
ControlPath = path + "ConfirmOrder.ascx"
Case Else
ControlPath = path + "ItemList.aspx"
End Select
If System.IO.File.Exists(Request.MapPath(controlPath)) Then
placeholder.LoadControl(controlPath)
Else
Throw New Exception("Unable to load selected template. Please go into module settings and select a list and details template.")
End If
Most of the advanced modules for DNN do something along these lines so there's plenty of sample code out there. I would guess some of the core modules do something similar. I adapted the code above from Efficon's Articles module for DotNetNuke.

how count downloads of a file with jquery

Anyone knows some jquery plugin to count how many times a file (pdf, in my case) is download from your server??
you can simply use the google analytics javascript API with an onclick event
Then you can have beautiful charts for your downloads. see here for an example case : http://think2loud.com/use-jquery-with-google-analytics-to-track-clicks-on-outgoing-links-from-your-site/
You can create script download.php that count your download links.
<?php
// connect to database
if (isset($_GET['file'])) {
$file = mysql_real_escape_string($_GET['file']);
$query = "insert into downloads VALUES('$file', 1) on duplicate key " .
"update count = count + 1;, count+1)";
mysql_query($query);
}
?>
downloads table is:
create table downloads(file VARCHAR(255) primary key, count integer default 1)
and in jQuery
$('a.download').click(function() {
//empty function don't care what I get.
$.get('download.php', {file: $(this).attr('href')}, function() {});
});
it call download.php script with href attribute on every link that have download class
UPDATE I forget to add return false because in code above it call ajax and then abort it.
$('a.download').click(function() {
var link = $(this).attr('href');
$.get('download.php', {file: link}, function() {
// change url to link when ajax is finished
window.location = link;
});
// prevent following the link
return false;
});
You can also add code that prevent multiply clicks because there will be delay between ajax call finish and changing url to link of a element (user may click few times because it will not folow the link) and you can add CTRL+click because it open link in other window (you can return true in this case).
You can use jQuery to determine how many times a single user clicks on a given link on a given fully-rendered page, and use that value to update a database table of download clicks through AJAX, but jQuery doesn't have any direct insight into your server-side data as relates to the total number of downloads, you would have to be updating a database with that data and displaying it from there. you could use jQuery to watch and see if that value changes (on a timer maybe) and update your page accordingly, butthat still requires a AJAX call to a database lookup.
jQuery is a library for Javascript with is a client-side language and acts on the page once it is downloaded and running on the client's machine and as such is not the place for server-side logic and lookups except in the cases where AJAX is warranted and needed.
This is impossible. jQuery code runs in a user's browser, not on a server. To count downloads you'll need server-side code.
jQuery alone won't be able to do that.
You would have to keep track on the server each time the file is requested.
Is there anyway to modify the above script to allow only 1 download per user in a set period of time based on the date they joined the site, i.e. the user can only download the file once per year starting from the day they joined the site?
I'm using Wordpress to run my site.
Thanks

Resources