cosmicdancer Posted August 11, 2008 Posted August 11, 2008 I frequently have to paste a text string into a field on a web browser. The text string is six words and never changes. I could use a clipboard manager to accomplish this but I'm trying to use AutoIt when I can in order to try and learn how to script with it. Therefore I thought a script assigned to a hotkey would be the answer. I found in the help files how to assign a hotkey but I really haven't much of a clue with the script. Does the text string need to be read from a text file (i.e. notepad) or can it be "hard coded" into the script? I'd be very grateful for some help!
Zedna Posted August 11, 2008 Posted August 11, 2008 (edited) Does the text string need to be read from a text file (i.e. notepad) or can it be "hard coded" into the script? If it's always the same you can do it as hardcoded value in script: $value = 'some text' Send($value) You needn't assign hotkey inside script. Just compile AU3 script to EXE file then make shortcut for this EXE and assign hotkey to this shortcut (in Shortcut properties). So in this way your script will not run all the time but just after you press hotkey (for that shortcut). Instead of Send() use functions from IE (Internet Explorer) UDF - see details in AutoIt helpfile. Edited August 11, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
cosmicdancer Posted August 11, 2008 Author Posted August 11, 2008 If it's always the same you can do it as hardcoded value in script: $value = 'some text' Send($value) You needn't assign hotkey inside script. Just compile AU3 script to EXE file then make shortcut for this EXE and assign hotkey to this shortcut (in Shortcut properties). So in this way your script will not run all the time but just after you press hotkey (for that shortcut). Instead of Send() use functions from IE (Internet Explorer) UDF - see details in AutoIt helpfile. Thanks for your help, Zedna. When I try to compile that script I get an error - "Error opening the destination file". What have I done wrong? What does your last sentence mean? I searched for IE UDF in the help file but couldn't find anything that looked like what I am trying to do :-)
cosmicdancer Posted August 12, 2008 Author Posted August 12, 2008 Thanks for your help, Zedna. When I try to compile that script I get an error - "Error opening the destination file". What have I done wrong?What does your last sentence mean? I searched for IE UDF in the help file but couldn't find anything that looked like what I am trying to do :-)Can anyone please offer any help here? I'm stuck!
Zedna Posted August 12, 2008 Posted August 12, 2008 (edited) Thanks for your help, Zedna. When I try to compile that script I get an error - "Error opening the destination file". What have I done wrong?Uninstall AutoIt and then install latest 3.2.12.1 version. Also install latest Scite4AutoIt3 --> compile script by F7What does your last sentence mean? I searched for IE UDF in the help file but couldn't find anything that looked like what I am trying to do :-)"C:\Program Files\AutoIt3\autoit.chm" User Defined Functions/IE Management Edited August 12, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
cosmicdancer Posted August 12, 2008 Author Posted August 12, 2008 Uninstall AutoIt and then install latest 3.2.12.1 version. Also install latest Scite4AutoIt3 --> compile script by F7I've already got the latest versions of both AutoIt and SciTE but am still getting the error message. "C:\Program Files\AutoIt3\autoit.chm" User Defined Functions/IE ManagementOK, I've found a long list of User Defined Functions in the IE Management category - but how do I know what to use and how???I'm really struggling trying to learn AutoIt - the help files seem to assume a high level of knowledge which I just don't have. How does anyone ever progress beyond total newbie like me??? Maybe I'm just thick! ;-(
herewasplato Posted August 12, 2008 Posted August 12, 2008 (edited) ... I'm really struggling trying to learn AutoIt - the help files seem to assume a high level of knowledge which I just don't have. How does anyone ever progress beyond total newbie like me??? Maybe I'm just thick! ;-(Some aspects of AutoIt do require knowledge that I don't have - but I've managed to do what I need to with the basic functions.First - there have been a few posts that mention people having trouble compiling au3 to EXE as of late. I do not know the answer to that - but others might be able to help you better if you would copy/paste/post the entire output of SciTE when the error happens. That output also tells us your Operating System (OS).Second - no need to be stuck. You can run your script as an au3 file using an OS shortcut key. I prefer it that way to having exes... but then again, most of my scripts are so basic that changes to the AutoIt program rarely break them.Put the au3 file somewhere on your hard drive.Make a shortcut to that file on your desktop.Right click on that shortcut and select propertiesPut the cursor in the field named "Shortcut key:"Type the letter zSelect OKNow, whenever you press Ctrl-Alt-zthe script will run* and send the text that you hard coded into it.*If SciTE opens - reinstall AutoIt with the default settings.Once your desktop gets cluttered with shortcuts to AutoIt scripts... you might want to consider moving them all to a folder within the start menu. If you are using XP, you may need to restart the OS one time in order for XP to recognize the Shortcut key after a move like that. Edited August 12, 2008 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Zedna Posted August 12, 2008 Posted August 12, 2008 Look at _IE_Example(), _IE_Introduction() Resources UDF ResourcesEx UDF AutoIt Forum Search
cosmicdancer Posted August 12, 2008 Author Posted August 12, 2008 Some aspects of AutoIt do require knowledge that I don't have - but I've managed to do what I need to with the basic functions.First - there have been a few posts that mention people having trouble compiling au3 to EXE as of late. I do not know the answer to that - but others might be able to help you better if you would copy/paste/post the entire output of SciTE when the error happens. That output also tells us your Operating System (OS).Second - no need to be stuck. You can run your script as an au3 file using an OS shortcut key. I prefer it that way to having exes... but then again, most of my scripts are so basic that changes to the AutoIt program rarely break them.Put the au3 file somewhere on your hard drive.Make a shortcut to that file on your desktop.Right click on that shortcut and select propertiesPut the cursor in the field named "Shortcut key:"Type the letter zSelect OKNow, whenever you press Ctrl-Alt-zthe script will run* and send the text that you hard coded into it.*If SciTE opens - reinstall AutoIt with the default settings.Once your desktop gets cluttered with shortcuts to AutoIt scripts... you might want to consider moving them all to a folder within the start menu. If you are using XP, you may need to restart the OS one time in order for XP to recognize the Shortcut key after a move like that.Many thanks for that - sounds nice and easy! I'm still having problems with the actual script though :-( All I want to do it so paste a text string into a field on a web form. Have you ever done anything like that? I think it should be really easy?
cosmicdancer Posted August 12, 2008 Author Posted August 12, 2008 Some aspects of AutoIt do require knowledge that I don't have - but I've managed to do what I need to with the basic functions.First - there have been a few posts that mention people having trouble compiling au3 to EXE as of late. I do not know the answer to that - but others might be able to help you better if you would copy/paste/post the entire output of SciTE when the error happens. That output also tells us your Operating System (OS).Second - no need to be stuck. You can run your script as an au3 file using an OS shortcut key. I prefer it that way to having exes... but then again, most of my scripts are so basic that changes to the AutoIt program rarely break them.Put the au3 file somewhere on your hard drive.Make a shortcut to that file on your desktop.Right click on that shortcut and select propertiesPut the cursor in the field named "Shortcut key:"Type the letter zSelect OKNow, whenever you press Ctrl-Alt-zthe script will run* and send the text that you hard coded into it.*If SciTE opens - reinstall AutoIt with the default settings.Once your desktop gets cluttered with shortcuts to AutoIt scripts... you might want to consider moving them all to a folder within the start menu. If you are using XP, you may need to restart the OS one time in order for XP to recognize the Shortcut key after a move like that.Many thanks for that - sounds nice and easy! I'm still having problems with the actual script though :-( All I want to do it so paste a text string into a field on a web form. Have you ever done anything like that? I think it should be really easy?
cosmicdancer Posted August 12, 2008 Author Posted August 12, 2008 Look at _IE_Example(), _IE_Introduction()Both of those have an example script - but when I run them nothing happens. Shouldi t?
herewasplato Posted August 13, 2008 Posted August 13, 2008 Many thanks for that - sounds nice and easy! I'm still having problems with the actual script though :-( All I want to do it so paste a text string into a field on a web form. Have you ever done anything like that? I think it should be really easy?I've sort of done that - I usually have the script tab to the field of interest and the send the info. You could manually select the field of interest and then press your OS shortcut key(s). Ctrl-Alt-zThe script can be one line:Send("whatever you have to send over and over") [size="1"][font="Arial"].[u].[/u][/font][/size]
cosmicdancer Posted August 13, 2008 Author Posted August 13, 2008 I've sort of done that - I usually have the script tab to the field of interest and the send the info. You could manually select the field of interest and then press your OS shortcut key(s). Ctrl-Alt-zThe script can be one line:Send("whatever you have to send over and over")Thanks for your help and advice! Unfortunately when I create a shortcut and go to its properties I can't edit the "Shortcut key" value. It's set to "None" and the field seems to be locked in some way (but not greyed out). I'm wondering if this has been disabled intentionally on our system? I can't imagine why!I would be interested to see your full script, if you wouldn't mind. Is it a question of sending the tab key press a set number of times or do you find the name of the field and do it that way?
herewasplato Posted August 14, 2008 Posted August 14, 2008 ... I can't edit the "Shortcut key" value. ...If you click one time in that field and then press just the letter z (not the Ctrl-Alt part) does it let you set the value then?... I would be interested to see your full script, ...Sure - but I gotta warn ya - it will put you to sleep reading thru the comments/lecture :-)http://www.autoitscript.com/forum/index.php?showtopic=14395 [size="1"][font="Arial"].[u].[/u][/font][/size]
cosmicdancer Posted August 14, 2008 Author Posted August 14, 2008 If you click one time in that field and then press just the letter z (not the Ctrl-Alt part) does it let you set the value then?Sure - but I gotta warn ya - it will put you to sleep reading thru the comments/lecture :-)http://www.autoitscript.com/forum/index.php?showtopic=14395Just had a quick look and I reckon I can get my head round it OK - I'll try it out later. Thanks so much for your help it really has been very useful and I appreciate your time. I also just had a look at COM in the help files - maybe I'll leave that for now :-)
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