Sign in to follow this  
Followers 0
janwayne

Request: Send ctrl + a/s/t whatever script

23 posts in this topic

#1 ·  Posted (edited)

I was trying to use the default example Notepad script, but it failed when I tried to do the following:

Send({CTRL}+{T})

Sleep(500)

I could not compile it to an .exe file.

What would be the correct code here?

Edited by janwayne

Share this post


Link to post
Share on other sites



Look here


Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Share this post


Link to post
Share on other sites

Send("^t") would send CTRL-T, see the help file for the Send command.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Send("^t") would send CTRL-T, see the help file for the Send command.

Thanks.

Now, if i want iexplore.exe started by the script, and want it to send ctrl+t - then what?

For now, I've done this:

Run("iexplore.exe")

WinWaitActive("[CLASS:Internet Explorer]")

Send("^t")

The script doesn't start iexplore.exe at all.

Edited by janwayne

Share this post


Link to post
Share on other sites

If you include the full path to iexplore.exe (C:\Program Files\Internet Explorer\iexplore.exe) it starts fine.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Try:

Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")

or:

ShellExecute("iexplore")
Edited by Ramzes

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Share this post


Link to post
Share on other sites

We're getting closer, but IE doesn't open the new tab:

; Start IE

ShellExecute("iexplore")

; Venter på at IE er aktiv

WinWaitActive("[CLASS:Internet Explorer]")

; Send ctrl + t

Send("^t")

Sleep(500)

Send("^t")

Share this post


Link to post
Share on other sites

Think more than 3 minutes above your problem. We won't write it for you.

Search for a _IEAttach function.


Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Share this post


Link to post
Share on other sites

I've searched for 2 hours now, without any luck.

I'm not hardcore for this, so therefor, please, I need help to get this work.

Thanks in advance.

Share this post


Link to post
Share on other sites

Why "WinWaitActive("[CLASS:Internet Explorer]")"

I made a test script like this

WinWaitActive("[CLASS:Internet Explorer]")
MsgBox(0, "", "")

and no msgBox shows..

so it wont open the new tab - because no window with this title comes up...

In your AutoIt install directory is the AU3Info.exe

Open it

Wait for your browser to be in that state where you like to open the new tab

drag the finder cross onto your browser window

lookup the title in AU3Info and put it inside the winwaitactive function

now it should work

Share this post


Link to post
Share on other sites

So far, so good :graduated:

Now, is it possible, to bind a control key, så that if I press "num0" or something similar, to make the script reload?

Then I don't need to re-open the converted script .exe file.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

HotKeySet Function...

Write all you have an an Function.. e.g.:

Func newtab()

xxxxxxx

your code

xxxxxxx

EndFunc

And assign a hotkey to this function

HotkeySet("^d", "newtab")

EDIT:

Forgot the while-loop

your script should look like this:

HotKeySet("^l", "newtab")
 
While 1
Sleep( 500 )
WEnd
Func newtab()
WinWaitActive("Internet Explorer")
Send("^t")
EndFunc

Your script sets the hotkey to call this function

Then it goes to the while loop

Waits 500 miliseconds

goes to the beginning of the while loop

waits again

If you press your assigned hotkey, the script stops where it is,

goes to the assigned function and does what is inside the function.

after that it returns to the while loop...

Edited by jWalker

Share this post


Link to post
Share on other sites

Thanks for the post jWalker, but, it doesn't work.

Share this post


Link to post
Share on other sites

Could you post your full script please?

ill tell you then what doesn't work..

Share this post


Link to post
Share on other sites

HotKeySet("^l", "newtab")

While 1

Sleep( 500 )

WEnd

Func newtab()

WinWaitActive("Internet Explorer")

Send("^t")

EndFunc

Nothing happens.

Share this post


Link to post
Share on other sites

Well - my script was only a guideline...

What are the keys you want to use?

New Tab? Ctrl + t

Reload function? i dont know..

What is the exact window title? Not internet explorer or?

Share this post


Link to post
Share on other sites

I'm looking for this script:

It detects, that iexplore.exe is open, if not, it opens it.

Then, it opens a new tab - ctrl + t.

It has to repeat this ctrl + t send command each second hour.

At last, it should be possible to reload this script to start instantly, if I press like "num1".

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

HotKeySet( "{NUMPAD1}", "newtab" )
HotKeySet( "{NUMPAD2}", "showsecs" )
 
$Timer = TimerInit( )
$Timer2 = TimerInit( )
While 1
If ProcessExists( "iexplore.exe" ) Then
$Diff = TimerDiff( $Timer )
If $Diff > 7200000 Then
$Timer = TimerInit( )
newtab( )
EndIf
Sleep( 10 )
Else
ShellExecute("iexplore")
WinWaitActive( "MSN" )
EndIf
If TimerDiff( $Timer2 ) > 2000 Then
ToolTip( "" )
EndIf
WEnd
 
Func newtab( )
Send( "^t" )
EndFunc
 
Func showsecs()
ToolTip( Round(($Diff - 7200000) / 1000 * -1) )
$Timer2 = TimerInit( )
EndFunc

It opens new tab every 2 hours

you can open a new tab with NUM1 ( If you did - the timer will not be resetted )

You can display the remaining seconds with NUM2

Again - WinWaitActive( "MSN" ) - has to be your window title...

EDIT: Fixed Bugs try know!

Edited by jWalker

Share this post


Link to post
Share on other sites

I could compile the .exe, but when i run it, i get the following error:

Line 23 (File ""):

Error: "Func" statement has no matching "EndFunc"

I simple changed your "MSN" text, with the text Au3Info found on the IExplore window, which used to work in my other script.

Share this post


Link to post
Share on other sites

Try to use the complete script... scroll down a bit

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