Position launch of shell script


I have a shell script that launches an executable via the attached code.
But I could not position where the popup of the executable launch.

Is there an additional code that I can add to achieve where I want to launch the executable?

PS: I am working on a VBA supported environment hence my codes are written in VB script.

Many thanks for the help/advise in advance.

        str = """C:\Program Files (x86)\ICONICS\GENESIS32\Bin\Gwx32.exe""" + " C:\Users\admin\Desktop\Display.gdf -Runtime -AliasFile=""" + sTextFileName + """"
        Shell str, vbMinimizedNoFocus

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you in a VBScript run-time environment or a VBA run-time environment?
Bill PrewIT / Software Engineering ConsultantCommented:
You should be able to do something like this, position at 10,10 in this example.

(If you are using 64 bit Office, then this will need to be modified slightly to include the PtrSafe modifier, let me know)

' Declare WIndows API "SetWindowsPos"
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long

' Some constands for API functions
Private Const HWND_DESKTOP = 0
Private Const SWP_NOSIZE = &H1

' Start EXE
str = """C:\Program Files (x86)\ICONICS\GENESIS32\Bin\Gwx32.exe""" + " C:\Users\admin\Desktop\Display.gdf -Runtime -AliasFile=""" + sTextFileName + """"
Shell str, vbNormalFocus

'Reposition window
Dim tHwnd As Long
tHwnd = GetForegroundWindow
SetWindowPos tHwnd, HWND_DESKTOP, 10, 10, 0, 0, SWP_NOSIZE

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
csharp_learnerAuthor Commented:
Sorry for the late reply, thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.