Hello Guest it is October 26, 2021, 06:11:54 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TPS

2201
VB and the development of wizards / SetToolDesc problem
« on: July 26, 2012, 04:00:25 AM »
hi all,

tryed the example from

Mach3 Version 3.x
Macro Programmers Reference Manual

to set tool description.

Sub Main

   Dim TNum As Integer
   Dim TDesc As String

   TNum  = 1 ' want to set description for tool # 1
   TDesc = "1/4 135 degree split point drill"

   If SetToolDescription(TNum, TDesc) Then
      Message "Tool description was set"
   Else
      Message "Error setting Tool description"
   End If

End Sub

geting errormessage in VB Scripter : Sub or function not defined:SetToolDescription

any ideas how to fix ?

Thanks Thomas


2202
hello,

i have written a small macro to write values into a file.

macro:
Code: [Select]
'Funktion zum schreiben in INI Datei
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal LpString As Any, ByVal lpFileName As String) As Long

Sub Main()
' -------------------------------------------------------------------------------
' TPS 25.07.2012 
' Der im P-Parameter übergebene Wert wird für Werkzeug im Q Parameter im Configfile abgelegt
' -------------------------------------------------------------------------------
'beim Laden des Files Abbrechen
If IsLoading() Then
    GoTo Ende
End If

'Übergebene Parameter holen------------------------------------------------------
ZWert    = Param1()
Werkzeug = Param2()
'--------------------------------------------------------------------------------

Dim File    As String
Dim Sektion As String
Dim Eintrag As String
Dim Wert    As String
Dim n       As Long

'Parameter festlegen ------------------------------------------------------------
File    = "C:\Platemaster\Config.txt"
Sektion = "Werkzeuglaengen"
Eintrag = CStr(Werkzeug)
Wert    = CStr(ZWert)
'--------------------------------------------------------------------------------

'Wert schreiben
n = WritePrivateProfileString(Sektion, Eintrag, Wert, File)

'MsgBox (CStr(n))

Ende:
End Sub


tryed for a couple of hours to get it work.
only the file is created but nothing is written.using the same function in VB6 and ist working fine.
probably somebody has an idea, because i  am out of ideas now.

thanks Thomas