Jump to content
Sign in to follow this  
Achilles

Opening script in scite via code without activating scite

Recommended Posts

Achilles

I figured out (at least one way) how to open a script in scite by using ShellExecute. Now I just want to make it so that scite doesn't take focus. Any ideas?

#include <File.au3>

_FileCreate(@DesktopDir & '\test.au3')
Run('notepad.exe') ; activate another window
Sleep(1000)

ShellExecute(@DesktopDir & '\test.au3', '', @DesktopDir, 'edit', @SW_SHOWNA)

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

Share this post


Link to post
Share on other sites
somdcomputerguy

I don't know if one can prevent an app from taking focus when it's started, but focus can be 'given back' to what had it first. Like this maybe?

#include <File.au3>

_FileCreate(@DesktopDir & '\test.au3')
Run('notepad.exe') ; activate another window
Sleep(1000)

$title = WinGetTitle("[active]")
ShellExecute(@DesktopDir & '\test.au3', '', @DesktopDir, 'edit', @SW_SHOWNA)
WinActivate($title)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Achilles

I don't know if one can prevent an app from taking focus when it's started, but focus can be 'given back' to what had it first. Like this maybe?

#include <File.au3>

_FileCreate(@DesktopDir & '\test.au3')
Run('notepad.exe') ; activate another window
Sleep(1000)

$title = WinGetTitle("[active]")
ShellExecute(@DesktopDir & '\test.au3', '', @DesktopDir, 'edit', @SW_SHOWNA)
WinActivate($title)

That was my less preferred second option... I wonder if there's some scite command line parameter... I'll try searching that

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

Share this post


Link to post
Share on other sites
somdcomputerguy

Perhaps if an app is started hidden or minimized it doesn't take focus?


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Achilles

Perhaps if an app is started hidden or minimized it doesn't take focus?

Hmm, that doesn't help me much because the program I'm writing is designed to run when scite is already up and running...

I found this... I don't understand the part about "Command Subsystem".. but it looks like something in there might help.


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

Share this post


Link to post
Share on other sites
Achilles

Here's a try using run instead of shell execute... Still no luck though. Maybe one you will see what I'm missing here...

#include <File.au3>

Global Const $SCITE_PATH = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\SciTE.exe', '')

_FileCreate(@DesktopDir & '\test.au3')
Run('notepad.exe') ; activate another window
Sleep(1000)

Run($SCITE_PATH & ' -open:test.au3', @DesktopDir, @SW_SHOWNOACTIVATE)
Edited by Achilles

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  

×