Is this possible using perl? - 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.

Related

Pass arguments to application hosted by Appv but run up via Citrix

ok I'm no expert in this so I might explain wrong. We are trying to find a way to pass parameters to an app in appV but is launched by Citrix SelfService. So I guess when you have apps in appv you tell it you want to call an app by calling ctxAppVLauncher.exe and then pass it an app key of like "asdasd-123asd-asdd1234" etc etc... so to do that via Citrix selfservice you use the exe box for the txAppVLauncher.exe and then your params are the key... which then leaves you no where to pass in arguments for your real endpoint which for example you want to be notepad.exe but you want to pass notepad a text file path as an argument to auto open... there is no way to do that... at least none that we can find..
anyone have any experience with this ?

Automatic-control-question

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.

Accept UAC prompt verification with Autohotkey

I'm running an application using an Authotkey script, which requires UAC.
I've read some post about it, but I can't get a clear answer explaining why it seems not possible to accept the prompt using Autohotkey.
My code is something like this:
Run,"%A_ProgramFiles%\someprogram.exe",,Max
Send !Y ; Send Alt-Y
I understand the process dispatched by the first line is halt by UAC, but the autohotkey process should continue working, right? I tried inserting a pause before, and also with mouseclick, unsuccessful.
Thanks,
No, the autohotkey process should not run in the secure desktop where the UAC prompt is displayed. See http://blogs.msdn.com/b/uac/archive/2006/05/03/589561.aspx and http://technet.microsoft.com/en-us/magazine/2009.07.uac.aspx for details.
I use a TIMER to check for the presence (WINEXIST) of alert windows every second or so.
IF WINEXIST alert window
Send !Y
Otherwise, your !Y is typing into the ether, and not into the UAC alert window

Can an Adobe AIR Application run via the command line output to console?

I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?
Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need to create my own log file? Now that'd be silly.
Take a look at CommandProxy. It is a low level wrapper around your AIR application that lets you send command from AS3 back to the proxy for communicating with the underlying OS. You should be able to add a means of writing to the command line via such a method.
I don't think that is possible, but I'm not completely sure though.
There is a flashlog.txt file which you can configure so all trace() statements are logged to it. Check this post http://www.digitalflipbook.com/archives/2005/07/trace_from_the.php for more info on how to set it up. This is for logging from the browser, but I'm pretty sure it should also work from an air app.
Additionally, you could use SOS MAX from Powerflasher to log to an external console through an XML socket.
By default, trace() will output to stdout.
Your AIR application is one, big trace window if you want it to be.

How to run my program on before logout on windows XP?

I am looking for an inverse version of "RunOnceEx".
RunOnceEx does run some program, before the user's shell(desktop&taskbar) start. The login progress will not continue before the runonceex complete.
I want to do exact the same but on user logout.
When she/he logout, all running program shutdown, leaving shell(desktop&taskbar), then ""I wish my program will be execute this moment"", finally logout.
I think it is possible because the "mobsync.exe" is doing that. But I cannot find where and how to do it.
Warning, as said here, gpedit.msc will allow you to configure a logoff script for all users.
If you need that script only for one user, you need to declare it directly in the registry, both in HKCU and HKLM.
To run this only for the current user, you can use WMI to get an information when a shutdown/logout occurs.
Either you write a small C# (or any other language that can use WMI) application or vbs script to listen on the Win32_ComputerShutdownEvent WMI event.
An example C# app can be found here in this question: Get Log off event from system
found in the first result on google for me
To execute a program you can create a script to run it and use group policy to enforce it.
In Group Policy Editor navigate to User Configuration-->Windows Settings-->Scripts (Logon/Logoff)
more information here
If you want a running program to execute code on logoff, then you should hook the WM_QUERYENDSESSION message and look for an lParam value of ENDSESSION_LOGOFF (0x80000000).
It's important to test for this lParam value because the other ones indicate a "forced close" - i.e. your process may be killed before your code is even allowed to run. In fact, most shutdown/session-end messages are only intended to give you an opportunity to run last-minute cleanup code and aren't that safe to respond to with long-running actions; but this particular combination should be OK.
Note: I've never tried to actually run a separate process in response to the WM_QUERYENDSESSION message. It's possible that the window manager will disallow this, like it does during shutdown. Try it and see, I guess.
If you're in a .NET environment (you didn't specify), a quicker way is to add an event handler to the Microsoft.Win32.SystemEvents.SessionEnding event.
What you need is an implementation of GINA. You can run your custom commands in WlxIsLogoffOk function, which gets called when the user initiates a logoff
Once you create the proper GINA dll you can register it here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\#GinaDLL
Here is an implementation which may fit your needs (it provides a Logoff registry key where you could specify your command):
http://wwwthep.physik.uni-mainz.de/~frink/newgina_pre09/readme.html
As VonC and TFD already mentioned, the Group Policy Editor is just another way to manipulate the registry.
Just make with gpedit the changes (in Userconfig - Windows Settings - Scripts) you like and afterwards take a look in the registry at [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts]
to find out how you can do that directly.
Also on my PC (hanging in a domain) is a hidden folder C:\WINDOWS\System32\GroupPolicy with subfolders for user and machine. Both having additional subfolders called Shutdown and Startup. Maybe you can also use these ones.
If you need something simple and working for a single (or any) user you can make a simple application in C++ or C# for example.
The simplest is having a C# in tray (by simply adding the tray component to the form) and register and event handler for the FormClosing event. It'd look like this:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason != CloseReason.UserClosing)
{
// It's not the user closing the application,
// Let's do whatever you want here, for example starting a process
Process notePad = new Process();
notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = "ProcessStart.cs";
notePad.Start();
}
}
So your application will be started with Windows or with the user. It'll wait (using a little bit of memory) and will do something when the system shuts down, or the user log off, etc (by checking "CloseReason" above).