VB.Net automate flash in WebBrowser - vb.net

I've passed many hours searching the web for a solution to something which seems obvious, but without results.
I need to automate a task in a Flash application running on my intranet.
I can't change the Flash application nor do I have access to the source code.
it's not a Flash movie but an application.
I can't download the swf.
I'm using a WebBrowser in a form. The Flash app is displaying without issues.
So far, I have been able to automate the task (clicking on some buttons, then inputting text and finally saving the results on a server). It works but it's not clean at all because I use hard-coded timers to wait a given action is done and then I click on very specific point at given coordinates in the application.
What I would like to do:
Avoid hard-coded timers. the Flash application takes some time to display all elements on the window (from 20 to 60+ sec). I would like to be able to detect when all elements are loaded. I tried to retrieve the text of the windows handle, but while I can retrieve the Flash hwnd, I can't retrieve the content (through messages).
In brief, instead of waiting 60sec (and not being 100% sure it's enough), if the last element to load in the Flash app has "ABC" written in it, I would like to detect it's displayed so that I can continue the sequence (click on the next button).
I'm using VB.net. Any hints to achieve that would be appreciated.

Lol. I am trying to do the same thing but with no results. You can try to see if there are POST/GET codes that can help you if the application has an online nature. Other than that you can only simulate clicks, because flash can't be easily interacted with. This is why most of the things are going to swap with HTML5 now.

Related

Creating a text based browser game bot that runs in the background

I want to create a bot for a text based browser game that will have:
A separate mouse that will not interfere with my mouse
human like mouse movement with random wait times and clicks buttons like a real person (basically it can't be pixel perfect clicks every time
Pauses and alerts me when a human verification shows up
There is already a program that can do this that doesn't require coding skills called Browser Automation Studio but it costs money and feels somewhat limiting. Here is a video on how it looks when developing a bot https://youtu.be/K-jT-GwjTjg?t=2524
When you compile a bot and run it it will open up a headless chrome (I think that's what you call it) app with a separate mouse, that program can be minimised and will run in the background with no problem. I know I could just use this program but I want to learn how to code this bot on my own.
I have gone to uni for web development (failed final year oof) so I know a bit of how code works and just need some pointers on how I can start this project. From my research it seems python selenium would be good but I can't find anything on making a separate mouse so That when the bot is running I can still use my pc for other stuff.
Thanks in advance.

SendKeys VB.net

Hi ive developed a application that works with my site by using
SendKeys.send("{ENTER}") to submit info on one of my forms.
Is there a way to stop it from running outside the application?
For example im trying to run the program in the background and when im browsing my facebook or on google it randomly keeps hitting enter.
Any help is greatly appreciated thanks for your time.
The short answer is to look at the windows available for a process and check the titles to see if it's the page you want.
If System.Diagnostics.Process.GetProcessesByName("firefox").MainWindowTitle = 'My Page Title'
...
End If
That said, there are much better ways to do this - If you're using firefox, look into GreaseMonkey, if in Chrome, look at TamperMonkey.
Both allow you to inject custom javascript into any page whose url matches a pattern you choose. In effect, you could write some Javascript to submit a form (say) 30 seconds after page load.
This would have the benefit of working if a different tab is selected as well as not requiring a whole application.
The SendKeys.Send method will indiscriminately send the key stroke to the active application. There is no way to use this API to target a specific application.
You could change your app to try and verify the active application is the one you want to send keys too. This is destined to be a flaky process though. No matter how good your verification is it's always possible that the active app is switched to another app after your verification completes.
If VerifyActiveAppIsTarget() Then
SendKeys.Send("{Enter}") ' Active app could change before this runs
I would persue a different solution for sending data between my apps

Why is my VB app invisible to the screen recorder?

I have written a VB application in VS2010. When I try to record its operation for a demo video with Windows Media Encoder x64 or Apowersoft free screen recorder, I get a recording of everything on the desktop except my application. It's like the application is invisible to the recorder. It has worked in the past (2 weeks ago). It must be something I have done but I'm baffled. Is there a "feature" in VB that can prevent you from recording the Form?
BTW, a still screen capture works fine and sub forms I bring up are captured. Only the main form is invisible to the recorder.
Thank you for your help and time.
Not a VS or VB problem after all. What I found was that windows 7 was switching me from Aero Theme to Windows 7 Basic. The message that showed up was that I was low on display memory. (A quick pop-up in the bottom right corner that I was ignored during the recording). However, I have 4.75 G of display memory?
BTW on a video conf call it produced the same invisibility "feature" until I found the Theme switch.
I haven't actually fixed anything but now know to watch for the tell tale screen blink as it switches mode. I pause the recording, and switch it back before restarting the recording. Got through the recordings I needed for now. I was using MS Media Encoder. I have now replaced it with Adobe Premier elements but haven't tried it yet to see if I still have the problem. Need to get the "how to" videos out the door first.
Thanks again. I have read many of your Answers to others in the past that have helped me solve numerous other VB and VS problems.
Michael
That's weird since it's recording forms from the application and not other forms (main form) from the same application.
Make sure you run the recorder as administrator and not the application.

Forms open and load very slow. Sometimes they won't open

I have a relatively small VB winforms project.
It is currently used to launch numbers hyperlinks and some apps on a server.
There are a couple functions that do all the work, but the it really boils down to:
System.Diagnostics.Process.Start("iexplore.exe", urlVar)
or if it is an app sitting on the server, the variable passed into the function appLinkVar will contain the need file path to launch the application.
System.Diagnostics.Process.Start(appLinkVar)
The "items" are stored on a SQL Local Database (.mdf)
Id, appName, appLink, appClickCount, appFavList,anddecision, which tells the function if it is calling a website or opening an executable.
Currently, there are forty rows in the database and I project 150+ in the end that need to be updated centrally and often (weekly). But that's a different question for later. The reason I added in it in this question was for insight as to why I am using a database instead of a Setting or XML file for some links. (better suggestions welcome)
My admin main form loads Visible = False and loads the icon in the system try. So you can't actually see the first form that opens. It is a hidden admin window and it's main purpose is to put the icon in the system tray. The green RJ icon - http://snag.gy/VBa6c.jpg
Then all of the app interaction is around the notify icon. Example: the app loads on hover. right-click for settings and options etc.
Once the primary form loads, on mouse over the "Primary Label" for example and the white form to the left appears and so on. Not much to it. http://snag.gy/excKr.jpg
The Frequently Accessed items is currently stored on the database called appClickCount, this will be coming off of the database and to another recommended way of storing the data. But when I initially added the database, I noticed some lag in the main form loading. It would take it 5-7 seconds to populate the Frequently Accessed Items List and so on. So I changed the code from mainWindow.show() to mainWindow.visible(). Worked great for me. opened and closed very quickly. But after some use today by a tester, the application became almost unresponsive. He clicked on the notification icon numerous times and the app failed to load. Then threw a SQL time out error. It was the end of the day and I couldn't grab a screenshot.
I need to make this more reliable.
After some discussion the other day on SO, I was talking to someone that recommended I re-write the app in C# WPF, and that is definitely the plan. But I need this thing to past testing as is in VB this week. Where can I start troubleshooting the delay in opening? What other suggestions do you have to improve the application? Do I need to have an invisible form load first so I have access to a system tray icon or is there a better way?
I have talked to quite a few people on here lately and got some really good advice, I figured I would lay it all out here and see what input you guys can give a new guy... I'm also gonna go hang in the C# room for a little bit if you have any further questions.

Sending key stroke to front application in Cocoa?

I was wondering would this be hard to do; I have a barcode reader for my isight (mac webcam) (evoBarcode). At the moment, the program reads the barcode fine and adds it to a text field at the side of the application. Event when in the background, the application continues to run and read barcodes which is fine.
I was wondering, is it easy to send the result from this (I have already located the exact variable where the barcode is caught) to the front application as a keystroke? (the front application being textEdit or something.
I've tried searching around for a bit and found CGRemoteOperation, but havn't found a great lot of resources or examples on it.
Any ideas?
Thanks.
Depending on the reader behaviour another option could be to implement a service menu item. That way you don't mess with the clipboard.