Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Scripting & Automation
  New Posts New Posts RSS Feed - How to close another application
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedHow to close another application

 Post Reply Post Reply
Author
Message
anonymous View Drop Down
Groupie
Groupie


Joined: January 15 2004
Location: United States
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote anonymous Quote  Post ReplyReply Direct Link To This Post Topic: How to close another application
    Posted: August 15 2006 at 2:48am
I know how to start another Windows program using ESC STX >, but how can I close the program?
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: August 15 2006 at 3:01am
You can use the AppFind and AppClose statements from a script. Also, you need to use ESC STX < instead of > because the > form will cause AccuTerm to wait until the app is closed by the user. The < form allows AccuTerm to run in parallel with the launched app.

For example, if you open IE with:
EQU ESC TO CHAR(27), STX TO CHAR(2), CR TO CHAR(13), EM TO CHAR(25)

PRINT ESC:STX:'<http://www.google.com':CR:

you can close it with:
PRINT ESC:STX:'P X=AppFind("Google"): If X <> "" Then AppClose X':CR:


If you need to be more precise about locating the app you want to close, you can get a list of all open apps, then use a loop to find the one you are interested in and close it:

SCR='Dim x() As String':EM
SCR=SCR:'AppList x':EM
SCR=SCR:'For i = LBound(x) To UBound(x)':EM
SCR=SCR:'If InStr(1,x(i),"Microsoft Internet Explorer") > 0 Then':EM
SCR=SCR:'AppClose x(i)':EM
SCR=SCR:'Exit For':EM
SCR=SCR:'End If':EM
SCR=SCR:'Next i'
PRINT ESC:STX:'P':SCR:CR:

Thanks,

Pete

Back to Top
mdsi2000 View Drop Down
Groupie
Groupie


Joined: October 12 2006
Location: United States
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdsi2000 Quote  Post ReplyReply Direct Link To This Post Posted: January 12 2010 at 12:21am

Hello Peter,

I can use this piece of code to close IE. But I have a question on opening a IE. How can I CAPTURE the output of that webpage?
 
I tried:
    *
URL = 'http://www.411.com/search/ReversePhone?full_phone=':SRCH:'&localtime=survey'
    CMD = ESC:STX:'<':URL:CR
    PRINT CMD CAPTURING JUNK
 
But obiously, it doesn't compile because you can't use CAPTURING in a PRINT statement.
 
Thanks,
Peter G.
Back to Top
Shrek59 View Drop Down
Senior Member
Senior Member


Joined: December 04 2006
Location: New Zealand
Status: Offline
Points: 208
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shrek59 Quote  Post ReplyReply Direct Link To This Post Posted: January 12 2010 at 12:30am
How about using cURL or WGET?
 
Brian
Back to Top
mdsi2000 View Drop Down
Groupie
Groupie


Joined: October 12 2006
Location: United States
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdsi2000 Quote  Post ReplyReply Direct Link To This Post Posted: January 12 2010 at 6:53am

Hello,

How would that work? I'm not familiar...
 
 
Thanks,
-Peter G.
Back to Top
Shrek59 View Drop Down
Senior Member
Senior Member


Joined: December 04 2006
Location: New Zealand
Status: Offline
Points: 208
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shrek59 Quote  Post ReplyReply Direct Link To This Post Posted: January 12 2010 at 8:27am
Hi Peter,

cURL is a command-line utility to perform http transfers. You can use it to download a webpage using a command like:

  [path-to-curl]\curl.exe -o destination-filename  url-to-get

For example:

  curl -o .\dest\webpage.htm http://www.rbnz.govt.nz/statistics/exandint/b1/data.html

There are a heap of options that I haven't explored. I've only used it to automate the download of spreadsheets, but it is much more functional than that.

WGET is broadly similar. They say they aren't the same as each other, but you be the judge ...

Have a look at both and see if they meet your needs.

Cheers,

Brian
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.