why let iret = iim1.iimInit ("") in vbs sample code

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

why let iret = iim1.iimInit ("") in vbs sample code

by kind03cn on Tue Dec 30, 2014 10:19 pm

Hi All,

I'm reading the Using a VBS loop for extraction Tutorial (_uploads/extraction2-ScriptedExtraction.htm)

I'm confused by the way it initialize the iMacros scripts. Why we have to write vbs code like the following:

Code: Select all
Set iim1 = CreateObject("imacros")
iret = iim1.iimInit


It looks like it's giving value to iim1 and iret. Why this kind of valuation sentence will take effect on iMacros interface? From my understanding, valuation sentence only change the value of certain variable, and it won't do other things...

Why can't we just use code like?
Code: Select all
CreateObject("imacros")
iim1.iimInit


Sorry my question may sound very silly to you. But I am really confused at this time....
kind03cn
 
Posts: 16
Joined: Mon Nov 03, 2014 3:19 pm

Re: why let iret = iim1.iimInit ("") in vbs sample code

by chivracq on Wed Dec 31, 2014 5:21 am

kind03cn wrote:Why can't we just use code like?
Code: Select all
CreateObject("imacros")
iim1.iimInit


Sorry my question may sound very silly to you. But I am really confused at this time....

My 2cts as I don't know anything about VBS...

My understanding is that Yes you can, I would think, but it's only good Practice (in all Programming Languages) to always give a Return Value to executing a Function in order to eventually check on the Return Code for Success or Failure.

With iMacros it has the added Use that it ensures that the Script will wait until the Function has completely executed (especially for 'iimPlay()' when playing several Macros (in a row)) and returned its Value before jumping to the next Instruction...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: why let iret = iim1.iimInit ("") in vbs sample code

by kind03cn on Wed Jan 07, 2015 9:29 pm

Thanks chivracq! Now I understand....

At first I thought all the valuation sentence can only change the value of variables and can't do any others thing. Then I remembered the Msgbox Function, like
answer = Msgbox ("Continue?", Vbyesno)
, and then I realized I was wrong.
kind03cn
 
Posts: 16
Joined: Mon Nov 03, 2014 3:19 pm


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 3 guests

-->