Skip to main content

Hello everyone,

 

First off, my apologies if I may not have worded my question correctly.

So, pretty often we have users calling in where we need to unlock a application for them.

The users usually don't know the initials of their application, so we just unlock a total of 5 different applications, as they are the most common.

The only variable that changes is the file group number that they will supply to us.

I was wondering how I could use a loop to go through the different applications and apply the file group number I input, either by message box, or whatever is possible without having to manually go into the script and change it.

Here is my current code for one application.

Sub Main
EMConnect "A"
EMSendKey "<ATTENTION>"
EMSetCursor 10, 03
EMSendKey "1<ENTER>"
EMSendKey "<PF12>"
EMSendKey "IPRLSFGP APPCDE(*ApplicationInitials*) FGP("
EMWriteScreen *FileGroup*, 18, 31
EMSetCursor 18, 34
EMSendKey ")"
End Sub

For example, if the Application initials were ME and the file group number was 203 the code would output the following:

 

I would like to created a script to go through five different Applications, DS, IE, IT, PO, and RV.

With first the script prompting for a filegroup number and applying it to each of those applications.

 

Sorry if it's confusing, that's the best way I can think to explain it.

 

Thanks in advance!

 

Update: I was able to figure out how to use Input Box for a Variable, however, the script still seems a bit lengthy for the different Applications.

Is there a way to loop through this in a more compressed script?

Example below:

Sub Main
' Get File Group Number and change the FGP

Dim RetC as Integer
Title$ = "File Group"
Prompt$ = "Please Enter Your File Group Number"
Default$ = ""
X% = 100
Y% = 100
N$ = InputBox(Prompt$, Title$, Default$, X%, Y%)


EMConnect "A"
EMSendKey "<ATTENTION>"
EMWaitX 1, RetC
EMSetCursor 10, 03
EMWaitX 1, RetC
EMSendKey "1<ENTER>"
EMWaitX 1, RetC
EMSendKey "<PF12>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(DS) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(IE) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(IT) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(PE) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
End Sub

 


#Rumba

Hello everyone,

 

First off, my apologies if I may not have worded my question correctly.

So, pretty often we have users calling in where we need to unlock a application for them.

The users usually don't know the initials of their application, so we just unlock a total of 5 different applications, as they are the most common.

The only variable that changes is the file group number that they will supply to us.

I was wondering how I could use a loop to go through the different applications and apply the file group number I input, either by message box, or whatever is possible without having to manually go into the script and change it.

Here is my current code for one application.

Sub Main
EMConnect "A"
EMSendKey "<ATTENTION>"
EMSetCursor 10, 03
EMSendKey "1<ENTER>"
EMSendKey "<PF12>"
EMSendKey "IPRLSFGP APPCDE(*ApplicationInitials*) FGP("
EMWriteScreen *FileGroup*, 18, 31
EMSetCursor 18, 34
EMSendKey ")"
End Sub

For example, if the Application initials were ME and the file group number was 203 the code would output the following:

 

I would like to created a script to go through five different Applications, DS, IE, IT, PO, and RV.

With first the script prompting for a filegroup number and applying it to each of those applications.

 

Sorry if it's confusing, that's the best way I can think to explain it.

 

Thanks in advance!

 

Update: I was able to figure out how to use Input Box for a Variable, however, the script still seems a bit lengthy for the different Applications.

Is there a way to loop through this in a more compressed script?

Example below:

Sub Main
' Get File Group Number and change the FGP

Dim RetC as Integer
Title$ = "File Group"
Prompt$ = "Please Enter Your File Group Number"
Default$ = ""
X% = 100
Y% = 100
N$ = InputBox(Prompt$, Title$, Default$, X%, Y%)


EMConnect "A"
EMSendKey "<ATTENTION>"
EMWaitX 1, RetC
EMSetCursor 10, 03
EMWaitX 1, RetC
EMSendKey "1<ENTER>"
EMWaitX 1, RetC
EMSendKey "<PF12>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(DS) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(IE) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(IT) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(PE) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
End Sub

 


#Rumba

Hi Erik, 

