AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[ARCHIVED THREAD] SciTE4AutoHotkey v2 Stable - Released.
Goto page Previous  1, 2, 3, 4 ... 9, 10, 11  Next
 
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Sat Mar 07, 2009 10:57 am    Post subject: Reply with quote

Lexikos wrote:
What errors are there to detect? You shouldn't be passing it an invalid window handle; if in doubt, use IsWindow. (Edit: I see you already do.)

I've finished adding the IsHungAppWindowProc() checking and replacing
SendMessageTimeout() with a regular SendMessage(), so this is finished Smile
Code:
// SciTE4AutoHotkey v2 LUA message pumper 1.0
// Build with: gcc -shared -o module.dll -I..\lualib\src main.c scite.la
// You've got to have a LUA distribution at ..\lualib (creates the src folder)
// for this to work.
// Also copy the scite.* files from http://luaforge.net/frs/download.php/3293/scite-debug.zip (scite.la, scite.def and scite.lib)

// Includes
#include <windows.h> // Windows include
#include "lauxlib.h" // LUA include

// Some defines
#define DllExport __declspec(dllexport)
#define RET_OK 1
#define RET_FAIL 0
#define MAX_TITLE 255
#define ADDFUNC(a) lua_register(L, #a, lib_##a)

// Those defines may not be present
#ifndef PROCESS_VM_OPERATION
#define PROCESS_VM_OPERATION 0x0008
#endif
#ifndef PROCESS_VM_READ
#define PROCESS_VM_READ 0x0010
#endif
#ifndef PROCESS_VM_WRITE
#define PROCESS_VM_WRITE 0x0020
#endif
#ifndef MEM_COMMIT
#define MEM_COMMIT 0x1000
#endif
#ifndef PAGE_READWRITE
#define PAGE_READWRITE 4
#endif
#ifndef MEM_RELEASE
#define MEM_RELEASE 0x8000
#endif

// Global variables
HWND cWindow = 0, tWindow = 0;
const char* cWinTitle; // variable pointer to constant char

// For IsHungAppWindowProc()
typedef BOOL (*IWAPtype)(HWND);
IWAPtype IsHungAppWindowProc;

// Dummy function that always returns false
BOOL _lib_ishungapp(HWND hWnd){ return 0; }

// Initializes the IsHungAppWindow() function.
void _lib_initprocs(){
   HMODULE user32 = LoadLibrary("user32");
   IsHungAppWindowProc = (IWAPtype) GetProcAddress(user32, "IsHungAppWindow");
   if(!IsHungAppWindowProc)
      IsHungAppWindowProc = (IWAPtype) _lib_ishungapp;
}

// Private callback function to enumerate the windows.
BOOL CALLBACK _lib_winsearchproc(HWND hWnd, LPARAM lParam){
   char wTitle[MAX_TITLE+1];
   // Get window title
   GetWindowText(hWnd, wTitle, MAX_TITLE);
   if(!strncmp(wTitle, cWinTitle, lParam)){
      // Window found.
      cWindow = hWnd;
      return 0; // Cancel the enumeration
   }
   return 1; // Continue enumerating the windows
}

// localizewin(wintitle) -- Localizes the window with the specified window title to
//  further send messages to it. True = sucess, false = failure.
int lib_localizewin(lua_State* L){
   // set the global variables
   cWinTitle = luaL_checkstring(L, 1);
   tWindow = cWindow, cWindow = 0;

   // look for the window
   EnumWindows((WNDENUMPROC)_lib_winsearchproc, strlen(cWinTitle));
   if(!cWindow){ // no window found?
      // just restore the old window and return false.
      cWindow = tWindow;
      lua_pushboolean(L, RET_FAIL);
      return 1;
   }
   // return true.
   lua_pushboolean(L, RET_OK);
   return 1;
}

