VBA to write into .IIM

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.

VBA to write into .IIM

by Sergiusz on Thu Sep 04, 2014 12:20 pm

Greetings!
Tried to find something similar but i missed. I faced strange problem with writing to IIM file like simple TXT.
I use Excel VBA to generate script depending of cells values and then load it directly to IIM file. It works good on my home PC but it doesn't on my work.
In this PC Imacros doesn't see any code in IIM file written, like it is empty, but it can be viewed on Notepad etc.
When I open in Notepad the macro written by Imacros, it looks like just one line, and has normal view in Notepad++.
Here the simple code to run in VBA Excel
Code: Select all
Sub imacros()
Dim imsi As String
macrofile = "C:\Users\sergiusz\Documents\iMacros\Macros\new.iim"
Open macrofile For Output As #1
Print #1, "VERSION BUILD=8820413 RECORDER=FX"
Close #1
End Sub

I use Windows 7 and MS Office 2010 Professional Plus on my work PC and Windows Xp+Office 2010 on the home PC.
I suspect some hiiden symbols is in the roots of problem. Any ideas to help me? Thx.
Attachments
Capture.PNG
Capture.PNG (5.64 KIB) Viewed 2599 times
Sergiusz
 
Posts: 3
Joined: Thu Sep 04, 2014 11:43 am

Re: VBA to write into .IIM

by chivracq on Sat Sep 06, 2014 11:02 am

Open your Script once using the iMacros Editor and resave it, I would suggest, or open it in WordPad and resave it to open it then in Notepad to check that the Line Breaks have been correctly converted (and resave it eventually (in Notepad) using UTF-8 Encoding...).
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: VBA to write into .IIM

by Sergiusz on Sun Sep 07, 2014 9:07 am

Thanks a lot with UTF-8 idea! :idea:
Now it works with another method of file writing. Something like this
Code: Select all
Sub Save2File()
sText = "URL GOTO=http://google.com"
sFile = "C:\Users\sergiusz\Documents\iMacros\macros\new.iim"
    Dim oStream
    Set oStream = CreateObject("ADODB.Stream")
    With oStream
        .Open
        .Charset = "utf-8"
        .WriteText sText
        .SaveToFile sFile, 2
    End With
    Set oStream = Nothing
End Sub
Sergiusz
 
Posts: 3
Joined: Thu Sep 04, 2014 11:43 am

Re: VBA to write into .IIM

by chivracq on Sun Sep 07, 2014 12:14 pm

Sergiusz wrote:Thanks a lot with UTF-8 idea! :idea:
Now it works with another method of file writing. Something like this
Code: Select all
Sub Save2File()
sText = "URL GOTO=http://google.com"
sFile = "C:\Users\sergiusz\Documents\iMacros\macros\new.iim"
    Dim oStream
    Set oStream = CreateObject("ADODB.Stream")
    With oStream
        .Open
        .Charset = "utf-8"
        .WriteText sText
        .SaveToFile sFile, 2
    End With
    Set oStream = Nothing
End Sub

Good...! And thanks for sharing, that might help some other Users one day...
- (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: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: VBA to write into .IIM

by Sergiusz on Mon Sep 08, 2014 7:39 am

By the way, one more thing i'd like to add is execution of written script after its generation:
Code: Select all
Sub Save2File()
.....
Shell "C:\Program Files\Mozilla Firefox\firefox.exe imacros://run/?m=new.iim"
End sub
:wink:
Sergiusz
 
Posts: 3
Joined: Thu Sep 04, 2014 11:43 am

Re: VBA to write into .IIM

by hnoor0033 on Tue Feb 02, 2016 10:34 pm

it can be viewed on Notepad etc.
When I open in Notepad the macro written by Imacros,
NOOR
hnoor0033
 
Posts: 1
Joined: Tue Feb 02, 2016 10:24 pm


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 7 guests

-->