glad you figured out the Input prompt mechanism.

In terms of reducing the length of the macro code you can use a subroutine to call code that you want to execute multiple times. Then in your Sub Main(), just call it as often as you need and pass it the AppCode and GroupCode which you wish to reset.

e.g.

Sub Main
   ' Get File Group Number and change the FGP
   Dim RetC as Integer, N as String
   Title$ = "File Group"
   Prompt$ = "Please Enter Your File Group Number"
   Default$ = ""
   X% = 100
   Y% = 100
   N = InputBox(Prompt$, Title$, Default$, X%, Y%)

   EMConnect "A"
   EMSendKey "<ATTENTION>"
   EMWaitX 1, RetC
   EMSetCursor 10, 03
   EMWaitX 1, RetC
   EMSendKey "1<ENTER>"
   EMWaitX 1, RetC
   EMSendKey "<PF12>"
   EMWaitX 1, RetC

   ResetApp "DS", N
   ResetApp "IE", N
   ResetApp "IT", N
   ResetApp "PE", N
End Sub

Sub ResetApp(AppCode as String, GroupCode as String)
   Dim myString as String, RetC as Integer
   EMSetCursor 18, 07
   EMWaitX 1, RetC
   MyString = "IPRLSFGP APPCDE(" & AppCode & ") FGP(" & GroupCode & ")"
   EMSendKey MyString
   EMWaitX 1, RetC
   EMSendKey "<ENTER>"
   EMWaitX 1, RetC
End Sub

Hope that helps,
Tom 


Hello everyone,

 

First off, my apologies if I may not have worded my question correctly.

So, pretty often we have users calling in where we need to unlock a application for them.

The users usually don't know the initials of their application, so we just unlock a total of 5 different applications, as they are the most common.

The only variable that changes is the file group number that they will supply to us.

I was wondering how I could use a loop to go through the different applications and apply the file group number I input, either by message box, or whatever is possible without having to manually go into the script and change it.

Here is my current code for one application.

Sub Main
EMConnect "A"
EMSendKey "<ATTENTION>"
EMSetCursor 10, 03
EMSendKey "1<ENTER>"
EMSendKey "<PF12>"
EMSendKey "IPRLSFGP APPCDE(*ApplicationInitials*) FGP("
EMWriteScreen *FileGroup*, 18, 31
EMSetCursor 18, 34
EMSendKey ")"
End Sub

For example, if the Application initials were ME and the file group number was 203 the code would output the following:

 

I would like to created a script to go through five different Applications, DS, IE, IT, PO, and RV.

With first the script prompting for a filegroup number and applying it to each of those applications.

 

Sorry if it's confusing, that's the best way I can think to explain it.

 

Thanks in advance!

 

Update: I was able to figure out how to use Input Box for a Variable, however, the script still seems a bit lengthy for the different Applications.

Is there a way to loop through this in a more compressed script?

Example below:

Sub Main
' Get File Group Number and change the FGP

Dim RetC as Integer
Title$ = "File Group"
Prompt$ = "Please Enter Your File Group Number"
Default$ = ""
X% = 100
Y% = 100
N$ = InputBox(Prompt$, Title$, Default$, X%, Y%)


EMConnect "A"
EMSendKey "<ATTENTION>"
EMWaitX 1, RetC
EMSetCursor 10, 03
EMWaitX 1, RetC
EMSendKey "1<ENTER>"
EMWaitX 1, RetC
EMSendKey "<PF12>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(DS) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(IE) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(IT) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
EMWaitX 1, RetC
EMSetCursor 18, 07
EMWaitX 1, RetC
EMSendKey "IPRLSFGP APPCDE(PE) FGP("
EMWaitX 1, RetC
EMWriteScreen N$, 18, 31
EMWaitX 1, RetC
EMSetCursor 18, 34
EMWaitX 1, RetC
EMSendKey ")"
EMWaitX 1, RetC
EMSendKey "<ENTER>"
End Sub

 


#Rumba
Tom,

As always thank you!
This worked perfectly.

I am still getting use to using subroutines to execute the code multiple times and this helps a lot.