// pumpmsg(msg, wparam, lparam) -- Sends a message to the current window.
//  Timeout of 8 seconds. It returns the value that the window returns.
int lib_pumpmsg(lua_State* L){
   // get the parameters
   int iMsg = luaL_checkint(L, 1);
   int wParam = luaL_checkint(L, 2);
   int lParam = luaL_checkint(L, 3);

   if(!IsWindow(cWindow)) // invalid window?
      return luaL_error(L, "Invalid window handle.");
   if(IsHungAppWindowProc(cWindow))
      return luaL_error(L, "The window appears to be hung. Aborting...");

   // just dispatch the message to the window
   int result;
   result = (int) SendMessage(cWindow, (UINT)iMsg, (WPARAM)wParam, (LPARAM)lParam);
   
   // return the number that the window gave to us
   lua_pushnumber(L, result);
   return 1;
}

// pumpmsg(msg, wparam, lparam) -- Sends a message with lparam as string to the current window.
//  Timeout of 8 seconds. It returns the value that the window returns.
int lib_pumpmsgstr(lua_State* L){
   // get the parameters
   int iMsg = luaL_checkint(L, 1);
   int wParam = luaL_checkint(L, 2);
   const char* lParam = luaL_checkstring(L, 3);
   // get the string length
   int lParamSize = strlen(lParam);

   if(!IsWindow(cWindow)) // invalid window?
      return luaL_error(L, "Invalid window handle.");
   if(IsHungAppWindowProc(cWindow))
      return luaL_error(L, "The window appears to be hung. Aborting...");

   // inject the string at the process.
   DWORD pID;
   GetWindowThreadProcessId(cWindow, &pID);
   HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, 0, pID);
   if(!hProcess)
      return luaL_error(L, "Couldn't open the memory of the window!");
   void* rlParam = VirtualAllocEx(hProcess, 0, lParamSize, MEM_COMMIT, PAGE_READWRITE);
   if(!rlParam)
      return luaL_error(L, "Couldn't allocate the memory at the window!");
   if(!WriteProcessMemory(hProcess, rlParam, lParam, lParamSize, NULL))
      return luaL_error(L, "Couldn't inject the string parameter at the window!");

   // just dispatch the message to the window
   int result;
   result = (int) SendMessage(cWindow, (UINT)iMsg, (WPARAM)wParam, (LPARAM)lParam);

   // free the memory used by the string
   if(!VirtualFreeEx(hProcess, rlParam, 0, MEM_RELEASE))
      return luaL_error(L, "Failed to free the memory at the window!");
   if(!CloseHandle(hProcess))
      return luaL_error(L, "Couldn't close the process handle!");

   // return the number that the window gave to us
   lua_pushnumber(L, result);
   return 1;
}

int DllExport libinit(lua_State* L){
   // initialize the IsHungAppWindowProc() function
   _lib_initprocs();
   // add the following functions to the LUA engine
   ADDFUNC(localizewin);
   ADDFUNC(pumpmsg);
   ADDFUNC(pumpmsgstr);
   return 0;
}

_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Sat Mar 07, 2009 12:00 pm    Post subject: Reply with quote

Ok, I'm making a new toolbar for SciTE4AutoHotkey v2 that uses the
code that Lexikos provided me in conjunction with the Toolbar module by
majkinetor:

And now a random screenshot showing a pre-Stable private build running on Windows 98:

Smile
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Talisman2



Joined: 27 Nov 2008
Posts: 16
Location: Johannesburg, South Africa

PostPosted: Fri Apr 03, 2009 9:28 am    Post subject: SciTE4Ahk v2 - Midnight Style Reply with quote

I prefer a command-line approach to editors, hence, I prefer a black background...
If you do too, replace your ahk.style.properties file innards with the following:

Code:

# Syntax-highlighting properties for AutoHotkey scripts
# Putting this in a separate file makes it easier to replace
# and mantain
#
# March 1, 2009 - fincs
#

# The current line
caret.line.back=#444444

# Base (background, base font)
style.ahk1.32=back:#030003,font:Courier New

# Default (everything not below: spaces, untyped parameters)
#style.ahk1.0=fore:#707070,bold
style.ahk1.0=fore:#8f8f8f,bold

# Line comment (; syntax)
#style.ahk1.1=fore:#008000,italics
style.ahk1.1=fore:#ff7fff,italics

# Block comment (/*...*/ syntax)
#style.ahk1.2=fore:#406040,italics
style.ahk1.2=fore:#bf9fbf,italics

