Tukata Posted October 29, 2006 Share Posted October 29, 2006 (edited) Hi, I created a shortcut to autoit app in: C:\Documents and Settings\All Users\Start Menu\Programs\Startup The app is a simple Listbox which upload items from a text file located in the same folder. When I run the shortcut I get a message that "Unable to open the txt file" and app exits. The app itself run with no problem when run the exe. Any idea ? Thank you Tuk Edited October 29, 2006 by Tukata Link to comment Share on other sites More sharing options...
The Kandie Man Posted October 29, 2006 Share Posted October 29, 2006 Please post your source code. I am having difficulty understanding what the program is doing. "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Tukata Posted October 29, 2006 Author Share Posted October 29, 2006 (edited) Here is my full script. It works fine if run but after creating the shortcut, if run from the shortcut, it can not find the "Data.txt" file (which is just a file with few lines). Thank you Tuk expandcollapse popup#include <GUIConstants.au3> #Include <GuiList.au3> #include <IE.au3> #NoTrayIcon Opt("TrayMenuMode", 1) $Shortcut=@StartupCommonDir & "\APP.lnk" If FileExists($Shortcut) Then Else FileCreateShortcut(@ScriptDir & "\APP.exe",@StartupCommonDir & "\APP.lnk") EndIf GUICreate("APP", 300, 110) $_List =GUICtrlCreateList ("", 0,0,300,94,$WS_BORDER + $WS_VSCROLL) $Button = GUICtrlCreateButton ( "Send to Tray", 5, 86, 120, 22) $ButtonURL = GUICtrlCreateButton ( "Web Site", 175, 86, 120, 22) $Show= TrayCreateItem("Show") TrayCreateItem("") $Hide= TrayCreateItem("Hide") TrayCreateItem("") $about = TrayCreateItem("About") TrayCreateItem("") $exit = TrayCreateItem("Exit") TrayCreateItem("") TraySetState() $file = FileOpen("Data.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open Data txt file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ;MsgBox(0, "Line read:", $line) GUICtrlSetData($_List,$line,"NO_DEFUALT") Wend FileClose($file) GUISetState () While 1 $xmsg = GUIGetMsg() if $xmsg = $_List then $h=GUICtrlRead($_List) ClipPut ($h) endif $msg = TrayGetMsg() Select Case $xmsg = $Button WinSetState("APP", "", @SW_HIDE) Case $xmsg = $ButtonURL $oIE = _IECreate ("http://www.xxx.com/") Case $xmsg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Hide WinSetState("APP", "", @SW_HIDE) Case $msg = $Show WinSetState("APP", "", @SW_SHOW) Case $msg = $about Msgbox(64,"APP","Text") Case $msg = $exit ExitLoop EndSelect WEnd Exit Edited October 29, 2006 by Tukata Link to comment Share on other sites More sharing options...
McGod Posted October 29, 2006 Share Posted October 29, 2006 expandcollapse popup#include <GUIConstants.au3> #Include <GuiList.au3> #include <IE.au3> #NoTrayIcon Opt("TrayMenuMode", 1) $Shortcut=@StartupCommonDir & "\APP.lnk" If FileExists($Shortcut) Then Else FileCreateShortcut(@ScriptDir & "\APP.exe",@StartupCommonDir & "\APP.lnk") EndIf GUICreate("APP", 300, 110) $_List =GUICtrlCreateList ("", 0,0,300,94,$WS_BORDER + $WS_VSCROLL) $Button = GUICtrlCreateButton ( "Send to Tray", 5, 86, 120, 22) $ButtonURL = GUICtrlCreateButton ( "Web Site", 175, 86, 120, 22) $Show= TrayCreateItem("Show") TrayCreateItem("") $Hide= TrayCreateItem("Hide") TrayCreateItem("") $about = TrayCreateItem("About") TrayCreateItem("") $exit = TrayCreateItem("Exit") TrayCreateItem("") TraySetState() $file = FileOpen( @ScriptDir & "Data.txt", 0); Try that If $file = -1 Then MsgBox(0, "Error", "Unable to open Data txt file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ;MsgBox(0, "Line read:", $line) GUICtrlSetData($_List,$line,"NO_DEFUALT") Wend FileClose($file) GUISetState () While 1 $xmsg = GUIGetMsg() if $xmsg = $_List then $h=GUICtrlRead($_List) ClipPut ($h) endif $msg = TrayGetMsg() Select Case $xmsg = $Button WinSetState("APP", "", @SW_HIDE) Case $xmsg = $ButtonURL $oIE = _IECreate ("http://www.xxx.com/") Case $xmsg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Hide WinSetState("APP", "", @SW_HIDE) Case $msg = $Show WinSetState("APP", "", @SW_SHOW) Case $msg = $about Msgbox(64,"APP","Text") Case $msg = $exit ExitLoop EndSelect WEnd Exithttp://www.xxx.com/ - Makes me wonder [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Tukata Posted October 29, 2006 Author Share Posted October 29, 2006 (edited) Chip Thank you. Almost but I made it run. It should be: $file = FileOpen(@ScriptDir & "\Data.txt", 0) As for xxx.com.. well.... sorry for that, just wrote xxx without knowing there is a real web site behind it. Tuk Edited October 29, 2006 by Tukata Link to comment Share on other sites More sharing options...
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