Page 1 of 1 1
Topic Options
#153991 - 2005-12-23 12:44 PM Open Doc
Rooster10 Offline
Fresh Scripter

Registered: 2004-10-14
Posts: 14
Hi,

I have a Kixform running which maps a network drive and I want it to open up a word document, the form works, the drive maps, however the doc won't open, I think there is something not right with the run "g:\test.doc", can anyone help?

Cheers

Break On
$System = CreateObject("Kixtart.System")
;create form
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.FontSize = 8,25
$Form.Height = 187
$Form.Left = 200
$Form.Text = "Documentation Tool"
$Form.Top = 110
$Form.Width = 275

;create pulldown menu
$ComboBox = $Form.Controls.ComboBox()
$ComboBox.DropDownWidth = 121
$ComboBox.FontSize = 8,25
$ComboBox.Height = 21
$ComboBox.Left = 50
$ComboBox.Sorted = "False"
$ComboBox.Text = "Select Document"
$ComboBox.Top = 60
$ComboBox.Width = 148
$ComboBox.AddItem ("EPC - With Kerridge DMS")

;create button
$Button = $Form.Controls.Button()
$Button.FontSize = 8,25
$Button.Height = 30
$Button.Left = 50
$Button.Text = "Map Document Drive G:"
$Button.Top = 20
$Button.Width = 110
$Button.OnClick = "Button_Map()"

;create button
$Button = $Form.Controls.Button()
$Button.FontSize = 8,25
$Button.Height = 28
$Button.Left = 50
$Button.Text = "Open Document"
$Button.Top = 100
$Button.Width = 110
$Button.OnClick = "Button_Open()"


$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1

Function Button_Click()
$app = $comboBox.text
Select
Case $app = "Select Document"
$rc = MessageBox("No Doc Selected.","Error",16,0)
EndSelect
Endfunction

Function Button_Open()
$app = $comboBox.text
Select

Case $app = "EPC - With Kerridge DMS"
Run "g:\test.doc"

EndSelect
Endfunction



$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1
;
Function Button_Map()
Use g: '\\szgb06\company\Dealers\Documents'
EndFunction

Top
#153992 - 2005-12-23 01:15 PM Re: Open Doc
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes, doc is not registered extension, thus it can't be ran.
hmm...
try:
run 'explorer "g:\test.doc"'
_________________________
!

download KiXnet

Top
#153993 - 2005-12-23 01:16 PM Re: Open Doc
Rooster10 Offline
Fresh Scripter

Registered: 2004-10-14
Posts: 14
Excellent help, many thanks, it works !
Top
#153994 - 2005-12-23 01:39 PM Re: Open Doc
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
More safe solution just in case .doc is not associated to winword.exe and more then one word version is used.

Code:

$File = "G:\test.doc"
$App = "WinWord.exe"
$WordPath = ReadValue ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe", "Path")
Run $WordPath + "\" + $App + " " + $File

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#153995 - 2005-12-23 02:42 PM Re: Open Doc
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
actually, does not make that much safer.
word checks the versioning and file assocs every time it runs, no?

but yes, this is nicer way of doing it.
_________________________
!

download KiXnet

Top
#153996 - 2005-12-23 02:51 PM Re: Open Doc
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
You're right the version of word has nothing to do with it in this case.
I’ve been working on a script to determine the installed office version. Stuff was still spinning around in my head I guess.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#153997 - 2005-12-23 02:57 PM Re: Open Doc
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
stuff don't spin in my head that much but in my stomach instead :P
_________________________
!

download KiXnet

Top
#153998 - 2005-12-23 03:39 PM Re: Open Doc
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
LOL

Edited by Mart (2005-12-23 03:39 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.057 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org