Sign in to follow this  
Followers 0
clicked

Interface to Intel Visual Fortran

1 post in this topic

I work with some guys who want to write AutoIt scripts in Fortran, using the AutoIt DLL. Well, Okay. I thought I would share a few tips:

The AutoIt calls require FORTRAN interfaces. Here is an interface for ClipPut:

INTERFACE
       SUBROUTINE AU3_ClipPut (ClipStr) 
       !DEC$ ATTRIBUTES DEFAULT, STDCALL, ALIAS : '_AU3_ClipPut@4' :: AU3_ClipPut 
       CHARACTER*(*) ClipStr
       END SUBROUTINE AU3_ClipPut
    END INTERFACE

Every AutoIt routine you use requires interfacing like this. They can all go into an INCLUDE file. If I write this file, I'll upload it.

The next problem is FORTRAN uses ASCII strings, while AutoIt uses Unicode. You have to convert the strings before calling the AutoIt routine. The strings must also be terminated.

..
      use IFNLS

      integer*4 istatx

      character*40 helloStr /'Hello World'C/
      integer*2 helloUNI (40)

      istatx = MBConvertMBToUnicode ( helloStr, helloUNI )

      call AU3_ClipPut ( %REF(helloUNI) )

Then, you need to add autoitx3.lib onto the "Additional Dependencies" list, and put this lib file somewhere IVF (Intel Visual Fortran) can find it. You must also put the autoitx3.dll on your PATH, so this too can be found when the FORTRAN executable starts up.

There may be data types that are even harder work than strings. If this happens, then you will end up with a C-language layer that munges the parameters until FORTRAN can digest them.

Overall, I can't recommend that FORTRAN "autoit scripts" makes any sense compared to the short time it takes to learn real AutoIt script, but here it is if you really need it.

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