we have msi installer build with MSI Factory with a couple of custom action scripts (lua & vbs). one of the scripts try to get a custom property from package and write it to file after successfully installation. this custom property is added to downloaded package via MSI.ChangeMSIProperty in asp.NET handler when download was requested with parameters. problem is, that property change brokes the signature of msi file, so we try to add some data to the msi filename. now I need to change that vbscript to handle this. but I can't get the installers filename.
Dim data, tokens
Dim fso, f
Dim setupExeFilename, setupExeFilenameParts
data = Session.Property("CustomActionData")
tokens = Split(data,"|")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(tokens(0) & "\\data.txt", True)
if tokens(1) = "_DEFAULT_" then
setupExeFilename = Session.Property("SETUPEXENAME")
setupExeFilenameParts = Split(data,".")
f.Write setupExeFilenameParts(UBound(setupExeFilenameParts) - 1)
else
f.Write tokens(1)
end if
f.Close
I found Session.Property("SETUPEXENAME") somewhere but doesn't work for me. I search for some property in Session, Session.Property, Session.ProductProperty, Installer but no luck yet. Installer object is present as I try, but no property returns what I need.
If not Installer is nothing then
msgbox "Installer ok"
msgbox Installer.version
end if
is it possible to get the installer filename?
The OriginalDatabase property has what you are looking for. However your reference to CustomActionData tells me your custom action is running in the deferred context. You won't have access to this property. Whatever custom action that is running in immediate and serializing your CustomActionData property will have to obtain this property and put it into CustomActionData.
You should be warned that VB/JScript custom actions are famous for their fragility. You mention SETUPEXENAME so I assume you are using InstallShield as this is an InstallShield property. I'd suggest using InstallScript, C/C++ or C# instead. If you choose InstallScript, I have a sample CustomActionData serialization/deserialization pattern over on InstallSite.org. If C#, it's built into the Microsoft.Deployment.WindowsInstaller library's Session class.
Related
I think this is old question but I need to detail my case.
I use the command Set objAcad = GetObject(, "AutoCAD.Application") to call AutoCAD and get error as above.
But this command worked well when PC has admin user but for some security reasons, this right is removed. User only use standard (domain) user.
Only AutoCAD 2006,2007,2008,2009 got this issue. It works on AutoCAD 2015(even domain user).
I used win7 64bit.
Thanks for any support.
Try passing an empty string instead of nothing as the first parameter, i.e.
Set objAcad = GetObject("", "AutoCAD.Application")
According to this reference there is a difference. In your example, if an instance does not already exist, it will return an error, but with the empty string, it will create a new instance (like CreateObject()
I am opening Lotus files to get data from them. How do I instantiate the Lotus application without using GetObject? I have a reference to "Lotus 123". I am using Lotus SmartSuite 97.
This code works OK but it seeems I should be able to instantiate the Lotus application directly instead of using GetObject.
'get LotusWin
Dim LotusApp As Lotus123.Application
Dim wb As Lotus123.Document
Set wb = GetObject("C:\Temp\TestCopy.WK3", "Lotus123.Workbook")
Set LotusApp = wb.Application
LotusApp.Visible = True
wb.Activate
I tried to use Dim LotusApp As New Lotus123.Application but it give a compile error: Invalid use of New keyword.
I tried to use Dim LotusApp As New Lotus123 but it give a compile error: Expected user-defined type, not project.
I am using Excel VBA as my platform to run the code, but this is not an Excel question so please don't suggest adding an Excel tag.
Also I'm not interested in converting files to Excel.
How do I instantiate the Lotus application without using GetObject?
GetObject() returns a reference to an object provided by a COM component, in your case Lotus123.
As you are communicating with Lotus123 via COM, and Lotus123 apparently does not support the "As New" syntax (which wasn't properly supported even in VB6, and Lotus123 is way older) I see no alternative to using GetObject().
Problem : I am not able to find a solution to add a custom form field in outlook new mail window. I am using NetOffice and so far I have implemented to use user accounts from outlook.
Required guidance as how to add a custom drop-down button with custom text right under the send mail button.
Thanks in advance.
Cheers!
Farhan
I believe that in net office you need to declare a variable to the MAPI folder relevant to the form you want to start altering, and then go through the folder's View collection. A good start that was done in VBA can be found here:
http://www.vbforums.com/showthread.php?492714-RESOLVED-Outlook-Programmatically-add-user-defined-field
This link detailed the making of a custom field, and then adding it to the appropriate folder view default form. You can easily adapt the VBA code in the above link to NetOffice, since it uses the same methods step-through, such as
dim _outlookapplication as Outlook.Application
dim olNamespace as Outlook._Namespace = _outlookapplication.GetNameSpace("MAPI")
dim olFolder as Outlook.Folder = olNamespace.GetDefaultFolder(olDefaultFolders.olFolderContacts)
dim olView as Outlook.View
Good luck!
I have written the following piece of VB script which opens
an existing aplication xyz from the path I specfied.
The application (a custom windows application) opens succesfully.
(I would like to use the automation interface of this application
in my vb script.) for that I call CreateObject.
But, then I also get the error Activex component can't create object: 'xyz' for the line Set xyzObj = CreateObject("xyz").
The error is from this line, since if I remove this line there is no error.
Dim objShell
Set objShell = CreateObject( "WScript.Shell" )
objShell.Exec("C:\abc\def\xyz.exe")
Set xyzObj = CreateObject("xyz")
Set objShell = Nothing
You can't use CreateObject like that with a external program, started in your script or otherwise. CreateObject loads a COM-object that is registered on your pc. Google on vbscript and COM objects and you'll find plenty of info like at http://technet.microsoft.com/en-us/library/ee156598.aspx. If you want to interact with a started program you could use the sendkeys method or better use the autoit com object , see http://www.autoitscript.com/autoit3/docs/intro/ComRef.htm
How can i access the session property for productname in a silent install with vbscript (installshield express 2010 or 2011).
Thank You
From my experience you can read properties during silent installs too, using immediate custom actions. You cannot access properties using a deferred custom action. Is your custom action set as immediate? http://msdn.microsoft.com/library/aa368268.aspx
I think this will do the job :)
Dim ISProject
Set ISProject = CreateObject("IswiAuto15.ISWiProject") \*Create the object*/
ISProject.OpenProject ("C:\Path\To\ISM\Project.ism")\*Initialize it*/
ISProject.ProductName \* Like this you get the value of the name property */
ISProject.ProductName="MyInstallShield" \* and this is how you set */
ISProject.SaveProject()
ISProject.CloseProject
I hope this will be helpful