AutoHotkey Community

It is currently May 26th, 2012, 7:10 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Close Program
PostPosted: April 3rd, 2009, 2:17 pm 
Offline

Joined: April 3rd, 2009, 1:56 pm
Posts: 2
I wrote a script called Moffsoft.ahk for keyboard shortcuts which works. I wrote another called close.ahk to close Moffsoft.ahk but I cannot work out why this fails:
WinClose Moffsoft.ahk - AutoHotkey
which is the syntax suggested in FAQ. Apologies for elementary nature of this question.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 2:26 pm 
Offline

Joined: July 21st, 2006, 6:13 am
Posts: 558
Im assuming your Moffsoft script is just keyboard shortcuts, which has no gui so there is really no window to close. Why dont you just assign a hotkey like the following in your Moffsoft script to exit it when you want. I dont see the need for a second script to close the first one, unless Im missing something here.

Code:
Esc::
Exitapp

_________________

HTH...


Report this post
Top
 Profile  
Reply with quote  
 Post subject: An easy way
PostPosted: April 3rd, 2009, 3:51 pm 
Offline

Joined: January 7th, 2009, 7:03 pm
Posts: 43
If you really want to close one script from another, an easy way is to compile the script you want to terminate. That way, it will run as Moffsoft.exe and not Autohotkey.exe. Then you can

Code:
Process, Close, Moffsoft.exe


If you dont want to compile, then you need a bit more code.

Code:
IfWinExist, ahk_pid %Capturer%
  {
    WinClose, ahk_pid %Capturer%
  }
  else
  {
    Run,"%A_ProgramFiles%\AutoHotkey\AutoHotkey.exe" "C:\Documents and Settings\konakm\Desktop\Ahk\capturer.ahk",,,Capturer
  }


if winclose does not work use

Code:
Process, Close, %Capturer%


This will cause the taskbar system tray icon to not dissapear until mouse rollover though ( another script can fix this, lol )

The code above will launch your script and save its pid for later termination, which also means that your closing script must launch your other script(s).

There might be other ways to do it, but I remember spending a lot of time getting this menu of mine to work, and this is what works.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 29th, 2009, 2:01 pm 
Offline

Joined: April 3rd, 2009, 1:56 pm
Posts: 2
Hi, thanks for prompt replies. Using Esc for exit in Moffsoft - it's a calculator - works perfectly and is exactly what I wanted. I'm afraid 'compiling' scripts and those kind of things are way beyond my competence but I intend to study this a bit more as this stuff is incredibly helpful.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 29th, 2009, 9:10 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Check your AHK\Compiler folder, there should be Ahk2Exe.exe in there. Launch it and follow the white rabbit... erm, I mean.. you know... ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 29th, 2009, 9:16 pm 
Offline

Joined: April 10th, 2009, 1:46 am
Posts: 139
Location: Wichita,Kansas
also try
Code:
winkill
it forces the window to close

_________________
Drainx1
Your favorite.

What says that we aren't a visualization of someones dream?
And that person could change the laws of physics without thinking a thing about it.
They could recreate the world, and not know what happened.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 29th, 2009, 10:00 pm 
Offline

Joined: April 29th, 2009, 12:07 am
Posts: 56
The problem has already been answered guys. The ExitApp worked


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cephei1, Google Feedfetcher, Miguel, rbrtryn, Xx7 and 64 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group