Keystrokes to Windows

BlitzMax Forums/BlitzMax Programming/Keystrokes to Windows

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This is awesome, thanks! But its messing with my variables. The for loop exits and go becomes some huge nember.

Strict

Const AU_Default:Int=(-2147483647)

Extern "win32"
  Function  WinExec(lpCmdLine$z,nCmdShow:Int)
End Extern

Local path$="c:\autoit-v3\AutoItX"  'CHANGE THIS TO YOUR OWN LOCATION!!!
Global DLLHandle=loadlibraryA(path$+"AutoitX3.dll")
Global AutoIT_Init()"win32"=GetProcAddress(DLLHandle, "AU3_Init") 'Init(void);
Global AutoITX_ClipGet(szClip:Byte Ptr, nBufSize:Int)"win32"=GetProcAddress(DLLHandle, "AU3_ClipGet") 

Function AUTOIT_ClipGet$(nBufSize:Int=255)
Local stuff:Byte[nBufSize]
	AUTOITX_ClipGet(stuff,nBufSize)
	Local ret$=string.FromCString(stuff)
	Return ret$
End Function

Global AutoIT_ClipPut(szClip$z)"win32"=GetProcAddress(DLLHandle, "AU3_ClipPut") 'ClipPut(const char *szClip);
Global AutoIT_WinWaitActive(szTitle$z, szText$z,  nTimeOut:Long)"win32"=GetProcAddress(DLLHandle, "AU3_WinWaitActive") 
Global AutoIT_AutoItSetOption(szOption$z, nValue:Long)"win32"=GetProcAddress(DLLHandle, "AU3_AutoItSetOption") 
Global AutoITX_Send(f$z, nmode:Long)"win32"=GetProcAddress(DLLHandle,"AU3_Send")
Function AUTOIT_Send(f:String, nmode:Long=0)
   Return AUTOITX_Send(f,nmode)
End Function



Local r=AutoIT_Init()

Delay 1000
WinExec("Notepad.exe",1) 'runs notepad
AUTOIT_WinWaitActive("Untitled","",1000) 'Wait for Notepad window for 1000ms
AUTOIT_AutoItSetOption("SendKeyDelay", 20)

Local go
For go=1 To 5
	Print "go="+go
	AUTOIT_Send("asdf")
Next
Print "for loop exited"
Print "go="+go

End