Automatic-control-question - macros

How can I create a program that controls my computer based on commands which I have entered ahead of time.
For example:
My application should at 6pm enter facebook, enter my user credentials to log me in, and then leave a comment in the comment field which I have entered at 1PM.
Told means commend that I stored in this software.
My background is c++ and I realize programming philosophy since I program in machine language-I'm electrical engineer.
Thanks

Is this just for your own personal usage?
If so, I would advise not actually trying to develop an application yourself for this but instead use a Macro program. About 8 years ago when I was extremeley inexperienced at programming or doing anything, I used some macro programs to create bots in games, so doing something as trivial as logging you in would be simple.
Just have it..
Launch C:/Program Files/Mozilla/Firefox.exe (or something similar)
Press F6
Type: "http://www.facebook.com"
Press ENTER
Check pixel at local XXX x YYY to see if you are already logged in, in which case you don't need to enter your username and password
If you are not logged in, move mouse to coords XXX and left click.
Type username
Repeat for password.
Press ENTER
Navigate to profile.
Check the time on your system. If time is not 1PM, wait one minute and try again.
Repeat above.
Time is now 1PM so post your message.
End macro.
You could make that using a program like Macro Express within about 10 minutes. It also has a Capture editor, so that you can record your own macro and then edit it as you require.
http://www.macros.com/
This answer obviously assumes it is for personal usage.

Related

VBS: Word.Documents.Open fails unattended [duplicate]

I have an Access VBA macro that generates a report, saves it in .pdf and then sends it by e-mail using CDO. Everything works fine if I run it manually or if I set it to be run on Task Scheduler with the security option "Run only when user is logged on". However, if I set the option to "Run whether user is logged on or not" (even with the option "Run with highest privileges") the program crashes on the second line of:
strFileFullPath = CurrentProject.Path & "\Test Report.pdf"
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFileFullPath
with the error
Microsoft Access can't save the output data to the file you've
selected.
I am pretty sure that this happens because the macro runs with other user in the background. I have been searching for a solution but all I have found is that it is not possible and that I should change for other printing methods, such as PDF Creator (which brings a lot of other issues).
I am using Access 2016 in Windows Server 2012 R2 Standard.
It sounds crazy, but after a few days with no results, I managed to solve my problem just by creating these two empty folders:
C:\Windows\System32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop
All the credits to Faye's comment on the bottom of this page: https://blogs.technet.microsoft.com/askperf/2015/02/18/help-my-scheduled-task-does-not-run/
Although the comment regards Excel, it solved my issue on Access. It seems that is related with Office having trouble with running some processes (in my case, a pdf generation) in non-interactive mode (which is the mode that Task Scheduler runs when "Run whether user is logged on or not" is checked).

gnome disable "Log in as another user" link

