Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 3:03 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: vbscript and registry information
PostPosted: May 24th, 2010, 11:48 am 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Hi All,
Looking up a means of running visual basic script to pick up system settings as well as USB drive Serial numbers but not sure how Opus implements this.


vbscript being run

Code:
intDriveType = 3
strComputer = "."
result = ""
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk")
For Each objDisk in colDisks
  Select Case objDisk.DriveType
  Case intDriveType
    result = result & objDisk.DeviceID & vbtab & objDisk.FileSystem & vbtab & objDisk.Size & vbtab & objDisk.FreeSpace & vbtab & objDisk.VolumeSerialNumber & vblf
  End Select
Next
Set colDisks = nothing
Set objWMIService = nothing






Also struggling with registry read operations. From the help file, it appears that I can only read in registry items that I have created using the application. For this I am in need of finding out if silverlight is installed on the system browsers.

Code:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Silverlight\Version

Help appreciated.

eomc40

Opus ver 6.5


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 3:39 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
sorry for very brief reply

are you writing a VB script? or trying to reproduce what the script does?
If you can create an EXE from the VBScript, then you can run this from Opus...Launch file action
What informarion do you need to get? Opus has a host of system variables, which you can use.



To get the silverlight version:-
var OpusVer = ReadRegistryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Silverlight", "Version")
I wasn't aware that I had silverlight installed, but the version is registered. Perhaps it's installed by default??

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 4:46 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Debug.tracePane("childrenBefore", childrenBefore());
Sandyn,
Thanks for the reply.
I was reading through the User guide and did throw me a bit on the registry items,

but noted that via script, you are not limited to what the actions description states.


For vbscript, I just need to run the bare code and have its output picked within the application. Puzzled also as to why Opus does not have a mechanism of reading from the clipboard whereas we can "save" to clipboard, overhead of having third part utilities capture that and then pass back to Opus doesn't seem neat a solution.

I have picked up the following from the web for the vbscript

http://commandwindows.com/scripts.htm
http://www.microsoft.com/resources/docu ... x?mfr=true

and evaluating this... (still need to write to file though)...


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 7:07 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
there is a copy 'clipboard text to variable' action, but no script equivalent.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : eomc40, mackavi


Top
 Profile  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 7:12 pm 
Offline
User avatar

Joined: October 25th, 2004, 10:33 am
Posts: 257
Location: UK
Opus: Pro 8
OS: Windows 7 Professional x64
System: Dell XPS15 i7x4 2.1Ghz 6GB 128GB SSD
For the script, it's Windows Scripting Host you're trying to use, which is built into Windows as cscript.exe in \windows\system32. So you should be able to run cscript from Opus with a .vbs file as a parameter.

Edit: I realise now that's exactly what the link you've posted says. :oops:


For this message Dave Emberton has been thanked by : eomc40, mackavi


Top
 Profile Visit website  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 7:53 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
eomc,

According to the following, you can read the serial from the registry keys
http://www.experts-exchange.com/Program ... 87299.html

for a Page var named 'GotRegKey'
Code:
GotRegKey = ReadRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR\\Enum","0") ;


or
Code:
//suggestion:  either change the upper limit of 'i' in the loop, or detect the empty value earlier
for (i=0;i<10;i++)
{
GotRegKey = ReadRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR\\Enum",i)  ;
wait(2)
if( GotRegKey == "" ) {GotRegKey = "\n"+ "Done  " +i ; return}
}



Quote:
@eomc40: but noted that via script, you are not limited to what the actions description states.
The above code works in OpusScript, but not in standard Actions

[Lar Edit:] ps. In the RegKey path, you can change USBSTOR to sdbus to get SD Card info.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : eomc40, mackavi


Last edited by Lar_123 on May 25th, 2010, 9:12 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 8:18 pm 
Offline

Joined: November 11th, 2004, 1:43 pm
Posts: 172
Location: Buckinghamshire, UK
Thanks Lar123, Dave Emberton, sandyn
Exactly what I was looking for to implement via vbscript. I will find a way to associate these USB serial numbers with with the active assigned drive letters.

BTW, this is for a cheap a chearful security system, need to have app only running from USB drive. I read somewhere that the serial number here is not changeable between drives, hence this registry query plus maybe another direct read of the serial number can form basis of the security assuming that registry key/value can be altered easily via script.

Thanks again,

Sandyn, can't find the copy clipboard action (not sure looking in right place)...


For this message eomc40 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: vbscript and registry information
PostPosted: May 25th, 2010, 10:37 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
The Copy Clipboard Text to Variable action will paste the text contents of the Windows clipboard to a specified variable in Opus.

Note:

You can copy text from any software application into an Opus variable. If the clipboard includes other information apart from text, such as pictures, these will not be pasted into the variable. The variable will contain plain text only. In other words, if the copied text is formatted (e.g. bold, underlined etc.) the formatting is lost when copied to the variable.

Setting up the Copy Clipboard Text to Variable action:

1. Add the Copy Clipboard Text to Variable action to your trigger, as described in adding actions. The Copy Clipboard Text to Variable tab will automatically appear when you add the action.

2. Click on the down arrow to the right of the Variable option to select the name of the variable you want to paste the text from the Windows clipboard into.

3. Click on the New… button if have not created the variable yet. This will open the New Variable dialog box.

Note:

Once you have created your new variable, its name will appear in the Variable option in this action.

4. Click on the Apply button to save your changes.

The specified variable does not have to be displayed on the screen in order to copy its contents to the clipboard. Furthermore, if the variable is a system or publication variable then it does not even have to be on the same page that contains this action.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : eomc40, mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group