asgarcymed 0 Posted October 9, 2007 Using: $lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & $lnk_details[0]) The Message Box will display "C:\Program Files\Internet Explorer\IEXPLORER.EXE" Next, I would like to put in clipboard the target path without exe.exe (in these example would be "C:\Program Files\Internet Explorer"). How to do this? Thanks in advance. Best regards. MLMK - my blogging craziness... Share this post Link to post Share on other sites
SmOke_N 211 Posted October 9, 2007 Look at _PathSplit() in the help file. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Share this post Link to post Share on other sites
asgarcymed 0 Posted October 9, 2007 Thank you for your tip! Here it is a good script: #include <file.au3> #include <array.au3> $title = "Choose .lnk file" $lnk_file = FileOpenDialog($title, @DesktopDir & "\", "Shortcuts (*.lnk)") If @error Then MsgBox(0,"","No file was chosen") EndIf $lnk_file_details = FileGetShortcut ($lnk_file) MsgBox(0, "", "Target Path: " & Chr(13) & $lnk_file_details[0]) MsgBox(0, "", "Description: " & Chr(13) & $lnk_file_details[3]) Dim $szDrive, $szDir, $szFName, $szExt $target_path_array_dir = _PathSplit ($lnk_file_details[0], $szDrive, $szDir, $szFName, $szExt) $target_path_array_dir_ok = StringTrimRight (_ArrayToString ($target_path_array_dir, "", 1, 2), 1) ClipPut($target_path_array_dir_ok) MLMK - my blogging craziness... Share this post Link to post Share on other sites
smashly 12 Posted October 9, 2007 Hi, another way ...$lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringLeft($lnk_details[0], StringInStr($lnk_details[0], "\", 0, -1) - 1)) Cheers Share this post Link to post Share on other sites
enaiman 16 Posted October 9, 2007 or $lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringTrimRight($lnk_details,4)) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example scriptwannabe "Unbeatable" Tic-Tac-ToePaper-Scissor-Rock ... try to beat it anyway :) Share this post Link to post Share on other sites
smashly 12 Posted October 9, 2007 or $lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringTrimRight($lnk_details,4)) That doesn't work for me Share this post Link to post Share on other sites
BrettF 28 Posted October 9, 2007 He should have called it as an array... $lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringTrimRight($lnk_details[0],4)) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites
smashly 12 Posted October 9, 2007 (edited) He should have called it as an array... $lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringTrimRight($lnk_details[0],4))Nope that doesn't trim the file name to leave just the path.. it only trims the file ext from the path so$lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringLeft($lnk_details[0], StringInStr($lnk_details[0], "\", 0, -1) - 1))seems more appropriate unless your using _PathSplit() which works great Edited October 9, 2007 by smashly Share this post Link to post Share on other sites
BrettF 28 Posted October 9, 2007 Nope that doesn't trim the file name to leave just the path.. it only trims the file ext from the path so$lnk_details = FileGetShortcut(@DesktopDir & "\Internet Explorer.lnk" ) MsgBox(0, "", "Target Path: " & StringLeft($lnk_details[0], StringInStr($lnk_details[0], "\", 0, -1) - 1))seems more appropriate unless your using _PathSplit() which works great I didn't read the OP's question, I just fixed enaimans' code. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Share this post Link to post Share on other sites
enaiman 16 Posted October 10, 2007 (edited) That doesn't work for meIt doesn't work for me either because when I open my Desktop folder I don't see a shortcut for IE (and IT IS there) - I only tried to offer an alternative to OP.Nope that doesn't trim the file name to leave just the path.. it only trims the file ext from the pathOP said: Next, I would like to put in clipboard the target path without exe.exe (in these example would be "C:\Program Files\Internet Explorer")@Bert Thanks I haven't looked at FileGetShortcut description (assumed the OP got it right) Edited October 10, 2007 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example scriptwannabe "Unbeatable" Tic-Tac-ToePaper-Scissor-Rock ... try to beat it anyway :) Share this post Link to post Share on other sites
asgarcymed 0 Posted October 10, 2007 ClipPut(StringLeft($lnk_details[0], StringInStr($lnk_details[0], "\", 0, -1) - 1))oÝ÷ Øb±¨(¡Ö¥µêçjدzÚºÚ"µÍ[H ÌÍÜÞ]K ÌÍÜÞ ÌÍÜÞ[YK ÌÍÜÞ^ÌÍÝÙ]Ü]Ø^WÙHÔ]Ü] ÌÍÛ×Ù[WÙ]Z[ÖÌK ÌÍÜÞ]K ÌÍÜÞ ÌÍÜÞ[YK ÌÍÜÞ^ BÌÍÝÙ]Ü]Ø^WÙÛÚÈHÝ[Õ[TYÚ Ð^UÔÝ[È ÌÍÝÙ]Ü]Ø^WÙ ][ÝÉ][ÝËKKJBÛ] ÌÍÝÙ]Ü]Ø^WÙÛÚÊ More easy, less code, less includes... Thank you! MLMK - my blogging craziness... Share this post Link to post Share on other sites