# Escape (`x)
#style.ahk1.3=fore:#FF8000,bold
style.ahk1.3=fore:#007fff,bold

# Operator
#style.ahk1.4=fore:#7F200F,bold
style.ahk1.4=fore:#80dff0,bold

# Expression assignement operator
#style.ahk1.5=fore:#FF4F00,bold
style.ahk1.5=fore:#00b0ff,bold

# String
#style.ahk1.6=fore:#404040,bold
style.ahk1.6=fore:#bfbfbf,bold

# Number
#style.ahk1.7=fore:#2F4F7F,bold
style.ahk1.7=fore:#d0b080,bold

# Identifier (variable & function call)
# Not used by the lexer but by the style below and by hotkeys
#style.ahk1.8=fore:#CF2F0F
style.ahk1.8=fore:#30D0F0

# Variable dereferencing %varName%
#style.ahk1.9=$(style.ahk1.8),back:#E4FFE4,bold
style.ahk1.9=$(style.ahk1.8),back:#1B001B,bold

# Label & Hotstrings (& Function definition?). Also defines a bit of style for hotkeys.
#style.ahk1.10=fore:#000000,back:#FFFFA1
style.ahk1.10=fore:#FF00FF,back:#00005e

# Keyword - Flow of control
#style.ahk1.11=fore:#480048,bold,italics
style.ahk1.11=fore:#B7FFB7,bold,italics

# Keyword - Commands
#style.ahk1.12=fore:#004080,bold
style.ahk1.12=fore:#FFBF7F,bold

# Keyword - Functions
#style.ahk1.13=fore:#0F707F,italics
style.ahk1.13=fore:#F08F80,italics

# Keyword - Directives
#style.ahk1.14=fore:#F04020,bold,italics
style.ahk1.14=fore:#0FBFDF,bold,italics

# Keyword - Keys & buttons
#style.ahk1.15=fore:#FF00FF,bold
style.ahk1.15=fore:#00FF00,bold

# Keyword - Built-in Variables
#style.ahk1.16=fore:#CF00CF,bold,italics
style.ahk1.16=fore:#30FF30,bold,italics

# Keyword - special parameters ("Keywords")
#style.ahk1.17=fore:#0000FF
style.ahk1.17=fore:#FFFF00

# Keyword - User defined
#style.ahk1.18=fore:#800020,bold
style.ahk1.18=fore:#7FFFDF,bold

# Variable keyword (built-in) dereferencing %A_xxx%
#style.ahk1.19=$(style.ahk1.16),back:#F9F9FF
style.ahk1.19=$(style.ahk1.16),back:#060600

# Error (unclosed string, unknown operator, invalid dereferencing, etc.)
#style.ahk1.20=back:#FFC0C0
style.ahk1.20=back:#003F3F


Note: I've commented out all the original fincs style entries, so if you don't like something, change it back.
_________________
Keep it Real
Talismaniac
http://www.autohotkey.net/~Talisman
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Moru



Joined: 24 Mar 2009
Posts: 39

PostPosted: Sat Apr 25, 2009 12:13 am    Post subject: Reply with quote

For me: The best one

Thanks a lot !!
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Sat Apr 25, 2009 3:20 pm    Post subject: Reply with quote

Moru wrote:
For me: The best one

Thanks a lot !!


You're welcome Smile
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Montu



Joined: 11 Feb 2009
Posts: 142
Location: India

PostPosted: Thu Apr 30, 2009 3:48 am    Post subject: Reply with quote

I love this software but,

How canI can setup the default text zoom level to 150% in your program?
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Thu Apr 30, 2009 10:22 am    Post subject: Reply with quote

Montu wrote:
I love this software but,

How canI can setup the default text zoom level to 150% in your program?


I found this on the SciTE documentation:
Quote:
magnification - Sets the initial magnification factor of the edit pane. This is useful when you want to change the size of text globally, such as after changing the screen resolution without having to touch every style setting. 0 is default, negative values makes the size smaller and positive values make it larger.


So what you have to do is add the following line:
Code:
magnification = put number here
to the SciTEGlobal.properties file.
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Montu



Joined: 11 Feb 2009
Posts: 142
Location: India

