Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 08:52:11 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  File open dialog
Pages: 1   Go Down
Print
Author Topic: File open dialog  (Read 344 times)
0 Members and 1 Guest are viewing this topic.
rrc1962
Active Member

Offline Offline

Posts: 434


View Profile
« on: October 23, 2011, 11:26:56 PM »

Is there a way to open a file open dialog in a VB script.  I'm not trying to load G-Code, so button 216 won't work.  Just need to select a file, open it and do some things with it in VB.  Typing the full path in a DRO is a drag.

Thanks
Logged
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #1 on: October 24, 2011, 09:23:53 AM »

What type file are you talking about ? Gcode , txt file, data file?Huh??

From CB you can open a file directly and read and write to it. OR you can open a Gcode file with notepad and edit it.

(;-) TP

Logged
rrc1962
Active Member

Offline Offline

Posts: 434


View Profile
« Reply #2 on: October 24, 2011, 09:59:21 AM »

I need to open a text file and parse it.  I can open the file and manipulate it fine, but in order to open it I have to type the file name in a DRO.  I want to display a file open dialog instead.
Logged
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #3 on: October 24, 2011, 10:22:39 AM »

I use something like this to open files by file name.

Fname = InputBox("What is the New File Name","Grank Grind FILENAME", DFN)

It gives you a popup box to answer the question


THe use the variable "Fname" to open a new file
Logged
stirling
Global Moderator
*
Offline Offline

Posts: 1,190

UK


View Profile WWW
« Reply #4 on: October 24, 2011, 11:04:07 AM »

Code:
Set objDialog = CreateObject("UserAccounts.CommonDialog")

objDialog.Filter = "Text Documents|*.txt|All Files|*.*"
objDialog.FilterIndex = 1 '*.txt is default
objDialog.InitialDir = "."
intResult = objDialog.ShowOpen
 
If intResult = 0 Then
    'user hit cancel
Else
    'filename is in objDialog.FileName
End If

Season to taste but beware - there be dragons - it'll work in XP but not much else.

Cheers

Ian
Logged
rrc1962
Active Member

Offline Offline

Posts: 434


View Profile
« Reply #5 on: October 24, 2011, 11:42:32 AM »



Season to taste but beware - there be dragons - it'll work in XP but not much else.



Cool.  Thanks very much.  I had seen this done in VB script but didn't see it anywhere in the Cypress Enable docs.  Didn't think it would work in CE. 
Logged
rrc1962
Active Member

Offline Offline

Posts: 434


View Profile
« Reply #6 on: October 24, 2011, 11:43:59 AM »

I use something like this to open files by file name.

Fname = InputBox("What is the New File Name","Grank Grind FILENAME", DFN)

It gives you a popup box to answer the question


THe use the variable "Fname" to open a new file

That's sort of the way I was doing it, except I just used a DRO.  Typing the file name just started getting old.
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!