Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th February 2003, 20:20   #1
galil
Member
 
Join Date: Jan 2003
Posts: 83
Question console app question

Situation is, I want to include a console progie to my installer (nsis is the best ), however it has one anoying (in my case) feature - to quit it you have to press enter-key (i guess it was implemented to let a user see output or something). This proggie works several times during install, and each time user would have to click enter - and that's pointless and irritating.
Is there some way around this, like emulating a key-press? Terminating a dosbox is not an option, I tried it and it messed up the proggie's work.

PS: I realise that my question is not quite related to NSIS, but I didn't know where else I could ask, and I see lots of experienced people here, programmers and such...
galil is offline   Reply With Quote
Old 19th February 2003, 08:05   #2
Sunjammer
Major Dude
 
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
You could try using
code:
FindWindow $0 "Your Window Title"
SendMessage $0 ${WM_KEYDOWN} 13 0

(note you have to include WinMessages.nsh to define the WM_KEYDOWN variable). This should send a return key press to the window (13 is the ASCII value of carriage return). (this might help give you an idea of how SendMessage can be used)

Alternatively something like AutoIt can be used to control applications using key presses and mouse actions.
Sunjammer is offline   Reply With Quote
Old 19th February 2003, 14:55   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
I think nsExec can also help you. As it runs the console application "inside" NSIS it can't get any output so it won't do nothing when the user presses enter.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 19th February 2003, 21:19   #4
galil
Member
 
Join Date: Jan 2003
Posts: 83
Thanks for the input Sunjammer!

Tried that AutoIt thingie, it's cool, never thought such tool existed . It managed to emulate pressing return. But I wasn't totally pleased with the result, to do it the perfect way I'd have to spend time learning it's commands, and frankly I'd prefer to spend that time learning nsis . Plus it adds another exe to my install.

So if you said that it's possible to do it with nsis, that would be so much better. And I'll use AutoIt only as a last resort. Anyway, I tried to use the code you gave, and it didn't work out.

PHP Code:
FindWindow $0 tty // FindWindow $0 "" "nop_up" also worked
SendMessage $${WM_KEYDOWN13 0 
code above produces some weird sound from pc-speaker (!?), then writes one random symbol to dos-box - so it kinda gets to work: it finds the right window, and writes to it, but not enterkey.
And out of sudden, sometimes it does nothing at all, sometimes it screws-up the dos-box and one time it even screwed-up keyboard and mouse - they started to work incorrectly.

btw, from silliness at first I tried looping it, something like:
PHP Code:
loop:
    
FindWindow $0 tty
    IntCmp 
$0 0 done
    IsWindow 
$0 0 done
    SendMessage 
$0 0x100 13 0
    Sleep 100
    Goto loop
done

and it worked the same, continuously making eeck-sounds from speaker, writing crap to dos-box and eventually freezing my pc.
Kids, don't try this at home!

WTH? Any ideas? Note that I have no experience in programming of any sort, and started to use nsis recently. But I'd really like to get it going.

TIA,
galil

Last edited by galil; 19th February 2003 at 22:29.
galil is offline   Reply With Quote
Old 20th February 2003, 01:22   #5
Sunjammer
Major Dude
 
Join Date: Jun 2002
Location: Swindon, UK
Posts: 559
I've just got home (2am here ) -- I'll try to look at this for you tomorrow morning at work if I can.
Sunjammer is offline   Reply With Quote
Old 20th February 2003, 12:20   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Ignore what I have said, it does wait for enter (at least for makensis).

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump