Sign in to follow this  
Followers 0
Achilles

Send("{enter}") = continue

13 posts in this topic

#1 ·  Posted (edited)

The title pretty much sums this up. I have a program where you enter some text and then usually click on a button to continue. How would you make so that you just send enter and it continues. I've tried a few things but it hasn't worked yet. This is probably very simple but still, any help would be nice...

Piano_man

Edit: Would I use a hotkey?

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



Yeah, i would try HotKeySet

Share this post


Link to post
Share on other sites

Yeah, i would try HotKeySet

I tried that but the problem is that the since hotkeyset calls a function I have to add a function in the middle of a "While 1 ==> Wend" and whenever I do that is says there is an error because there's no "Wend" on the line that the function starts. I'll attach the script and see if anyone can help me, thankyou

Piano_man

Research.au3


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Is the research.au3 the file you are making? If so their is no need to make a Func for every website, just use a array, and use 1 func. For the hotkey just make the Func outside the While statment their is no need to have it inside the While statement because you dont need it running all the time.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is the research.au3 the file you are making? If so their is no need to make a Func for every website, just use a array, and use 1 func. For the hotkey just make the Func outside the While statment their is no need to have it inside the While statement because you dont need it running all the time.

Yah the research file is the one I'm making. I don't know much about arraying 'cause I've never used it so I'll look into that more later. The Func can't be outside of the While because I don't want it to do all that, I only need it to do the same thing that $button1 does, not the rest.

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            ExitLoop
        Case $msg = $button1 ;or "{enter}"
            $path = Run("C:\Program Files\Mozilla Firefox\firefox.exe")
                Run(@ComSpec & " /c " & $path, "", @SW_HIDE)
                Opt("WinTitleMatchMode", 2)
                WinWait("Mozilla Firefox")
                WinSetState("Mozilla Firefox", "", @SW_MAXIMIZE)
            If BitAnd(GUICtrlRead($ask),$GUI_CHECKED) = $GUI_CHECKED then Ask()
            If BitAnd(GUICtrlRead($dictionary),$GUI_CHECKED) = $GUI_CHECKED then Dictionary()
            If BitAnd(GUICtrlRead($encyclopedia),$GUI_CHECKED) = $GUI_CHECKED then Encyclopedia()
            If BitAnd(GUICtrlRead($google),$GUI_CHECKED) = $GUI_CHECKED then Google()
            If BitAnd(GUICtrlRead($howstuffworks),$GUI_CHECKED) = $GUI_CHECKED then Howstuffworks()
            If BitAnd(GUICtrlRead($reference),$GUI_CHECKED) = $GUI_CHECKED then Reference()
            If BitAnd(GUICtrlRead($wikipedia),$GUI_CHECKED) = $GUI_CHECKED then Wikipedia()
            If BitAnd(GUICtrlRead($yahoo),$GUI_CHECKED) = $GUI_CHECKED then Yahoo()
        Send("^w")
        GUIDelete()
    Exit
    Endselect
WEnd
Exit
Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

You could check out "_IsPressed" (#include misc.au3)


[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Share this post


Link to post
Share on other sites

You could check out "_IsPressed" (#include misc.au3)

Alright, thanks, I got it to continue... but now I have another problem. It will continue if I push enter, but then the enter in the functions I have don't work, they just restart the whole process again. I looked around a little bit but I didn't see anyway besides exiting and that doesn't really work in mine, I don't think.

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            ExitLoop
        Case $msg = $button1 or _IsPressed("0D")
            $path = Run("C:\Program Files\Mozilla Firefox\firefox.exe")
                Run(@ComSpec & " /c " & $path, "", @SW_HIDE)
                Opt("WinTitleMatchMode", 2)
                WinWait("Mozilla Firefox")
                WinSetState("Mozilla Firefox", "", @SW_MAXIMIZE)
            If BitAnd(GUICtrlRead($ask),$GUI_CHECKED) = $GUI_CHECKED then Ask()
            If BitAnd(GUICtrlRead($dictionary),$GUI_CHECKED) = $GUI_CHECKED then Dictionary()
            If BitAnd(GUICtrlRead($encyclopedia),$GUI_CHECKED) = $GUI_CHECKED then Encyclopedia()
            If BitAnd(GUICtrlRead($google),$GUI_CHECKED) = $GUI_CHECKED then Google()
            If BitAnd(GUICtrlRead($howstuffworks),$GUI_CHECKED) = $GUI_CHECKED then Howstuffworks()
            If BitAnd(GUICtrlRead($reference),$GUI_CHECKED) = $GUI_CHECKED then Reference()
            If BitAnd(GUICtrlRead($wikipedia),$GUI_CHECKED) = $GUI_CHECKED then Wikipedia()
            If BitAnd(GUICtrlRead($yahoo),$GUI_CHECKED) = $GUI_CHECKED then Yahoo()
        Send("^w")
        GUIDelete()
    Exit
    Endselect
WEnd
Exit

Func Ask()
        Send("http://www.ask.com/{enter}")
        $load = FFLoadWait(140, 60, 1)
        If $Load = 1 Then
        Else
        Send(GuiCtrlRead($text))
        Send("{enter}")
        Sleep(5000)
        Send("^t")
        Winwaitactive("Mozilla Firefox")
            Sleep(2000)
        Endif
    Endfunc

The whole thing is attached to if you want to see it...

Piano_man


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

EDIT:

Do you mind using Internet explorer, because you can use IE.au3 to do everything without Send ("{Enter}").

Edited by Vivvic

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Share this post


Link to post
Share on other sites

EDIT:

Do you mind using Internet explorer, because you can use IE.au3 to do everything without Send ("{Enter}").

I would but anytime I've tried an IE.au3 script it says there's an error 'cause it can read the file "IE.au3"

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

I had the same problem, get latest beta and use

#include <c:/program files/autoit3/beta/include/IE.au3>

[quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I had the same problem, get latest beta and use

#include <c:/program files/autoit3/beta/include/IE.au3>
That solved the first thing but now there says there's an error on line 311 because there is no Case situation with no matching Select statement. I went to the file and added a select/endselect in but then there was another one. Then I looked down and there's about 5000 lines of text so I sort of would like to know if I'm doing something wrong. I changed all my files so that they open with the Autoit under the Beta file but that didn't make any difference...

Piano_Man

Edit: Should I try unistalling the old one and then reinstalling the beta?

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

You're probably missing an EndIf or something or just an EndSelect.

Work your way up from that line and make sure that every If has and EndIf, every Select has a EndSelect, every For has a Next, every Do has an Until, and every While has a WEnd from that point up.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

You're probably missing an EndIf or something or just an EndSelect.

Work your way up from that line and make sure that every If has and EndIf, every Select has a EndSelect, every For has a Next, every Do has an Until, and every While has a WEnd from that point up.

Alright nevermind... sorry took me awhile to figure this out. My computer hadn't changed files to open with the Beta version so it wasn't understanding it all and obviously the errors it showed me were because the beta version excepts it.

@Vivvic

I'll look at the IE example and all that and switch it over to IE sometime... it may take a while but I'll post again on this post once I have a new version.

Thankyou both for your help,

Piano_Man

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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