Sign in to follow this  
Followers 0
rudi

Converting Scriptomatic VBS to AU3:

6 posts in this topic

Hi.

I'm just excercising with some conversions of Scriptomatic 2 VBS scripts. Works quite nice.

Two things I don't know:

1.) The examples seem all to start with this line:

On Error Resume Next

This probably means, "if something goes wrong, just ignore it and proceed with the next entry", right? Howto do such a thing in Autoit?

2.) For example in Win32_DiskDrive (and many others from Scriptomatic) there are some entries, that need "preprocessing" before using the values for Echo output:

strCapabilities = Join(objItem.Capabilities, ",")
  WScript.Echo "Capabilities: " & strCapabilities

Q2.1: Howto do so in Autoit?

Q2.2: Howto check, if the next "Object.Something" will need such an action?

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites



Hi.

I'm just excercising with some conversions of Scriptomatic 2 VBS scripts. Works quite nice.

Two things I don't know:

1.) The examples seem all to start with this line:

On Error Resume Next

This probably means, "if something goes wrong, just ignore it and proceed with the next entry", right? Howto do such a thing in Autoit?

2.) For example in Win32_DiskDrive (and many others from Scriptomatic) there are some entries, that need "preprocessing" before using the values for Echo output:

strCapabilities = Join(objItem.Capabilities, ",")
  WScript.Echo "Capabilities: " & strCapabilities

Q2.1: Howto do so in Autoit?

Q2.2: Howto check, if the next "Object.Something" will need such an action?

Regards, Rudi.

You have to add your own error handling and there are good examples of COM error handlers in the Example scripts.

Why bother when it's already done for you with the AutoIt version of Scriptomatic?

The compiled version is here

AutoIt scriptomatic.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

You have to add your own error handling and there are good examples of COM error handlers in the Example scripts.

On my way :)

Why bother when it's already done for you with the AutoIt version of Scriptomatic?

The compiled version is here

AutoIt scriptomatic.

Great work, impressive! Thanks for that URL.

Anyways, I'd like to know howto do these two:

CODEstrCapabilities = Join(objItem.Capabilities, ",")
  WScript.Echo "Capabilities: " & strCapabilities

Q2.1: Howto do so in Autoit? (that Join...)

Q2.2: Howto check, if the next "Object.Something" will need such an action?

The MSDN Library is describing a lot of such stuff. And I want to write some code to transform these examples to AI3. But this fails, when such a "Join" is required.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Anyways, I'd like to know howto do these two:

CODEstrCapabilities = Join(objItem.Capabilities, ",")
  WScript.Echo "Capabilities: " & strCapabilities

Q2.1: Howto do so in Autoit? (that Join...)

Q2.2: Howto check, if the next "Object.Something" will need such an action?

The MSDN Library is describing a lot of such stuff. And I want to write some code to transform these examples to AI3. But this fails, when such a "Join" is required.

Regards, Rudi.

#include <array.au3>
Dim $Array[3]
$Array[0] = "Mr."
$Array[1] = "John"
$Array[2] = "Doe"
$sStr = _Join ($array)
MsgBox(0, "Test Echo", "Contents = " & @CRLF & $sStr)

Func _Join($aArray)
   Return _ArraytoString($aArray, " ")
EndFunc

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Hi.

#include <array.au3>
$sStr = _Join ($array)
Thanks!

I had searched the Help File of Autoit v3.2.12.1 for "Join" and "_Join", but nothing was listed. (Other functions in ARRAY.AU3 are listed :) )

So this basically means, that e.g.

Win32_DiskDrive, objItem.Capabilities, the "Capabilities" is an array of values?

I'm going to understand WMI and that object stuff better, slowly.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Hi.

Thanks!

I had searched the Help File of Autoit v3.2.12.1 for "Join" and "_Join", but nothing was listed. (Other functions in ARRAY.AU3 are listed :) )

So this basically means, that e.g.

Win32_DiskDrive, objItem.Capabilities, the "Capabilities" is an array of values?

I'm going to understand WMI and that object stuff better, slowly.

Regards, Rudi.

You have it pretty well right. Join() is a concantenation function and as far as I know it onlt works with arrays so how you handle it will depand on how you intend to displat the data. I could just as easily used

Func _Join($aArray)
   Local $sRtn = "Results:" & @CRLF
   For $i = 0 To Ubound($aArray)-1
      $sRtn &= @Tab & $aArray[$i] & @CRLF
   Next
   Return StringStripWS($sRtn, 2)
EndFunc

Echo can be replaced with a MsgBox() or ConsoleWrite() &Etc.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0