In Gnome on Centos 7, does anyone know how to disable "Log in as another user" on the lock screen? I can disable user switching using:
disable-user-switching=true
I achieve this be adding:
/etc/dconf/db/local.d/00-user-switching
[org/gnome/desktop/lockdown]
# Prevent the user from user switching
disable-user-switching=true
/etc/dconf/db/local.d/locks/lockdown
# Lock this key to disable user switching
/org/gnome/desktop/lockdown/disable-user-switching
This works nicely preventing the user switching option, but you can still switch users via the lock screen .
The reason as to why I'm doing this is because we're implementing a VNC recording solution. If a second person logs in, they are on a different display and therefore, VNC does not present that display to the client trying to record the screen as the original user stays on display 0 and the new user logged in is on display 1.
e.g.
[support#mymachine ~]$ who
fred :0 2018-09-26 08:27 (:0)
jenny pts/0 2018-09-28 09:43 (192.168.1.3)
pete :1 2018-09-28 08:13 (:1)
So what happens is that Fred logs locks his screen, Jenny clicks on "Log in as another user" and logs in which is fine, but it does not log Fred out. She therefore generates a new display and when you try and VNC, we can only see Freds original lock screen on Display 0 because Jenny has a new Display on 1.
Disable autospawning secondary VTs
In /etc/systemd/logind.conf set these two lines:
NAutoVTs=2
ReserveVT=2
Note that systemd wants logind to always have one VT reserved for TUI login. Setting both values to =1 overrides gdm's ability to spawn on VT1. Cf. systemd for Administrators, Part XVI at the systemd designer's blog.
After reboot, you have VT1 running gdm, and VT2 reserved for TUI login. "Log in as another user" cannot spawn another VT.
Note: this might be a useless answer since it doesn't prevent Xwayland systems (EL8) spawning the login window (on my test box at :1024). Even on EL7 it might not prevent gdm from trying to find another VT. In which case it's a bug in either gdm, or in the Gnome screenlock.

Making my agent with a difficult name, easier to invoke?

I'm creating an agent that interacts with an API I created, Auroras.live. However I always have troubles invoking the test version of the agent from my Google Home.
I really have to stress the "S" in Auroras, and I also have to say "dot", otherwise Google Home interprets it (I think) as Auroras Live, or Aurora.live, without the dot or "S"
This is definitely going to be a problem for others too, as they might not know to pronounce the dot, or forget to stress the "S", and as a result will get frustrated & not use my agent.
While filling out the app details, I tried using different invocations (such as "Talk to Auroras dot live" and "Speak to Aurora Live"), but it wouldn't let me do it, because I needed to use the exact title of my app.
What should I do? Should I (or can I) submit it as an easier to pronounce name (like "the aurora app")? Can I somehow tell Google to accept it with or without the "S" / dot? Any suggestions welcomed.
This is definitely a case where you would want your invocation name to be (slightly) different than your display name. I would list "Auroras Live" as your display name and "Aurora live" as the invocation name.
As part of the testing instructions, explain the problems you're seeing to the tester and request that both invocations be allowed.
If you want to clearly associate it with the auroras.live website, you could also mention that in the testing instructions (to include the dot), but you should probably also consider including a link to the site from the description and possibly from the action itself.

Osascript in Yosemite broken/slow - anyone can confirm?

During 10.8 times I created macro in Keyboard Maestro for adding web pages to Reminders list to read them later.
In Mountain Lion and Maverics it worked fine but in Yosemite something wrong is going on resulting very slow executions.
Previously execution time was about 1-2 seconds now its over 40 seconds or even one minute!
Apple team provided me with wrong solution ordered to "code sign" my script, but there is no "file" to codesign and applescripts can be executed in command line. So IMO they messed up something in osascript and still couldn't fix it till 10.10.4. But I need someone to confirm or to advice me how to debug problem, because I cannot find in system console log lines relevant to problem.
UPDATE:
On El Capitan 10.11.1 problem still persist.
Macro
Could anyone test and confirm this? I provided link to macro.
It is bind currently to F1 - change as you like. Before execution create "2Read" list in Reminders on OSX.
I've tried it and it's done in about 1-2 seconds on my machine. So I do not experience the same problem as you.
I'm running OS X 10.10.4 on a late 2013 MBP Retina.
Maybe your "2Read" list is too long?
Another tip:
I used to have a problem with long lists in Applescript, too. Sometimes it would take minutes to run through a list, but after using some if these tips the time for the lists was brought back to only seconds.
From your pastebin link (yeah, I did warn you it'd look like mince):
Keyboard Maestro event logs
(1) KM sends an 'open' event ('aevt/odoc') to Growl, telling it to open a temp file (presumably to make Growl display a message)
(2) Bartender sends a 'get scripting terminology' event ('ascr/gdut') to KM
(3) Bartender sends a 'BTDR/Load' event to KM, which looks like Bt telling KM to load a plugin named "BartenderHelperNinetyOne.bbundle"
(4) KM send a 'KeyC/KeyB' event to something (it doesn't give the name of the process, only its Process Serial Number, which is the classic MacOS equivalent to a Unix process ID). Probably easiest just to ask the KM devs about that one.
(5,6,7) KM then sends three 'application died' events ('aevt/obit') to Keyboard Maestro Engine (I'm guessing that's a faceless helper app that runs constantly in the background), informing it that three osascript processes (PSNs 312312, 315315, 316316) have terminated. This doesn't necessarily mean that osascript has crashed as those events contain an error number ('errn') parameter with value 0, and command-line processes normally return error code 0 to indicate they've completed successfully. It's quite likely these are normal internal notifications sent between KM and KME to indicate when a task is completed. The first of those osascript processes (PSN 312312) is related to the Reminders activity below; the other two I'm guessing are you running other AppleScript macros and probably not relevant here.
Reminders event logs
(1,2,3) The 'osascript' process with PSN 312312 sends Reminders a 'make' ('core/crel') event and two 'set' ('core/setd') events, which is obviously your AppleScript being run.
(4) The Dock sends it a 'reopen' ('aevt/rapp') event, which is probably just you clicking on Reminders' dock icon to bring it to the front.
The main problem, of course, is that without timestamps I can't tell you where your 40-second delay is occurring. You'd really need to do it again, this time manually noting the time at which each message is logged. And if you see a single 40-second delay somewhere in the middle, it should easy enough to determine which events it's occurring inbetween, which should start to point towards a cause. At which point, you're probably best contacting the KM vendor to discuss it with them.
HTH

Is this possible using perl?

As soon as I login to my system (basically linux) I get the below screen
Now I use arrow button and goto "GET_TESTROOT" and then press enter and takes me to this screen
![second image][2]
Here I confirm and say "yes" and it will bring me to another screen
Now I need to get the "serial number" and "testroot ID" into a variable.
Is this even possivble in perl ?
If these "screens" appear immediately after login (ie. executed from .profile or set directly as user shell) then the short answer is no!
The long answer is, of cause you can. You would have to create an expect script which connects to the server, sends some phony key presses and parses the output (which looks like some variant of curses to me). When that script is done, you can invoke it from Perl and extract the wanted values.
You can get most of the tools you need for this from cygwin.