Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Bodini on August 27, 2008, 09:57:47 AM

Title: openteachfile name
Post by: Bodini on August 27, 2008, 09:57:47 AM
Is it possible to have Mach prompt the user for the file name to save 'openteachfile' as?  I know, i know... it can be set to 'temp' or whatever you want, and the user can rename it after the file is created, but I forget to do that quite often.  Anyway, thats a crappy workaround and I'd like to nip it in the bud and name it from the start.

-Nick
Title: Re: openteachfile name
Post by: Bodini on August 29, 2008, 12:56:46 PM
Code: [Select]
ppp = InputBox("Enter a File Name:")
OpenTeachFile ppp + ".tap"
code " (Code Here) "
CloseTeachFile
Call LoadStandardLayout()
Call LoadTeachFile()
Title: Re: openteachfile name
Post by: zealous on September 05, 2008, 07:36:54 PM
Hey Nick,

I stubbled across this  :) I dont get much time to come to the forum lately...working on the Mach screen development stuff...

This is what I would do:

Code: [Select]
Dim fso, fldr, s
Set fso = CreateObject("Scripting.FileSystemObject")

'Prompt For Teach file new Name And location
ppp = InputBox("Enter a File Name:")

'Default to C:\ if you just want the name you can allow them to make the file type too
filePath="C:\" + ppp + ".tap"

'Verify
MsgBox ("Copy File: "+ "C:\Mach3\Teach.tap" + " TO: "+ filePath + " ? ")

'Close the FIle if loaded in Mach
DOOEMButton (169)

'If you need to make the user aware there is already a file with that name
If fso.FileExists (filePath) = true Then

'Promt User

End If

'Copy it
fso.CopyFile "C:\Mach3\Teach.tap", filePath


'Open the file
loadfile filePath

'Remove System object Clean up
Set fso = Nothing


Thanks,
Jason Blake
Title: Re: openteachfile name
Post by: Bodini on September 07, 2008, 10:08:39 AM
 :DThanks much, Jason.   I'll try it.
Title: Re: openteachfile name
Post by: zealous on September 11, 2008, 07:13:45 PM
Great  ;D