Auto enter items into 3rd party website - windows

So I have to scan and manually enter 1200 scanner number every week for inventory. The process goes in this order:
Open Website < Click text box < Enter numbers < hit submit < wait 20 seconds < hit submit again (it makes me confirm i entered right) < Wait another 20 seconds.
At this point, the page refreshes, and IO start over at the Click text box part.
I already converted the numbers to barcodes and scan them instead of typing, I also use 2 screens with 8 open windows to make it a bit faster.
But I was wondering if there was a batch file or another way to automate the process?
Even with the scanner, and 8 open windows, it takes 4 hours roughly to do them all.
I have been searching on google for a few days, and decided to ask here since most the pages i read go back to this site.

http://www.autohotkey.com/
Awesome macro software. Very flexible for a macro and easy language to learn.

Try searching for automated keyboard/mouse macro software. Never used it, just a tip.

This question appears to be similar on SuperUser: Redirecting input from file to command-line program
It appears to be effective for telnet sessions - not sure about http sessions. You might look into TCL and Expect as options though.

Related

AppleScript: Edit a fully written script buy "whiting out" certain commands but leaving it in so you can remember it

I've compiled my first web crawler script with AppleScript and I'm at the point now where I've gained a lot of knowledge and tricks from what I've written. I want to parse down the script now and disable some things that I thought would be helpful (for example: I coded it so the script completely quits Excel after entering the data in some workbooks from web pages because I noticed when you didn't start Excel fresh running the code it would return an error. But now I have the script running every 15 minutes so I worry that I will be working in Excel on some forecasting or formatting and the script will run and kick me out of Excel while I'm working and interrupt me or worse, quit without the option of saving). I vaguely remember C++ coding there was the ability to mark some text with a certain character that disabled it from running in the environment but made it so you could still see the original code before editing out stuff you decided wasn't necessary. Is there a way to mark a certain statement with a symbol so that AppleScript doesn't run the commands? I haven't experimented at all but I don't know what to guess that would do it. I may be mistaken that you can blank out or "white out" text while leaving it in the original position, still readable and able to be put back in when you want it or left for you so you have a collection of all the research you put into the process of building a script for a project. Well I suppose I'll just wonder a while and find something else to burn hours on.
In applescript there are three ways to "comment" out text in your code.
--A line beginning with two dashes is a comment.
#In applescript 2.+, the number sign also works as a comment symbol.
(* Multi-line text
can be commented out
using these symbols. *)

VBA to close excel file when Windows7 computer is locked

I have an excel file on a shared drive used by 6/7 people, however only one person can edit at a time. The frustration comes when one person opens the file for editing then disappears for lunch for an hour, leaving the excel file open and un-editable for other users.
Is it possible for VBA to listen for when a station is locked, and activate a macro accordingly?
Sorry I am not posting any of my own attempts as I'm a bit of a fish out of water with this level of VBA.
Any points that may help get me started would be really useful.
You have a few options:
Kill the co-workers who do this
Have other users create a copy and save-as to then merge latter (quite hacky)
Or you try a timeout - so if the user selects nothing i 10 minutes the workbook closes. Selecting lock would be a issue with security I think and windows wouldnt let you have that kind of power.
So to timeout call a function every ten minutes to check if user has selected any other cells in the worbook.
If difference("n", lastaction , Now) > 10 Then
ThisWorkbook.Close SaveChanges:=True
End If
You can use NOW function in vba to find current date and time and the work out difference with when an action was made to find the value of 'lastaction'. To do this use:
Sub AnAction(ByVal Sh As Object, ByVal Target As Range)
lastaction = now
End Sub
Hopefully that answers your question.

Is there a way to keep the Xcode console log from overflowing and locking up the session?

I have a Mac app (that is a testbed for a phone app) that spews massive amounts of output into the console log. Mostly this is what I want, but sometimes I run large "batch" runs and the console log essentially fills up and Xcode locks up. The only way I've found to prevent this is to monitor the job and every 30 seconds or so press "Clear", hoping that I'm not so close to the end that I clear out the 50 or so final lines giving the results of the run.
Yes, I could go through the code and reduce the number of lines output, but there are several reasons (not purely based on laziness) for not doing that.
Does anyone know of a way to tell Xcode to maintain the console as a "rotating buffer" of sorts, clearing old stuff from time to time so that it doesn't fill up?
You could write your own rotating buffer implementation, and log to that rather than with printf.
Or if you don't want to replace all your printfs:
#define printf rotatingPrintf
Perhaps it would work to write a command-line tool that has a rotating buffer, then pipe the output of your app to that tool. You can launch GUI apps from the command line like this:
$ /Applications/Foo.app/Contents/MacOS/Foo

How to check Matplotlib's speed in Xcode and increase performance?

