KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Launch KiX scripts by double clicking them
Goto page 1, 2  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Wed Jul 19, 2006 8:55 pm    Post subject: Launch KiX scripts by double clicking them Reply with quote

Not sure whether anyone's tried this before, but if you load the following text into notepad, and save it as a .reg file, then merge this .reg file, you will be able to lauch KiX scripts by double clicking them. It also adds the option to Open in Notepad on the right click context menu.

Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.kix]
@="kix32.application"

[HKEY_CLASSES_ROOT\kix32.application]

[HKEY_CLASSES_ROOT\kix32.application\shell]
@="Open in Notepad"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open]
@="&Open"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open\Command]
@="C:\\Windows\\system32\\cmd.exe /k \"C:\\Windows\\kix32.exe %1\""

[HKEY_CLASSES_ROOT\kix32.application\shell\Open in Notepad]
@="Open in &Notepad"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open in Notepad\Command]
@="notepad.exe \"%1\""



Assumptions:

1. Your Windows directory is C:\Windows. If not, change as appropriate.
2. KIX32.EXE is in C:\Windows, and this is in your path.
3. You're running XP. If running NT, change the top line to read: REGEDIT4
Back to top
View user's profile Send private message Visit poster's website
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Thu Jul 20, 2006 2:46 am    Post subject: Reply with quote

And you also create a nice vulnerability.
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Thu Jul 20, 2006 9:11 am    Post subject: Reply with quote

Yeah. Thanks for the sarcasm. You dont HAVE to do it if you dont want to.
Back to top
View user's profile Send private message Visit poster's website
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Thu Jul 20, 2006 1:21 pm    Post subject: Reply with quote

Hey, well... Jens suggested associating KiX over at korg so the pot can call the kettle black. No need to get your knickers in a twist.

Anyway, I doubt that script kiddies are going to jump on that real quick and unleash KiX worms on the masses.

I personally don't care to associate KiX and I use a shortcut in SendTo that I then have available on the context menu. I also have several shortcuts to KiX in my dev folder that I can drag/drop my test scripts onto. Each shortcut is slightly different invoking different options on the CL.

_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Thu Jul 20, 2006 2:42 pm    Post subject: Reply with quote

This reg file may be more safe. The default action is to open the script in Notepad, but if you right click, you get the option to open with KIX32.exe. I personally find this quite useful as I have all my scripts in a folder on my network, and I can just right click and run it rather than Start Run CMD, KIX32 <name_of_file> [Enter].

It's not for everyone, but I thought some people might find it useful. Not looking for an argument.

Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.kix]
@="kix32.application"

[HKEY_CLASSES_ROOT\kix32.application]
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000008
@=""

[HKEY_CLASSES_ROOT\kix32.application\shell]
@="Open in Notepad"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open]
@="Open in &Notepad"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open\Command]
@="notepad \"%1\""

[HKEY_CLASSES_ROOT\kix32.application\shell\Open with KIX32]
@="Open with &KIX32"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open with KIX32\Command]
@="C:\\winnt\\system32\\cmd.exe /k \"C:\\winnt\\kix32.exe %1\""

Back to top
View user's profile Send private message Visit poster's website
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Mon Aug 14, 2006 3:08 pm    Post subject: Reply with quote

well done Smile me likie failsafe mode ,)

btw, is it possible to use expandos here? %WINDIR% would be a good one...
Back to top
View user's profile Send private message MSN Messenger
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Mon Aug 14, 2006 3:38 pm    Post subject: Reply with quote

I did originally try using %windir% but unfortunately it didnt work for me...
Back to top
View user's profile Send private message Visit poster's website
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Tue Aug 15, 2006 3:23 am    Post subject: Reply with quote

Because you would have to use REG_EXPAND_SZ instead of REG_SZ in order to have %WINDIR% expand.
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
masken
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 14 Mar 2003
Posts: 202
Location: Gothenburg, Sweden

PostPosted: Wed Aug 30, 2006 2:37 pm    Post subject: Reply with quote

Ok, here's a fixed version. Improvements:

  • Two context-menu options: Edit in Notepad & Execute with KiX32 (none is default).
  • The references to kix32.exe is now %WINDIR%, and cmd.exe %WINDIR\System32 instead of static paths.
  • .kix files are registered as a plaint text persistent handler, meaning Windows XP's Search function also searches text within .kix files.
  • The "Type" information is now "KiX32 Script File"


Code:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.kix]
@="kix32.application"

