redcrusher Posted January 14, 2006 Share Posted January 14, 2006 Why does this not work... it says it expects an "=" VB6 Dim au3 As AUTOITX3 au3.IniWrite(app.Path & "\fishing.ini", "Vars2", "Cursor", "1") --redcrusher Link to comment Share on other sites More sharing options...
Stumpii Posted January 14, 2006 Share Posted January 14, 2006 (edited) Try: Dim au3 As AUTOITX3 Dim iResult as integer iResult = au3.IniWrite(app.Path & "\fishing.ini", "Vars2", "Cursor", "1") or, thinking about it more: Dim au3 As AUTOITX3 au3.IniWrite app.Path & "\fishing.ini", "Vars2", "Cursor", "1" Brackets imply a function, rather than sub. Edited January 14, 2006 by Stumpii Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
redcrusher Posted January 14, 2006 Author Share Posted January 14, 2006 (edited) Try: Dim au3 As AUTOITX3 Dim iResult as integer iResult = au3.IniWrite(app.Path & "\fishing.ini", "Vars2", "Cursor", "1") or, thinking about it more: Dim au3 As AUTOITX3 au3.IniWrite app.Path & "\fishing.ini", "Vars2", "Cursor", "1" Brackets imply a function, rather than sub. it is not writing... for some reason... i get no error, but it is not writing anthing... have any ideas? --redcrusher Edited January 14, 2006 by redcrusher Link to comment Share on other sites More sharing options...
redcrusher Posted January 14, 2006 Author Share Posted January 14, 2006 i keep getting the integer back as "0"... what is wrong? --redcrusher Link to comment Share on other sites More sharing options...
PeterSwiss Posted January 15, 2006 Share Posted January 15, 2006 (edited) (a) Failure: Returns 0 if file is read-only. So it is a function. (be) what is the filename? i.e. what is app.Path, is it valid, and I would TRY, at this time, to write to "c:\myfile.ini" Edited January 15, 2006 by PeterSwiss Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 Note the following that may be of use: App.Path returns a string with the "\" character at the end if the path is the root drive (e.g., "C:\") but without that character if it isn't (e.g., "C:\Program Files"). So your code will not work if you are testing it with a file in the root. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
redcrusher Posted January 15, 2006 Author Share Posted January 15, 2006 (edited) i tryed "C:\testing.ini" , but it still dodn't work... any other ideas? maybe you could make a VB6 program that would iniwrite and then post the form code. --redcrusher Edited January 15, 2006 by redcrusher Link to comment Share on other sites More sharing options...
PeterSwiss Posted January 15, 2006 Share Posted January 15, 2006 Dim au3 As AUTOITX3(a) I don't understand above Dim statement(be) I tried the following, in Javascript, in a file named "xyz".js with positive result:var ws = WScript; //WSH Grundobjektvar autoit = WScript.CreateObject("AutoItX3.Control"); //AutoIt V3 Objektv = new Date();ws.echo(v);var err;err=autoit.IniWrite ("c:\inifile.ini","mysection","myvalue","20");err=autoit.IniWrite ("c:\inifile.ini","mysection","myvalue1",30);err=autoit.IniWrite ("c:\inifile.ini","Vars2", "Cursor", "1");ws.echo("err="+err);ws.Quit();. Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 zip and post your entire VB program so we can look at it. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
redcrusher Posted January 15, 2006 Author Share Posted January 15, 2006 Here is the code expandcollapse popupOption Explicit Dim au3 As AutoItX3 Dim iResult As Integer Private Type POINTAPI x As Long y As Long End Type Private Type PCURSORINFO cbSize As Long flags As Long hCursor As Long ptScreenPos As POINTAPI End Type 'To grab cursor shape -require at least win98 as per Microsoft documentation... Private Declare Function GetCursorInfo Lib "user32.dll" (ByRef pci As PCURSORINFO) As Long 'To get a Handle to the cursor Private Declare Function GetCursor Lib "USER32" () As Long 'To draw cursor shape on bitmap Private Declare Function DrawIcon Lib "USER32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long 'to get the cursor position Private Declare Function GetCursorPos Lib "USER32" (lpPoint As POINTAPI) As Long 'to end a waiting loopp Dim GotIt As Boolean 'To use the scrollbars Dim lngVer As Long Dim lngHor As Long Const iconSize As Integer = 9 Dim TxtPathName As String Dim TxtPathName2 As String Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long 'use GetPixel API 'used to indicate pixel location Dim Pix1 As Long Dim Pix2 As Long Private Sub Form_Load() Set PicFish.Picture = LoadPicture(App.Path & "\fish.bmp") End Sub Private Sub TCapture_Timer() 'disable timer TCapture.Enabled = False Set PicCapture.Picture = PicBlank.Image 'now to get the icon of mouse and paint on form the mouse Dim pcin As PCURSORINFO pcin.hCursor = GetCursor pcin.cbSize = Len(pcin) Dim ret ret = GetCursorInfo(pcin) DrawIcon PicCapture.hdc, 12 - iconSize, 12 - iconSize, pcin.hCursor 'The following paint only mouse shape for this app 'DrawIcon PicCapture.hdc, Point.x - iconSize, Point.y - iconSize, CopyIcon(GetCursor) 'assign to picture the image Set PicCapture.Picture = PicCapture.Image 'clear clipboard here if you can On Error Resume Next Clipboard.Clear 'signal you've done to exit the waiting loop GotIt = True Pix1 = GetPixel(PicCapture.hdc, 5, 5) 'get pixel at (5 x 5 y) Pix2 = GetPixel(PicFish.hdc, 5, 5) 'get pixel at (5 x 5 y) If Pix1 = Pix2 Then lblYAY = lblYAY.Caption + 1 Dim mousex As Double Dim mousey As Double mousex = au3.MouseGetPosX mousey = au3.MouseGetPosY iResult = au3.IniWrite("C:\test.ini", "Vars2", "Cursor", "1") Me.Caption = iResult End If lblTimes = lblTimes.Caption + 1 TCapture.Enabled = True 'TxtPathName = "./" & lblTimes.Caption & "aaScreen.bmp" 'SavePicture PicCapture.Image, TxtPathName End Sub --redcrusher Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 Can you post the actual project. That way we can see if you have valid references to the AutoItX dll. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 Don't worry, try this: Dim au3 As New AutoItX3 instead of Dim au3 As AutoItX3 I get an error 91 with your code. I don't know why you do not get it. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
redcrusher Posted January 15, 2006 Author Share Posted January 15, 2006 Don't worry, try this: Dim au3 As New AutoItX3 instead of Dim au3 As AutoItX3 I get an error 91 with your code. I don't know why you do not get it. yay it works great now !!! THANKS A LOT GUYS ! --redcrusher Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 No problem. You need to investigate how you have VB setup. You should have got the error that I did, which imediatly indicated what the problem was. Under Tools>Options, you may have 'Break on unhandled errors' selected, which along with the 'On error resume' code you have, could cause this. Not a very good thing to do, as this hidden error shows. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
PeterSwiss Posted January 15, 2006 Share Posted January 15, 2006 Dim au3 As New AutoItX3What else was needed to make "new AutoITX3" legal? instead of "AutoItX3.Control" as in VBS, JS? Question is simply from a non VB knower.Thanks,Peter Link to comment Share on other sites More sharing options...
Stumpii Posted January 15, 2006 Share Posted January 15, 2006 What else was needed to make "new AutoITX3" legal? instead of "AutoItX3.Control" as in VBS, JS? Question is simply from a non VB knower.Thanks,PeterVB allows you to create a reference to a control at design time, through the IDE as well as at runtime. The advantage of this is that the IDE can then expose all the methods, propertites and events for you to program with. In this way VB already knows what AutoITX3 is and where the dll is located. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
PeterSwiss Posted January 15, 2006 Share Posted January 15, 2006 VB allows you to create a reference to a control at design time, through the IDE as well as at runtime. The advantage of this is that the IDE can then expose all the methods, propertites and events for you to program with. In this way VB already knows what AutoITX3 is and where the dll is located.Thanks!!Peter Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now