I'm running into some considerable speed bottlenecks with a Python-Matplotlib-Xcode combination. I know some immediate responses will probably ask "Why are you doing python stuff in Xcode, just man up and use vim" --> I like the organizing ability and the built in version control, it makes elements of my work easier to deal with.
Getting python to run in xcode in the first place was a bit more tricky than I had hoped, but its possible. Now I have the following scenario:
A master file, 'main.py' does all the import stuff for me and sets up some universal formatting to make all the figures (for eventual inclusion in my PhD thesis) nice and uniform. Afterwards it runs a series of execfile commands to generate whichever graphics I need. Two things I can think of right off the bat:
1) at the very beginning of main.py after I import all the normal python stuff you tend to need, I call a system script which checks whether a certain filesystem is mounted. I keep all my climate model data on there since my local hard drive is too small to deal with all of it at once. Python pauses itself and waits for the system to do its thing, but once the filesystem has been found, it keeps going. Usually this only needs to happen once in the morning when I get to work, or if the VPN server kicked me off for whatever reason. (Side question, it'd be cool to know if theres a trick to automate an VPN login to reconnect as soon as it notices its not connected)
2) I'm not sure how much xcode is using on its own. running the same program from terminal is (somewhat) faster. I've tried to be memory conscience and turn off stuff I don't need while running the python/xcode combination.
Also, python launches a little window whenever I call plt.show(), this in itself takes time, I've considered just saving them as quick png files and opening them with some other viewer, although I guess that would also have to somehow take time to open up. Given how often these graphics change as I add model runs or think of nicer ways of displaying the data, it'd be nice to not waste something on the order of 15 to 30 minutes (possibly more) out of the entire day twiddling my thumbs and waiting for a window to pop up.
Benchmark it!
import datetime
start = datetime.datetime.now()
# your plotting code
td = datetime.datetime.now() - start
print td.total_seconds() # requires python version >= 2.7
Run it in xcode and from the command line, see what the difference is.

How to detect programmatically when the OS has done loading all of its applications\services?

Edit: I rephrased my question, please ignore all of the comments below (up to the 7th of May).
First off, I'll try to explain the problem:
My process is trying to show a Deskband programmatically using ITrayDeskBand::ShowDeskBand.
It works great at any time except for when the OS is loading all of its processes (after reset or logout).
After Windows boots and starts loading the various applications\services, the mouse cursor is set to wait for a couple of seconds (depends on how many applications are running \ how fast everything is).
If the mouse cursor is set to wait and the process is running during that time, the call will fail.
However, if my process waits a few seconds (after that time the cursor becomes regular) and then invokes the call, everything works great.
This behavior was reproduced both on Windows 7 and Windows Vista.
So basically what I'm asking is :
1) Just for basic knowledge, What the OS does when the cursor is set to busy?
2) The more important question : How can i detect programmatically when this process is over?
At first, I thought that explorer hadn't loaded properly so I've used WaitForInputIdle but it wasn't it.
Later I thought that the busy cursor indicates that the CPU is busy so I've created my process using IDLE_PRIORITY_CLASS but idle times were received while the cursor was busy.
Windows never stops loading applications and/or services!
As a matter of fact, applications come and go, some of these interactively some of these without any user interaction. Even Services are loaded at different points of time (depending on their settings and the external conditions - e.g the Smard Card Resource Manager Service might start only when the OS detects that a Smard Card device has connected). Applications can (but must not) stop automatically so do some Services.
One never knows when Windows has stop to load ALL applications and/or Services.
If ITrayDeskBand::ShowDeskBand fails, then wait for the TaskbarCreated message and then try again. (This is the same technique used by notification icons.)
The obvious approach would be to check whether ShowDeskband worked or not, and if not, retry it after a few seconds. I'm assuming you've already considered and rejected this option.
Since you seem to have narrowed down the criteria to which cursor is being displayed, how about waiting for the particular cursor you are wanting? You can find which cursor is being shown like this:
CURSORINFO cinfo;
ICONINFOEX info;
cinfo.cbSize = sizeof(cinfo);
if (!GetCursorInfo(&cinfo)) fail();
info.cbSize = sizeof(info);
if (!GetIconInfoEx(cinfo.hCursor, &info)) fail();
printf("szModName = %ws\n", info.szModName);
printf("wResID = %u\n", info.wResID);
Most of the simple cursors are in module USER32. The relevant resource IDs are listed in the article on GetIconInfo.
You apparently want to wait for the standard arrow cursor to appear. This is in module USER32, and the resource ID is 32512 (IDC_ARROW).
I suggest that you check the cursor type ten times a second. When you see the arrow cursor ten times in a row (i.e., for a full second) it is likely that Explorer has finished starting up.

Resources