Sign in to follow this  
Followers 0
teunteunteun

FileCreateShortcut doesnt create shortcut

8 posts in this topic

Hi,

I'm trying to create a shortcut on my desktop automaticly via AutoIt.

This is my code:

FileCreateShortcut ( "C:\Documents and Settings\All Users\Bureaublad\Muppet_Babies_GUI.exe", "C:\Program Files\Muppet_Babies\MuppetBabiesGUI.lnk", "" , "" , "" , "C:\Program Files\Muppet_Babies\BABYKER.ico" , "", "")

The problem is that this command doesnt make the shortcut, is there any other way to create it?

Yours,

Teun

Share this post


Link to post
Share on other sites



teunteunteun,

On my Vista machine, my Desktop shortcuts are stored as "C:\Users\my_user_name\Desktop\file_name.lnk", not in "C:\Program Files". And is the program file really in "C:\Documents and Settings\All Users". :)

Perhaps you have the wrong paths set? ;)

Even if the paths are correct, you may well have problems writing anything to "C:\Program Files", as Vista and Win7 protect that area under UAC. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

teunteunteun,

On my Vista machine, my Desktop shortcuts are stored as "C:\Users\my_user_name\Desktop\file_name.lnk", not in "C:\Program Files". And is the program file really in "C:\Documents and Settings\All Users". ;)

Perhaps you have the wrong paths set? ;)

Even if the paths are correct, you may well have problems writing anything to "C:\Program Files", as Vista and Win7 protect that area under UAC. :shocked:

M23

XP is diffrent from Vista I guess.

The paths are right i'm sure, maybe there's just a little error in my codeline, i dont know :S.

I just dont seem to get it working. :)

anybody els any idea on what I should do?

Share this post


Link to post
Share on other sites

Give this a try:

$target = "C:\Documents and Settings\All Users\Bureaublad\Muppet_Babies_GUI.exe"
FileCreateShortcut($target, @DesktopCommonDir & "\MuppetBabiesGUI.lnk", StringLeft($target,StringInStr($target,"\",0,-1)) , "" , "Muppet Babies" , "C:\Program Files\Muppet_Babies\BABYKER.ico")

Share this post


Link to post
Share on other sites

Give this a try:

$target = "C:\Documents and Settings\All Users\Bureaublad\Muppet_Babies_GUI.exe"
FileCreateShortcut($target, @DesktopCommonDir & "\MuppetBabiesGUI.lnk", StringLeft($target,StringInStr($target,"\",0,-1)) , "" , "Muppet Babies" , "C:\Program Files\Muppet_Babies\BABYKER.ico")

awesome, ;) thanks so much

love u people @ autoit forum =) allways know the answer

Share this post


Link to post
Share on other sites

Give this a try:

$target = "C:\Documents and Settings\All Users\Bureaublad\Muppet_Babies_GUI.exe"
FileCreateShortcut($target, @DesktopCommonDir & "\MuppetBabiesGUI.lnk", StringLeft($target,StringInStr($target,"\",0,-1)) , "" , "Muppet Babies" , "C:\Program Files\Muppet_Babies\BABYKER.ico")

thanks, your solution also worked for me. never had problems with creating lnk-files, just under vista-64. now all is fine.

Share this post


Link to post
Share on other sites

I've got a similar problem that maybe someone can help.

I place a comma in front of my custom startmenu folders so they will always be at the top of the startmenu like this: "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\,Browsers". But autoit doesn't play nice with folders that begin with a comma. I know I could start each folder with an "a" or "x" and achieve the same directory-organizing effect but a comma at the beginning is far less noticeable on the menu. Is there anyway around this since autoit uses commas to separate command statements? 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

This one works fine for me, although I personally prefer an exclamation mark an and underscore ("!_ImFirst")as the first character to shift folders to the top in a sorting.

; see also
; https://www.howtogeek.com/howto/6463/stupid-geek-tricks-how-to-open-the-start-menu-folder-in-windows-7/
FileCreateShortcut(@AutoItExe, @StartMenuDir & "\'_AutoIt_Test.lnk", "", "", "Link to '_AutoIt", RegRead('HKCR\AutoIt3Script\DefaultIcon', ''))

 

Edited by KaFu

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0