[HKEY_CLASSES_ROOT\.kix\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\kix32.application]
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000008
@="KiX32 Script File"

[HKEY_CLASSES_ROOT\kix32.application\shell]
@="Edit in Notepad"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open]
@="Edit in &Notepad"

[HKEY_CLASSES_ROOT\kix32.application\shell\Open\Command]
@="notepad \"%1\""

[HKEY_CLASSES_ROOT\kix32.application\shell\Execute with KiX32]
@="Execute with &KiX32"

[HKEY_CLASSES_ROOT\kix32.application\shell\Execute with KiX32\Command]
@=hex(2):25,00,57,00,49,00,4e,00,44,00,49,00,52,00,25,00,5c,00,73,\
  00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,63,00,6d,00,64,00,2e,00,\
  65,00,78,00,65,00,20,00,2f,00,6b,00,20,00,22,00,25,00,57,00,49,00,4e,00,44,\
  00,49,00,52,00,25,00,5c,00,6b,00,69,00,78,00,33,00,32,00,2e,00,65,00,78,00,\
  65,00,20,00,25,00,31,00,22,00,00,00
Back to top
View user's profile Send private message MSN Messenger
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Wed Sep 13, 2006 7:59 pm    Post subject: Reply with quote

OK - not to jump on a knicker-twisting bandwagon or anything Wink

On the HEADs side of this coin, I have been doing this association on my servers for several years. The CUSTOMIZE tool available on my web site does this, along with creating a folder for your scripts and script EXEs, utilities, and such.. adds it to the path, and adds some identification bits to make it easier to be sure which server you're connected to via terminal services or a KVM. The tool is a KiX script, and can be easily customized to perform only the tasks you want/need. I would NOT do this on general user workstations, to minimize the unwitting execution of scripts. I do run the customize process on the workstations of the network admins, so they have all the cool tools available to them.

On the TAILs side of this coin (my remarks come from the MCSE / Network Admin classes I've taught over the years) - NEVER launch a (non-GUI) script from Explorer by double clicking it. Often a script will run and exit without providing time to see the result. The "fix" to that is to put a pause type statement at the end of the script, which renders that script useless for unattended operations. The recommendation I've always made for launching any kind of script is "open a command prompt, then run the script". That's why I put all my scripts in a SCRIPTS folder, and that folder is added to the PATH. An alternative is to install the CMD-Prompt Here widget, so you can easily open a CMD prompt where your script is.

Again, since this is a KixForms site that runs GUI scripts, let me reiterate that the recommendation is for non-GUI scripts.

Also - I'm generally referring to admin scripts, run on servers by persons - admins or operations staff - who have appropriate rights to run these tools. By associating .KIX with scripts, and placing the scripts in a central folder, they are easy to reference, locate, and secure.

BTW - I wrote an ASSOCIATE UDF that creates / modifies these kinds of associations via KiX scripts - the UDF can be found on the Kixtart.org site, or in the KixDev package on my site.

Glenn
Back to top
View user's profile Send private message Visit poster's website
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Wed Sep 13, 2006 8:02 pm    Post subject: Reply with quote

Thanks dad.

By the way, the script wont disappear without you seeing the exit code because of the cmd /k parameter.

I thank you.
Back to top
View user's profile Send private message Visit poster's website
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Wed Sep 13, 2006 8:13 pm    Post subject: Reply with quote

K, son - since you're calling me "dad", you must know I'm old and my vision is failing.. I admit I missed the "/k" switch. :Embarassed

Glenn
Back to top
View user's profile Send private message Visit poster's website
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Wed Oct 25, 2006 8:48 pm    Post subject: Reply with quote

who's still using the console or kix32.exe for that matter?
_________________
Hammer
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gargoyle
KiXforms Aficionado
KiXforms Aficionado


Joined: 30 Dec 2003
Posts: 366
Location: Arizona

PostPosted: Wed Oct 25, 2006 8:56 pm    Post subject: Reply with quote

I use the console extensivly while developing....

Oh you probably meant in production...... Cool

_________________
Parents were invented to make children happy by giving them something to ignore.
Back to top
View user's profile Send private message
peaps
KiXforms Follower
KiXforms Follower


Joined: 17 Jul 2006
Posts: 26
Location: Storrington, West Sussex, UK

PostPosted: Wed Oct 25, 2006 9:01 pm    Post subject: Reply with quote

I use KIX32.exe all the time.


I like the fact you can change the colour of the text in the CMD shell. It's cool.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group