📜 ⬆️ ⬇️

Postponing Vkontakte using xStarter


Again social. network?


I want to share with the habrasoobshchestvom its simple decision deferred posting VK. Yes, I was also skeptical about advertising in social. networks, but it's stupid not to try. Daily attendance of this resource is comparable to yandex.ru ( proof 1 proof 2 ), not to mention the fact that this is just the best place for “directed” advertising.

A little help.
My group is dedicated to Steampunk and Dieselpank, on the basis of which, then, my bride and I will create a photo shop with rental of handmade costumes. A news site on this topic (Steam, Diesel, Victorian Era) is currently under development. All we pull on our own.

And so let's say that you also chose Vkontakte and already use the page / group as an advertising platform and really want your posts to be viewed by the greatest number of people. What is the best time for this? It must be prime time . I just think that experienced bloggers and “admins” of popular communities would argue with this statement, so I am waiting for comments.
')
The main thing is that no matter what time is the most “bread”, it is not necessary to spend it sitting at the computer. After all, we all know that life is short, well, blablabla ...

And my service is better
Question: And my service is better * service name, why not use it?
Answer: You're brilliant * habrauser, that he found his decision and wrote such a valuable comment.
Twice well done, if you leave the source. And yes, there are many good, paid and free services that cope with this rather trivial task with a bang.

I'm not saying that my decision is the only one, the best, or that it, Krsna forbid, is the ideal

We come to the point


What is xStarter help off. site:
xStarter automates the daily tasks of the scheduler or system events.

In fact, this program was created for such mediocre as I am. From the very childhood, looking at any programmer, as a person with magical power, naturally dressed in a pointed hat and with a staff in the odds of going to save some of his Endor. This look is clouded. Not even, he is poisoned by boundless bitterness and envy. I am almost serious.

xStarter is able to automate hundreds of different tasks that you perform on Windows every day. For example: running commands on a schedule, programs, pressing the keys and mouse over the coordinates, tracking changes in the file system, and the like. In fact, we are faced with a very advanced macro editor. Needless to say, how much does it save time? The developer claims that as much as 30%. Hmm ... Well, it may well be.

What about * nix?
Question: And nix?
Answer: Unfortunately not, I did not find an analogue. Tell me, I will be grateful
Why not autoit?
Q: Why is xStarter better than AutoIT or * my favorite programming language.
Answer: Occam's razor. I did not find a simpler way for myself, given that I did not write a single line of code in my life. However, while I was developing this method, I decided to continue to study something serious in the future. I hope that in the same measure it may push other people far from programming who will read this post to the end and try to do something of their own.

In addition, unlike AutoIT, xStarter has a damn-friendly interface for writing your own scripts.
Most importantly, you can immediately start working in it, while only occasionally remembering that you can sometimes open a certificate. It is also interesting that the mention of xStarter on Habré is quite rare.

We will not study the program interface for a long time and tediously, but rather proceed directly to the construction of the problem itself. Already there, step by step, we will consider each of the actions and how they work.
Preliminary: I created several directories, each of which is the name of a group section. For example, on C: \ VK \ Post \ there are 7 subdirectories: Art, Boys, Girls, CG, Modding, Photo, Transport.
Within these 7 directories are also several subdirectories, each of which is already the post itself.
The post should be of this type - several images and one * .txt file with the article.

Here, for clarity, I sketched a diagram:


Now otpetrosyanovshis enough, we continue

Rushed. Open xStarter and create a new task.


Immediately we estimate what time it will be executed. Suppose we specify that the task runs on a schedule, once every half an hour. Why so wise with the schedule you ask? Yes, you can simply put a 30-minute interval of execution, but only with the help of the schedule you can run the update of several categories of groups within the same task.

Set ourselves three variables:
SerVariable1 browser = path to the web browser for further launch.
SerVariable2 VKFolders = path to Vkontakte categories on a local disk
SerVariable3 groudID = link to group
This is not necessary, but it will be easier to make out some points, and it will be easier for you to change them for your own:
Screen

Launch the browser:
RunProcess1 Run = [browser] in the parameters we write - start-maximized [groudID]
Screen

Create a new GetTextBlockN action and specify the name of the categories. We also take into account the fact that the section name will be taken from the line with the number that coincides with the hour of launching the task. Simply put, if the automatic start time is 18:00 or 18:40, the 18th row will be returned.
GetTextBlockN1 Num = [HOUR] (current hour).
Screen