PostPosted: Thu Apr 30, 2009 12:00 pm    Post subject: Reply with quote

fincs wrote:
Montu wrote:
I love this software but,

How canI can setup the default text zoom level to 150% in your program?


I found this on the SciTE documentation:
Quote:
magnification - Sets the initial magnification factor of the edit pane. This is useful when you want to change the size of text globally, such as after changing the screen resolution without having to touch every style setting. 0 is default, negative values makes the size smaller and positive values make it larger.


So what you have to do is add the following line:
Code:
magnification = put number here
to the SciTEGlobal.properties file.



thanks it wokred,
go to Option > User Options file
there is already magnification =1 line in it
I changed it to =2
and it works great!
Back to top
View user's profile Send private message
tidbit



Joined: 09 Mar 2008
Posts: 1808
Location: Minnesota, USA

PostPosted: Wed May 06, 2009 3:10 pm    Post subject: Reply with quote

I was wondering how to change the caret color.
for the dark theme, it is quite hard to see where it is.

Great app BTW.
_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb
Back to top
View user's profile Send private message
Charon the Hand



Joined: 07 Aug 2007
Posts: 8

PostPosted: Sun May 10, 2009 10:09 pm    Post subject: Reply with quote

Thank you very much for putting this all together, Fincs. After years of using jujuedit, I finally made the plunge to a new editor,
and it's splendid. I had only one problem, which I finally solved after hours of puttering around. I thought I would share the
solution, in case anyone else was as annoyed as I was.

When using 'Go' (F5) on a persistent script, SciTE would just wait for the script to end, which it never does. To relaunch the
script with changes, I would have to manually stop the old instance. Of course, the solution is so simple, it took me forever
to figure out. Just add this line: 'command.go.subsystem.$(file.patterns.ahk)=2' in the ahk.properties file and SciTE will make
the 'Go' command available at all times, instead of greying it out while a script is running.
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Mon May 11, 2009 8:13 pm    Post subject: Reply with quote

Charon the Hand wrote:
Thank you very much for putting this all together, Fincs. After years of using jujuedit, I finally made the plunge to a new editor,
and it's splendid. I had only one problem, which I finally solved after hours of puttering around. I thought I would share the
solution, in case anyone else was as annoyed as I was.

When using 'Go' (F5) on a persistent script, SciTE would just wait for the script to end, which it never does. To relaunch the
script with changes, I would have to manually stop the old instance. Of course, the solution is so simple, it took me forever
to figure out. Just add this line: 'command.go.subsystem.$(file.patterns.ahk)=2' in the ahk.properties file and SciTE will make
the 'Go' command available at all times, instead of greying it out while a script is running.


Oh, thanks a lot! I was also being annoyed by that behavior Razz
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
almex



Joined: 16 Oct 2007
Posts: 10
Location: Las Vegas, NV, USA

PostPosted: Tue May 12, 2009 5:36 pm    Post subject: Reply with quote

Excellent work, fincs!
Back to top
View user's profile Send private message
JohnnyTwoTone



Joined: 10 May 2009
Posts: 45

PostPosted: Sat May 16, 2009 1:56 am    Post subject: Reply with quote

increased my productivity a LOT.

thanks a lot.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun May 17, 2009 7:31 pm    Post subject: Reply with quote

I've finally posted a link to SciTE4AutoHotkey on the download page.

So that users have a place to post feedback, you might consider linking from www.autohotkey.net/~fincs/SciTE4AutoHotkey_2/web/ to this topic here.

Thanks for all the work that went into this impressive project.
Back to top
View user's profile Send private message Send e-mail
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Sun May 17, 2009 8:14 pm    Post subject: Reply with quote

Chris wrote:
I've finally posted a link to SciTE4AutoHotkey on the download page.

So that users have a place to post feedback, you might consider linking from www.autohotkey.net/~fincs/SciTE4AutoHotkey_2/web/ to this topic here.

Thanks for all the work that went into this impressive project.

Oh, what an honor! Embarassed
I will link to this topic, don't worry Very Happy

EDIT: Linking done.
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4 ... 9, 10, 11  Next
Page 3 of 11

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group