I'm trying to use MATLAB to fill in textboxes on a webpage in Internet Explorer without typing directly into the URL. Can anyone explain to me how to do this? I'm pretty lost. I really appreciate any help you can give me.
Thanks!
While I have seen this done before (i.e. running a MATLAB script that automatically fills in fields in Internet Explorer), to the best of my knowledge, I do not believe that there is an actual MATLAB command to directly interface with IE.
Instead, you can make use of the MATLAB command system to call an external program that actually does the interfacing with IE.
For example, you might be able to make a Visual Basic program that interfaces with IE through the InternetExplorer object. I'm not too familiar with VB, but this doc might help. Once you've created this program, use MATLAB's system command to execute it (passing command-line arguments to define what/how to fill in the textboxes).
Take a look at the doc for system for more info.
I've done it many times with a small program called Autohotkey.
With this program you can write a script, that will move the mouse / click the keyboard. you can pass string arguments and use it inside the script. once done, you can call this script from matlab.
Related
I have a large folder of DWG files and want to convert them to DXF files, using Solid Edge. After opening the documents, is it possible to "Save As" from the command line or powershell?
Is this a program by program line of code or is it universal for all programs?
So if I wanted to save a .docx document open in Microsoft Word as a .pdf (for want of a better example) can I use that same line of code?
Any help appreciated...
Well since you want to convert from one Autocad format to another, you could do it using Autocad's command line.
https://knowledge.autodesk.com/support/autocad/downloads/caas/downloads/content/autodesk-customization-conversion-tools.html?_ga=2.88877275.1703552679.1574826072-7420195.1574826072
This does require you writing all of the scripting of course.
Alternatively, there is this handy scripted mass converter someone wrote using lisp and they wrote a custom script executor wrapper thingy but their scripting supposedly requires the full version of autocat (at least version 2010 to accomplish this.)
https://www.cadtutor.net/forum/topic/51941-autocad-mass-convert-dwg-to-dxf-batch-convert-dwg-to-dxf-mas-dwg-convert/
That said the official AutocCAD conversion command-line utilities are also going to use LISP scripting, so you might want to just take the second script, and work through it manually testing against the normal AutoCAD utilities until you can get it working for your needs to sort of jump start you.
If you do that I would suggest re-posting with tags for LISP and AutoCAD and give them a sample of what you have got if you end up going the official tools and your own or jump-started script route.
Hope that will be helpful to you and others in the future! :)
As commented beneath my question,
No, it would not be universal
So, no, there is no way of using a single command "save as" on every single program, and as Solid Edge doesn't have a command line API, that I know of, I would have to write a program for it.
I'm running Console2, which I believe is just an interface to windows cmd
I have a custom batch file that does most of my dirty work for me, but there are lot of commands in it now. Is there a way I can get a tap autocomplete working for it in the windows command prompt?
For example: my script is called rob.bat and it takes in a various number of arguments
It'd like to type rob set{Tab} and then have it cycle through
setup_envvars
setup_userprefs
setup_whateverothersetupscriptsIhave
Is there a way to do this?
Console2 has no special provisions for tab completion and instead relies on the program running within it to provide such features. Picture Console2 as little more than something that runs a console program hidden somewhere, regularly polls that hidden window for changes, and forwards all input to that window; this is, in essence, what's happening.
Note that Console2 does nothing special with cmd. You can run any shell within it. As for customizing tab completion, cmd offers nothing of that sort. You may be able to change this by installing clink, which has extension points for Lua code. Another option would be PowerShell, which has customizable tab completion out of the box, either by wrapping your program in a function that provides the necessary parameters, or by writing a custom TabExpansion or TabExpansion2 function.
I have worked shortly with Netbeans using Java and use eclipse for school projects, where I noticed there are some really cool features like it will show built-in functions on ctrl-space or it will suggest from existing variables. I recently started using matlab, I was wondering if there are any such tools available in the matlab. I know it's a scripting environment so things are probably a little different but then I wonder people who work with extensive projects with matlab, how would they manage the codes or cross-develop without such tools. I searched mathworks but could not find any useful information on that.
Anyone knows if such tools or add-ons existe for matlab? Thanks in advance guys!
As mentioned before, autocomplete works for functions, variables and fields.
If it seems to fail to work for a field (perhaps because your workspace is not properly set up) it can help to call the field without index:
For example:
entity.field instead of entity(i).field
Also if you change the workspace frequently it may be that the mfile editor does not catch up, in that case a quick workaround is to just type in the command window and copy afterwards.
As mentioned before the variables need to be in workspace.
I often approach so that I evaluate the code as I write it like this:
Write the code in cell mode
Evaluate cell with [ctrl - enter] - or button in menu bar.
Write next cell (variables of previous blocks are now available in workplace, autocomplete with tab)
There is also a matlab mode for emacs. It offers some autocomplete functionality and has a nice feature to wrap long code lines.
unfortunately on windows it lacks the ability to evaluate cells. So I rarely use it.
There are some similar design in MATLAB, one of them is called function hints.
You could find the documentation for it in here: http://www.mathworks.com/help/matlab/matlab_env/check-syntax-as-you-type.html
I have a script that runs several little programs I don't have the source code to, one of which requires filling out some fields in a GUI. I've been doing this by hand, but I'd like to have the Perl script focus the GUI window, then enter some hardcoded text into each field and close the window.
In the past I've used the Win32::GuiTest module for tasks like this. Have a look at the example scripts and documentation.
Unless there's a specific reason you're using Perl, Autoit is a Basic-like scripting language pretty much specifically designed for automating GUI tasks. It's very easy to pick up.
You can have it wait for a window to become active, send any sequence of keystrokes or tell it to specifically focus on a GUI element with a given handle, and much more. You can also package the scripts as standalone executables, which can be a nice benefit when you need it.
You might want to look into Win32::OLE. There's also a book on this topic.
I keep typing "t eh" instead of " the" which is, of course, annoying in the amount of time it takes me to correct myself.
The obvious answer is "Learn to type, noob!" or at least to type more slowly and/or more correctly. This error is frighteningly consistent so it appears I've trained my muscle memory for that pattern already.
But I'm wondering if it's possible to write a small, windows portable script or application that, when it detects the incorrect sequence, backspaces and corrects it automatically at a layer where it would apply to any keyboard input.
Does C# have access to that layer of the OS that intercepts keypresses systemwide?
Will I run into UAC issues with Vista?
Am I re-inventing the wheel (ie, are there open source tools I can modify or use out of the box)?
In DOS this sort of thing was quite easy and one could make TSRs (Terminate and Stay Resident) programs that would, for instance, give you a calculator onscreen with a special keypress. Not to mention the many, many practical joke programs based on this concept (dial "M" for monster!)...
I would, of course, never suggest such a utility could be used that way for co-workers...
-Adam
On windows you could use AutoHotKey. That allows you to create little scripts or macros to automate and correct things like mistypes.
One use was posted on lifehacker which took the common mistyped words and corrected them. It is at http://lifehacker.com/192506/download-of-the-day-universal-autocorrect
UPDATE Per Comment: This is Free software and windows only as far as I know.
The above script is just an example of what it can do. There are a slew of scripts available at AutoHotkeys Site
I suggest AutoHotKey. If you've never used it before, have a quick read of the tutorial: http://www.autohotkey.com/docs/Tutorial.htm
The feature you are looking for is called "hotstrings." http://www.autohotkey.com/docs/Hotstrings.htm
In your case, your script would look something like:
::teh::the
That's it! Add other things you want corrected on additional lines. AutoHotkey scripts can be compiled so you don't have to install AutoHotKey on all of your machines.
It's a very cool program. It's primary use (for making custom hotkeys) rocks! These scripts are system wide so you'll also probably want to make a hotkey to be able to turn them off too!
EDIT: In a comment, it was mentioned that he actually types "t eh" (with a space in it) and I wondered if something additional would be needed for it to work. I just tested it and it works fine. Just install autohotkey, and create a file with the .AHK extension. In that file put in the following line
::t eh::the
and save the file. Then double-click on the AHK file to load AutoHotKey with your script (you'll see a green square in your system tray to let you know it is running). It should work fine!
Yes, you can use pinvoke commands from C# to intercept the low-level os commands. I recommend you take a look at http://www.pinvoke.net. The coding isn't easy but it does work.
I suggest learning to type more slowly. I also suffer from "teh" and "ahve" in part due to autocorrect giving me the leniency. If you forced yourself to retrain then you would not be at a disadvantage when using someone else's machine.
Not to mention the unfortunate event when you need to write "t eh" and are being prevented by an overzealous 'corrector'.