Let the news for publication be selected randomly, and for this you need to specify the following:
SearchFolders1 Dir = [VKfolders] \ [GetTextBlockN1.TextBlock]
This is a directory search inside the section that GetTextBlockN1 issued.
Random1 Min = “1", Max = "[SearchFolders1.Count]"
Reset random number, between 1 and the total number of found directories in the section.
GetTextBlockN2 Text = "[SearchFolders1.DirNames]", Num = "[Random1.Random]"
Returns a random string from a list of directories in SearchFolders1
Screen

Again, this is not necessary, but to make it easier for us, we will create another variable from the obtained data:
SerVariable4 New = [VKfolders] \ [GetTextBlockN1.TextBlock] \ [GetTextBlockN2.TextBlock] \
Screen

Use the new variable to search for image and text files inside directories:
SearchFiles1 [New] by mask * .txt
We are looking for a * .txt file with the text for the news.
ReadFromLog1 Text = [SearchFiles1.Files]
If such a file is not found, then do not worry, then only images will be published.
SearchFiles2 [New] by mask * .jpg; *. Png
This is an image search, similar to SearchFiles1.
Screen

Create a keystroke action in the browser for a new message.
And yes, to start the Java console, you will need the Web Developer extension (suitable for most browsers except IE)

Surely you can do with one team, but honestly, I don't know jquery badly, so:
Sendkey1
{DELAY 3000} ^ + (j) {DELAY 1000}
$ (("Textarea ## post_field.fl_l")). Focus (()); {DELAY 300}
$ (("Span.add_media_lnk")). Click (()); {DELAY 300}
$ (("A.add_media_type_1_photo.add_media_item")). Click (());
{DELAY 300}
Screen

The most famous cap in the world, asks to clarify that {DELAY} is a pause in ms. Accordingly, depending on the workload of the browser, the speed of the channel and everything else, you may have to look for your optimal values. Everything works for me on two completely different configurations.

Again, because of the ignorance of the basics of jquery, there is still a small crutch in our sea. To start the file download dialog, you need to add a left-click on the element on the site itself. Sorry, guys.


MouseMove1
The necessary coordinates can be obtained in the task itself, simply by pointing the cursor at the required space.
MouseClick1
Coordinates for a resolution of 1920 to 1080 are approximately as follows:
Screen

Next, go to the random directory with the news:
Sendkey2
{DELAY 1000} [New]
{DELAY 100} {ENTER}
Screen

Now you need to bring a list of files with graphics in the divine form:
ReplaceText1 [SearchFiles2.Files]
C:\ "C:\
ReplaceText2 [ReplaceText1.ResultText]
.jpg .jpg"
ReplaceText3 [ReplaceText2.ResultText]
.png .png"
ReplaceText4 [ReplaceText3.ResultText]
Delete the path to the file
[New]
ReplaceText5 [ReplaceText4.ResultText]
“
” “ “
Screen

The resulting list of files of this format: “file1.jpg” “file2.png” “file3.jpg” - we feed the browser to upload files:
SendKey3 [ReplaceText5.ResultText] {DELAY 1000} {ENTER} {DELAY 1000}
Screen

Click on the window to create a new message:
MouseMove2
Search for your own coordinates.
Mouse Click2
Screen



Send the text to the dialog box:
SendKey4 {DELAY 500} ## Tag ## Tag [GetTextBlockN1.TextBlock]
[ReadFromLog1.Text] {DELAY 1000} ^ ({ENTER}) {DELAY 2000} ^ (w)
The first line is tags. For example, I use # steampunk and #Steam (changes depending on the schedule).
The second is the text that was in * .txt. The third is to send a message and in two seconds the browser tab is closed.
Screen

Finally, delete and move used files:
Move1 [SearchFiles2.Files] in C: \ VK \ done \ [GetTextBlockN1.TextBlock] \
Delete1 [SearchFiles1.Files]
Screen

You can see in my group what comes out of it in the end.

I also recommend that, after creating the variables, add an action to delete empty directories.
Sometimes Chrome keeps an explorer and does not allow it:
DeleteEmptyFolders [VKfolders] \

I didn't understand anything, let me pick it up ready


And so are the people.
Of course, at first glance it may seem difficult, but you can take a ready-made script and modify it.

So what else can you do to further improve this task?
The easiest way is to create the same task, but only to add the ability to select a section for publication at startup. Or, for example, you can attach unique watermarks to your images. Add a check from the series - isn't it time to replenish the section?

With various ways of notification. You can even run the task not on a schedule, but using SMS (if you have a GSM modem).
As part of the rest - you can create tasks for automatically downloading mp3 files, with the publication. You can even use xStarter to promote the group itself.

In general, if the omnipotent UFO will take this article with a bang, then be sure to wait for new ones. Thanks for attention!

Source: https://habr.com/ru/post/202174/


All Articles