Link to home
Start Free TrialLog in
Avatar of Juilette
Juilette

asked on

Outside Of App or Inside

Problem:
I have an app and it shells and IBM communication app which sends me to a user sign on. I need to sign on because the files I need to access are within the mainframe side of things.

Once at the sign on I am outside my app so if I sign on I get to the dos prompt which is where I want to be, but my app is in limbo.
Once I reach the dos prompt I need to move files-change dir-etc. I can do this with a bat file. But as I'v stated, my app is (I don't know where it is), I've left it behind at the sign on.

How do I
1. use my app to sign on and proceed with shelling the bat file.
or
2. have my app kick in after I sign on

What I am missing is the ability to signon as user and then proceed.
Just the middle..I can do the steps before and after...I need the communication.
Hope this makes sense.
Wayne

Avatar of vettranger
vettranger

Hi Wayne,

If you're using a batch file anyway, can you not have it create a file at the end of the batch instructions ... which your VB program is then looking for the existence of, and when it finds it knows to proceed?
ASKER CERTIFIED SOLUTION
Avatar of mark2150
mark2150

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Juilette

ASKER

Ok..Vettranger...not sure what you are trying to tell me...I don't start with a bat I use a bat once inside the working enviroment.

Mark:
You are 500 miles ahead of me...I'm new to most of this and learning but I'm still taking baby steps and you're in full gallop...

Here is my testing app of what I've got and hopefully you can fill in what is missing.
I use shelldef because I don't know the ext of the ibm pgm I shell.
'shell the imb sign on
    ShellDef ("C:\Program Files\Microsoft Office\Office\Shortcut Bar\Office\s390")

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

I have to login here...enviroment, username and password.
either manual or through code...

 What do I have to do to stop and have my app sign on.
 example code would be nice. Sign on is 3 things.
 1. c or d or e
 2. username
 3. password

 Then after I sign on x can be processed


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 X      This happens after I sign on      x
""""""""""""""""""""""""""""""""""''''''
Dim iIntNum%   'file number variable

sPikName = txtPikName.Text     'initilaze the variable

iIntNum = FreeFile           'initilaze the varaible

'open a file as a .bat file and write to it
    Open "C:\PickBat.bat" For Output As #iIntNum
'write to file
    Print #iIntNum, "@echo off"
    Print #iIntNum, "C:\"
    Print #iIntNum, "copy c:\books\" & sPikName & "*.txt c:\AHelper"

'close the file
    Close #iIntNum

'shell the bat file
    ShellDef ("C:\PickBat.bat")

'let it finish
  'is this a Doevents

'logout
  'similar to login

'Thanks,
'Wayne
I think Mark has the answer if you read it one line at a time it not to hard to understand. What his code does is control the shell app by sending keystrokes just as if you type them from the key board. I find if I don't understand someone code I will paste it into a sample project and press F8 and step thru the code line by line till I understand it. Well that my 2 cents worth good luck.
I don't doubt Mark's expertise for a moment .... it's the distance between our understanding that obscures the answer.
Wayne
Lets go over it a bit at a time:

' Start child process and get handle
'
RetVal = Shell(Quote & Adobe_Path & Quote, vbMaximizedFocus)

This is starting the external app. In the program that this is lifted from Quote is " and Adobe_Path is the fully qualified name of the application. Using your code you'ld write:

RetVal = Shell("C:\Program Files\Microsoft Office\Office\Shortcut Bar\Office\s390")

RetVal is a numeric identifier of the task ID associated with the child task. You keep this on hand to know "where" to send commands.

I have a subroutine called SENDIT that is used to send messages to the child task. You pass it the information you want to send as if you were typing from the command line. Certain function keys and control keys have special symbols. See the SENDKEYS command in the help for more details. Again referring to your code you might code:

Username = "MyLoginName"
Password = "MyPassword"
SENDIT("C") ' or "D" or "E"
SENDIT(Username & "{enter}" )
SENDIT(Password & "{enter}" )

The "{enter}" tells the routine to send the <Enter> key (this is from the SENDKEYS help). Each invocation of SENDIT will wait for the command to compelete before continuing.

The SENDIT routine is used as is.

Any other questions, just ask.

M
Sorry, all I could give you was an A

OK...I will figure this out but if you will...I use shelldef instead of shell because I can't get the extension of the S390 ibm app. If I shell it with exe, dos, or bat I get can't find file.

If I ShellDef it opens. How can I get the handle of this app so I can apply what you've give me...retval doesn't work with shelldef.

Wayne

Thanks...

What threw me for a loop was this>>>' Send a series of commands to child
sendit ("%WA")                      'Close all windows
sendit ("%FO" & datadrive & "\" & filename & "{enter}")
sendit ("%VG")                      ' Issue page select command
sendit (onpage & "{enter}")         ' Specify page



Thanks Mark...sorry about the low points for the question but that's all I had when posted.

Wayne
Do a search on your HD and find the extension fo the S390 app yourself. My guess is that it's a .LNK (shortcut). If you look in the named shortcut you should see that actual name of the app. Calling it directly should speed things up and allow use of SHELL instead of SHELLDEF.

The commands listed were lifted out of an actual app. The % is interpritted as <ALT> with the next character. See the details on SendKeys in the help to make sense of it all.

Don't worry about the points. Glad to help.

M
I did a find on the HD and it comes back listed as S390....no extension....when I get to work I'll try the .lnk and see it I can get it to work...if not I'll do it the old fashioned way and try and find the documentation that came with the IBM Communition App.

Thanks again
Wayne
Mark...
If you are still connected.
The file is a WS extension.
Under properties it says..DosName = s390.WS
I even tried to shell the lnk file pertaining to it but it won't shell
only shell def...

the shell command is good ..I've used it many times.
I can shelldef it only.

Is there another way to get the hwnd so I can send keys to it.

Wayne
This looks to be like an office shortcut. What happens if you SHELL to S390.WS?

M