Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) AsyncShell issue (Read 3800 times)
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: AsyncShell issue
Reply #15 - Apr 5th, 2005 at 4:44pm
Print Post Print Post  
Yes, using a wsh file eliminates the black box. 

Now that I have a working wsh file, I will have to remove my dynamic coding that created the batch file and convert that into creating a dynamic wsh file.

Thanks again Bharat_Naik for your suggestion and to Tom Marcellus's article in April 2005 issue of Inside Sesame.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: AsyncShell issue
Reply #16 - Apr 5th, 2005 at 8:59pm
Print Post Print Post  
I have finished modifiying my programming to execute the following single line uisng @AsynchShell:
"C:\Sesame\Utilities\SensibleSolutions\SesameTableView.exe /DatabaseTableView=DatabaseName /MaximizeView=1"

And here is the programming that was necessary to execute it without the OS "black box" window

Code
Select All
SubRoutine subSSUtility()

/*
Explanation of Process:
1.  Purpose: Run a utility on the database table that is underneath the current form.
2.  A temporary WSF file is created containing the contents necessary to execute the utility.
3.  The utlity file is executed, and returns control back to Sesame.
4.  The temporary WSH file is deleted.
*/	//=================================================================

//----------------------------------------------------------
var vOK as Int
var vSSPath as String
var vSSUtility as String
var vDatabase as String
var vParameter1 as String
var vParameter2 as String

var vFileHandle1 as String
var vWsfFile as String
var vJobID as String
var vLanguage as String
var vObjShell as String
var vContent as String

vSSPath = "C:\Sesame\Utilities\SensibleSolutions\"
vSSUtility = "SesameTableViewMaximize.exe"
vDatabase = @Database
vParameter1 = "/DatabaseTableView=" + vDatabase
vParameter2 = "/MaximizeView=1"

vWsfFile = "TableViewMax.wsf"
vWsfFile = vSSPath + vWsfFile
vJobID = "<Job id='SesameTableViewMaximize'>"
vLanguage = "<script language='VBScript'>"
vObjShell = "Set objShell = WScript.CreateObject(" + @Chr(34) + "WScript.Shell" + @CHR(34) +")"

vContent = @CHR(34) + vSSPath + vSSUtility + " " + vParameter1 + " " + vParameter2 + @chr(34)

//Start Function Execution =======================================

//Delete file if it exists
If FileExists(vWsfFile) THEN {
	FileDelete(vWsfFile)
	}

//Create Temp WSH File =======================
vFileHandle1 = fileOpen(vWsfFile)

//Write to Temp WSF File =======================
//Write WSF file header block
FileWriteLn(vFileHandle1,"<package>")
FileWriteLn(vFileHandle1, vJobID)
FileWriteLn(vFileHandle1, vLanguage)
FileWriteLn(vFileHandle1, vObjShell)

//Write WSF file content
FileWriteLn(vFileHandle1,"objShell.Run " + vContent)

//Write WSF footer block
FileWriteLn(vFileHandle1,"</script>")
FileWriteLn(vFileHandle1,"</job>")
FileWriteLn(vFileHandle1,"</package>")

//Close WSF file
FileClose(vFileHandle1)

//Run Utility File
vOK=@AsynchShell(vWsfFile)

//Delete File =======================
Loiter(500)
If FileExists(vWsfFile) THEN {
	FileDelete(vWsfFile)
	}

End SubRoutine 


To avoid a "black box" when sending parameters to an executable file with @AsynchShell():

This is after trying to just pass the executable and some parameters, and finding that could not be done. 
Then calling a stored batch file and passing parameters and that could not be done.
And then calling a stored batch file with imbedded parameters, and that would not work.
And then dynamically creating and calling a batch file with imbedded parameters, and that would not work.
And finally dynamically creating and passing a WSF file  with imbedded parameters, using VBScript language.
Roll Eyes     Undecided     Roll Eyes
Whew!

Once again, I appreciate the handholding and suggestions that made this finally happen.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print