Dameat Posted November 3, 2010 Share Posted November 3, 2010 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 Link to comment Share on other sites More sharing options...
AlmarM Posted November 3, 2010 Share Posted November 3, 2010 (edited) First of allwelcome to the forums! Second, about your problem.enabled by a keystrokeAre you looking for something like HotKeySet?I think i need to use the ControlGetText function but really don’t have a clue as to howControlGetText ( "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! EDIT: Typo Edited November 3, 2010 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. Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 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? Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 also what does "" mean... the barcode data will always be different so is this a way of stating scrape whatever data is there? Link to comment Share on other sites More sharing options...
AlmarM Posted November 3, 2010 Share Posted November 3, 2010 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. Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 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. Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 (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 November 3, 2010 by Dameat Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 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? Link to comment Share on other sites More sharing options...
AlmarM Posted November 3, 2010 Share Posted November 3, 2010 Sorry for the late response!About the HotKeySet:HotKeySet("{HOME}", "MyFunc")Func MyFunc() MsgBox(0, "", "Home pressed!")EndFunc. 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. Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 (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 November 3, 2010 by Dameat Link to comment Share on other sites More sharing options...
Dameat Posted November 3, 2010 Author Share Posted November 3, 2010 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now