This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General Discussion
 General Discussion
 Close notepad without saving
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

chandisciple

75 Posts

Posted - 05/29/2016 :  22:40:02  Show Profile
Hi all,

Wondering why below statement close notepad and automatically click on dont save. Please help.

acCloseApplication(nil, gsx, gsy)
acSendKeys("n")

OR

acCloseApplication(nil, gsx, gsy)
acSendKeys("{TAB}{ENTER}")


Rob

USA
2615 Posts

Posted - 05/29/2016 :  22:42:30  Show Profile  Visit Rob's Homepage
Have you tried putting an acDelay call after close application? It may be sending the keys too quickly
Go to Top of Page

chandisciple

75 Posts

Posted - 05/30/2016 :  00:20:08  Show Profile
Did all combinations of acdelay rob no go.

acCloseApplication(nil, gsx, gsy)
acDelay (500)
acSendKeys("n")

when i do the above for example, and i run it, i get the options to click on
"save" "dont save" "cancel"

when i click on cancel the cursor returns back to the notepad file naturally and i see that it types "n" in the text file no matter how long i take to click on cancel. Is that a helpful ?

so if the text in the notepad was "test" it is later "testn"

Edited by - chandisciple on 05/30/2016 00:24:48
Go to Top of Page

newbie

9 Posts

Posted - 05/30/2016 :  01:26:24  Show Profile
for me, this works: acSendKeys("%{F_4}n")
no need acCloseApplication nor acDelay

Edited by - newbie on 05/30/2016 01:30:55
Go to Top of Page

chandisciple

75 Posts

Posted - 05/30/2016 :  02:32:31  Show Profile
Wow that works Newbie ! Thanks !

Just curious whats wrong with my code, in fact very curious.
Go to Top of Page

newbie

9 Posts

Posted - 05/30/2016 :  04:42:53  Show Profile
Nothing wrong with your code!
maybe acCloseApplication() use SendMessage method:
acSendMessage(acGetForegroundWindow(),0x10,0,0) -- 0x10 WM_CLOSE
acSendKeys("n") will bring you "...n"

acPostMessage(acGetForegroundWindow(),0x10,0,0)
acSendKeys("n") will do what you want.

Sending a message to an app will send the message, and then WAIT for the message to be processed BEFORE RETURNING.
Posting a message to an app send the message to the applications message queue, and then returns immediately, WITHOUT WAITING for the message to be processed.

What do you think, ROB?!
Go to Top of Page

Rob

USA
2615 Posts

Posted - 06/06/2016 :  19:13:31  Show Profile  Visit Rob's Homepage
Yes, newbie, you're quite correct! I should probably use PostMessage instead...
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000