MattX Posted June 25, 2009 Posted June 25, 2009 This script pulls a PC name from an INI file - works fine. Then I want it to open up a .TXT file which is in the directory using notepad. But for some reason I can't figure out how to get notepad to open up the file. I have tried all sorts of combinations on the RUN function but still no luck. All I can get is notepad to open up blank or not at all. Would appreciate some suggestions. expandcollapse popup; AutoIt Version: 3.2.0.1 ; Language: English ; Platform: WinVISTA ; Author: Matt ; Script Function: Opens up notepad with the relevant choice of PC LOG file ; Version: 1.0 ; Date: June 2009 #include <GuiConstants.au3> GUICreate("Select PC", 170, 66) $combo = GUICtrlCreateCombo("", 16, 8, 125, 12) GUICtrlSetData($combo, "") $selectbutton = GUICtrlCreateButton("Select", 100, 40, 60, 20) GUISetState() $pclist = IniReadSection(@ScriptDir & '\pcs.ini', 'PCS') If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $pclist[0][0] $tmp = $pclist[$i][1] & "|" GUICtrlSetData($combo, $tmp) Next EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $selectbutton $PC = GUICtrlRead($combo) Dim $NPC = $PC & '.TXT' ;MsgBox(0, "Check Select is:", $NPC) Run('Notepad.exe' & $NPC, '',@SW_MAXIMIZE) Exit EndSelect WEnd Exit
oMBRa Posted June 25, 2009 Posted June 25, 2009 (edited) you need to add a space after the program name: Run('Notepad.exe ' & $NPC, '',@SW_MAXIMIZE) ...and if the file path contains spaces it must be wrapped with " " Edited June 25, 2009 by oMBRa
MattX Posted June 25, 2009 Author Posted June 25, 2009 Thanks !! Works now - is it me or why is this not in the help file I'm looking at ??!!!
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