ragemxf Posted November 22, 2005 Posted November 22, 2005 I have to deploy a lot of pc's and on every one of them I have to login as user and change a shortcut so the parameter to the program reflects the user logged on... "c:\windows\notepad.exe" Neal Smith I have the logged on user in $var on clipPut so if I wrote a script to open the properties for this shortcut I can tell it to paste from clipboard. What I am really trying to do is create a brand new shortcut that will put my variable in a as parameter? Can this be done?
Developers Jos Posted November 22, 2005 Developers Posted November 22, 2005 I have to deploy a lot of pc's and on every one of them I have to login as user and change a shortcut so the parameter to the program reflects the user logged on..."c:\windows\notepad.exe" Neal Smith I have the logged on user in $var on clipPutso if I wrote a script to open the properties for this shortcut I can tell it to paste from clipboard. What I am really trying to do is create a brand new shortcut that will put my variable in a as parameter?Can this be done? Look at FileGetShortcut and FileCreateShortcut SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ragemxf Posted November 22, 2005 Author Posted November 22, 2005 I have to deploy a lot of pc's and on every one of them I have to login as user and change a shortcut so the parameter to the program reflects the user logged on..."c:\windows\notepad.exe" Neal Smith I have the logged on user in $var on clipPutso if I wrote a script to open the properties for this shortcut I can tell it to paste from clipboard. What I am really trying to do is create a brand new shortcut that will put my variable in a as parameter?Can this be done?Why are you posting what I already posted?
Developers Jos Posted November 22, 2005 Developers Posted November 22, 2005 (edited) Why are you posting what I already posted? don't understand .... Edited November 22, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ragemxf Posted November 22, 2005 Author Posted November 22, 2005 summary.... I want to create a shortcut using autoit... without using windows gui
Moderators SmOke_N Posted November 22, 2005 Moderators Posted November 22, 2005 Um... He was simply replying to your question if you look at the Quote, and when you click reply it automatically quotes what your replying to.He gave you the items to look at too.Look at FileGetShortcut and FileCreateShortcut 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.
herewasplato Posted November 22, 2005 Posted November 22, 2005 JdeB simply quoted your post... (there are many reason to quote like that, but that is not the topic of this thread - you can bring that up in a new post in the Chat area if you are curious as to why people post the way that they do.) JdeB also gave you the answer to your question. There was no GUI in his answer. You want the shortcut's target line to "reflect the user logged on". You can do this best with the answer that JdeB gave. What part of that answer do you not understand? Do you need help understanding FileCreateShortcut? [size="1"][font="Arial"].[u].[/u][/font][/size]
ragemxf Posted November 22, 2005 Author Posted November 22, 2005 I am sorry... you are all right... I did not see the items he left at the bottom of the post... I have looked at the FileCreateShortcut and this will work perfect...... Thank You everyone
herewasplato Posted November 22, 2005 Posted November 22, 2005 ...I did not see the items he left at the bottom of the post...Understood. Just one of the drawbacks to a full quote. This code uses " Neal Smith" as text. Let's hope that you can replace that with @UserName FileCreateShortcut(@WindowsDir & "\notepad.exe", _ @DesktopDir & "\Shortcut Test.lnk", _ @WindowsDir, " Neal Smith", "", _ @SystemDir & "", "", "", @SW_ [size="1"][font="Arial"].[u].[/u][/font][/size]
ragemxf Posted November 22, 2005 Author Posted November 22, 2005 everything works but the working dir..... it puts my working directory in the "Batch file" section, winxp sp2. my working dir is q: filecreateshortcut("c:\aimstempct\usrip400.exe","C:\data\","q:",@username) only when I check the shortcut after autoit creates... the q: goesinto "batch file" and "working dir" is empty what now?
herewasplato Posted November 23, 2005 Posted November 23, 2005 (edited) Where is your "lnk" parm? Full path and file name of the shortcut.$file = "c:\aimstempct\usrip400.exe" $lnk = "C:\temp\test.lnk" $workdir = "C:\data\" $args = "q:\" & @username FileCreateShortcut ($file, $lnk, $workdir, $args)Edit: I just guessed at what goes where - edit the variables to suite your needs. Edited November 23, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
ragemxf Posted November 23, 2005 Author Posted November 23, 2005 here is my latest script filecreateshortcut("c:\aimstempct\usrip400.exe","C:\program files\commodity folder\C&T\Aims Application.pif","q:",@username,"Aims Application","C:\AIMSTEMPCT\SPCESHP.ICO") q: should be working directory......but it does not go into working dir like it should
herewasplato Posted November 23, 2005 Posted November 23, 2005 (edited) '"C:\program files\commodity folder\C&T\Aims Application.pif"'Add single quotes around this parm.Just a guess...I like my format ;-) Edited November 23, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted November 23, 2005 Posted November 23, 2005 (edited) Okay, so this code does NOT work for me. Anyone else want to jump in and offer a suggestion?$file = "c:\aimstempct\usrip400.exe" $lnk = '"C:\program files\commodity folder\C&T\Aims Application.pif"' $workdir = "q:" $args = @username $desc = "Aims Application" $icon = "C:\AIMSTEMPCT\SPCESHP.ICO" FileCreateShortcut ($file, $lnk, $workdir, $args, $desc, $icon)Edit: ...and yes, I made this folder C:\Program Files\commodity folder\C$T Edited November 23, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted November 23, 2005 Posted November 23, 2005 Okay, so I led myself astray. This code does work for me... not sure why: $file = "c:\aimstempct\usrip400.exe" $lnk = "C:\Program Files\commodity folder\C$T\Aims Application.pif" $workdir = "q:" $args = @username $desc = "Aims Application" $icon = "C:\AIMSTEMPCT\SPCESHP.ICO" FileCreateShortcut ($file, $lnk, $workdir, $args, $desc, $icon) [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted November 23, 2005 Posted November 23, 2005 q: should be working directory......but it does not go into working dir like it shouldUsing your latest one line version - it works for me.q: is where it should be - "Start in:"What operating system are you using when you run this line of code? [size="1"][font="Arial"].[u].[/u][/font][/size]
ragemxf Posted November 23, 2005 Author Posted November 23, 2005 what is the difference between the two?
ragemxf Posted November 23, 2005 Author Posted November 23, 2005 figured it out.... I had to map my q: drive before I created the shortcut... thats why.. Thanks everyone
herewasplato Posted November 24, 2005 Posted November 24, 2005 what is the difference between the two?Glad you got it to work for you. (There is no difference between the way that you wrote it and the way I broke it out. I just found it easier to see what was what in the format that I used. Then it dawned on me that I had not tested your last script "as is" in your format. I tested it and thought it was worth the post to confirm no errors with your code on my system. But we must be using different operating systems, since it worked for me without having a drive mapped.) [size="1"][font="Arial"].[u].[/u][/font][/size]
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