Jump to content

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


 Share

Recommended Posts

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
Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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".

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...