Sign in to follow this  
Followers 0
Dameat

Create macro to scrape info

11 posts in this topic

Good morning,

This is my first post here. I am not a programmer but I am in IT so I do have some analytical skills.

I am having an issue with a new system we are implementing. During the final review a pharmacist is to scan the barcode of a drug that has been packaged for verification that it is the correct drug. We have some automated machines that package the drugs as well and our old system did not make them verify the automated packaged drugs...the new system does. I need to create a macro that can be enabled by a keystroke to scrape the barcode information from a screen in the application and paste it into the verification screen to finalize the packaging process on the automated line.

I think i need to use the ControlGetText function but really don’t have a clue as to how....or what i need to do to create the scrape and create a macro for it.

Any help and guidance would be very much appreciated.

Mike

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First of all

welcome to the forums! :(

Second, about your problem.

enabled by a keystroke

Are you looking for something like HotKeySet?

I think i need to use the ControlGetText function but really don’t have a clue as to how

ControlGetText ( "title", "text", controlID )

These are the parameters used for ControlGetText.

For title, you could use something like WinGetTitle.

For text, you could use "", or enter a text found on the application screen (to improve accuracy).

For controlID, you should enter the controlID on wich you would like to get the text from. Use AutoIt Window Info.exe to get the controlID's.

Hope it helps! :graduated:

EDIT: Typo

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Thanks for the reply...

I guess it could be a HotKeySet if it is triggered by a keystroke combination.

I read the help file on ControlGet Text and saw that but this is still over my head.

with ControlGetText ( "title", "text", controlID )I understand that "title is the title of the open window of my application that i need to "scrape" data from..."text" is the field i need to scrape??? and ControlID I can use the WindowInfo app (BTW that app is pretty cool)

So once I have this string written and it grabs the barcode information how do I create a keystroke to paste it into the verication field?

Share this post


Link to post
Share on other sites

also what does "" mean... the barcode data will always be different so is this a way of stating scrape whatever data is there?

Share this post


Link to post
Share on other sites

If the barcode always will be different, use "".


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

thanks...did you see my post above that? It stated once i get this syntax down for the scrape....how do I use that data to create a HotKey as you stated to paste that information into the verication field of the application...btw...the barcode and the verication fields that I need to transpose data from and to are the same window I believe.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

As a test to learn how to use the logic I am trying to scrape the server name from Remote Desktop (Which is open) and paste the server name into Notepad.

Here is the script i have so far.

$var = ControlGetText("[CLASS:Remote Desktop Connection]", "", 5012)

Run("notepad.exe")

WinWait("[CLASS:Notepad]")

ControlSetText("[CLASS:Notepad]", "", "Edit1", "" )

Nothing is getting pasted into Notepad....it just open up blank.

Also can the recorder tool help me out?

Edited by Dameat

Share this post


Link to post
Share on other sites

I got my first script to work....!!!!

This will paste the server name form RDP to a Notepad doc...

$var = ControlGetText("Remote Desktop Connection", "", "[CLASS:Edit;INSTANCE:1]")

Run("notepad.exe")

Sleep(800)

ControlSetText("[CLASS:Notepad]", "", "[CLASS:Edit;INSTANCE:1]", $var )

But now how do i create a Hotsetkey?

Share this post


Link to post
Share on other sites

Sorry for the late response!

About the HotKeySet:

HotKeySet("{HOME}", "MyFunc")

Func MyFunc()

MsgBox(0, "", "Home pressed!")

EndFunc.

:graduated:


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

How would I make it so that Ctrl + F made my script run then?

also does this next syntax go before or after the logic to scrape the text?

Edited by Dameat

Share this post


Link to post
Share on other sites

Actually I think I got it. I compiled it to an executable then created a shortcut on the desktop and assigned it a shortcut key.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0