ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Sending user-supplied text

<< < (2/3) > >>

Target:
Here's a question out of the command help.  For InputBox they show InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default].  I assume the [ ] brackets mean the commands, I guess I mean parameters, are optional.  The question is, from the examples they show, you have to put a comma followed by a space for every one of those parameters you don't want to use.  That is, if you want to include parameter #1 and 3, but not #2, you have to put the comma+space between 1 and 3.  Correct?  And if you don't want to use any parameters after #3, you can just stop?-ralphkru (June 12, 2012, 10:16 PM)
--- End quote ---

correct - so this would look like


--- ---  input box, VarName, Par#1,,Par#3

MilesAhead:
The best thing to do is create a script that does as close to what you want as you can get, then post it in the Support forum.  Explain what you are trying to do. Plenty of AHK programmers will offer suggestions and code snippets. The traffic will be at least an order of magnitude greater than on this thread.

http://www.autohotkey.com/community/viewforum.php?f=1&sid=d15b3ccf4db5ea37362128d6bb672472

Also it's good to follow these suggestions:
http://www.autohotkey.com/community/viewtopic.php?f=1&t=4986

If you are trying to do something like Close All Windows and there's a CloseAllWindows function in the help index that you didn't bother too look for, you won't get much sympathy. But if you follow the suggestions many people will try to help you out there.

As for syntax, AHK is the only programming language I'm familiar with that has a string data type that's wrapped in double quotes sometimes, but just written in at other times with no quoting whatever. It drives me nuts.  I think if they ever get to AHK2 strings will be double quoted always. Also they will dump the comma syntax. It's too primitive.

The trouble is it handles context specific hotkeys in a way that AutoIt can't. So I can't ignore it even if I'd like to. :)


rjbull:
OP:  do you mean something like pasting the text of a form letter, with only the name changed?  If so, there are already ways of doing that without actually needing to write your own program.

ralphkru:
Right.  I am, in fact, using a program that allows me to do that kind of thing (http://www.sector-seven.net/software/controlpad), but I'm really interested in trying to learn how to use AHK.  If something useful comes out of this, that would be frosting on the cake.

This program I stole straight out of the docs:

--- ---InputBox, UserInput, Phone Number, Please enter a phone number., , 640, 480
if ErrorLevel
    MsgBox, CANCEL was pressed.
else
    MsgBox, You entered "%UserInput%"
This works fine and the variable containing the user's input does half of what I want.  Instead of the 2nd Msg Box, I want to send a sentence like Your phone number is %UserInput% to Word or Notepad or some other app.  I've tried replacing the 2nd MsgBox line with a Send command.  That didn't work.  I tried assigning a hotkey to the script, so I could actually be sitting in my target app when I called the script up.  That didn't work.  I've been looking at WinActivate, but I'm not sure how to use that.  Mainly, I'm not sure if the problem is in the script (syntax) or that I'm lacking a command.

Target:
This program I stole straight out of the docs:

--- ---InputBox, UserInput, Phone Number, Please enter a phone number., , 640, 480
if ErrorLevel
    MsgBox, CANCEL was pressed.
else
    MsgBox, You entered "%UserInput%"
This works fine and the variable containing the user's input does half of what I want.  Instead of the 2nd Msg Box, I want to send a sentence like Your phone number is %UserInput% to Word or Notepad or some other app.  I've tried replacing the 2nd MsgBox line with a Send command.  That didn't work.  I tried assigning a hotkey to the script, so I could actually be sitting in my target app when I called the script up.  That didn't work.  I've been looking at WinActivate, but I'm not sure how to use that.  Mainly, I'm not sure if the problem is in the script (syntax) or that I'm lacking a command.-ralphkru (June 13, 2012, 11:35 PM)
--- End quote ---

here's a super simple example using 2 hotkeys (one for input, and one for output) -


--- ---#persistent
#singleinstance, ignore

#I::InputBox, UserInput, Enter a phone number,,, 150, 90

#O::sendinput, Your input value was '%userinput%'

WIN+I invokes the input box and populates the var UserInput with a value (or not, if you cancel the dialog)

WIN+O sends the output to wherever the cursor is (so some care may need to be taken)

Of course you can make this a lot more sophisticated depending on your requirements, but this covers the basics of what you're trying to do

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version