Aapjuh Posted July 31, 2012 Share Posted July 31, 2012 (edited) Hi all, FileCreateShortcut is acting weird on my Win7 x64 and only in a small part of the .ink The script: ;Get the right program files directory* If @ProcessorArch = "X86" Then Global $ProgramFileDir = "Program Files" Global $RightDir = @HomeDrive & "" & $ProgramFileDir ElseIf @ProcessorArch = "X64" Then Global $ProgramFileDir = "Program Files (x86)" Global $RightDir = @HomeDrive & "" & $ProgramFileDir Else _ErrorMsgBox() EndIf ;Create dirs and shortcuts DirCreate($RightDir & "TestDir") DirCreate($RightDir & "TestDirIcons") FileCopy(@WorkingDir & "FilesIconsIcon-Test.ico", $RightDir & "TestDirIcons", 1) FileCreateShortcut($RightDir & "TestDirTest.exe", @DesktopDir & "Test.lnk", $RightDir & "TestDir", "", "Test", $RightDir & "TestDirIconsIcon-Test.ico") $RightDir = C:/Program Files (x86) but the shortcut it makes has the following: Target: "C:/Program Files (x86)/TestDir/Test.exe" ;This is correct Start in: "C:/Program Files (x86)/TestDir" ;Also working when i click change Icon: Error Cant find "%Program Files%/TestDir/Icons/Icon-Test.ico" ;this is weird, since it should be Program Files (x86) as a result it is a shortcut without my icon Edited July 31, 2012 by Aapjuh Link to comment Share on other sites More sharing options...
bogQ Posted July 31, 2012 Share Posted July 31, 2012 (edited) as far as i knowX86 is $ProgramFileDir = "Program Files (x86)";32 bit OsX64 is $ProgramFileDir = "Program Files";64 bit Osso i think you got it upside down in your codewhy arnt you using @ProgramFilesDir macro?you can read about it in help file under "Running under Windows 64-bit Edition"And for gods sake update your autoit@ProcessorArch was added on 12th August, 2006 - v3.2.0 and changed on 24th December, 2008 - v3.3.0.0 to @OSArch and now is 2012 - v3.3.8.1 so i realy dont know how old version your using so do try to update before your next try. Edited July 31, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Aapjuh Posted August 1, 2012 Author Share Posted August 1, 2012 as far as i knowX86 is $ProgramFileDir = "Program Files (x86)";32 bit OsX64 is $ProgramFileDir = "Program Files";64 bit Osso i think you got it upside down in your codewhy arnt you using @ProgramFilesDir macro?you can read about it in help file under "Running under Windows 64-bit Edition"i wanted my script to go in the 32bit program files on both 32 and 64, and firgured it was fine doing it this wayAnd for gods sake update your autoit@ProcessorArch was added on 12th August, 2006 - v3.2.0 and changed on 24th December, 2008 - v3.3.0.0 to @OSArch and now is 2012 - v3.3.8.1 so i realy dont know how old version your using so do try to update before your next try.actualy im using latest beta, i just copy pasted it from an old .au3 i had Link to comment Share on other sites More sharing options...
bogQ Posted August 1, 2012 Share Posted August 1, 2012 (edited) im wondering can you set icon dest as '%ProgramFiles(x86)%' & "TestDirIconsIcon-Test.ico") instead $RightDir & "TestDirIconsIcon-Test.ico")? Strange that it dont target it correctly with full path, but newer the less post up to date replicator script that other can see and test to confirm bug on win7, to me it automaticly added %ProgramFiles% (x86)TestDirIconsIcon-Test.ico but whud realy like to see results from someone that have with win 7 (x64) so maby '%ProgramFiles' & " (x86)TestDirIconsIcon-Test.ico") can work 2. Edited August 1, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Aapjuh Posted August 1, 2012 Author Share Posted August 1, 2012 (edited) im wondering can you set icon dest as '%ProgramFiles(x86)%' & "TestDirIconsIcon-Test.ico") instead $RightDir & "TestDirIconsIcon-Test.ico")? Strange that it dont target it correctly with full path, but newer the less post up to date replicator script that other can see and test to confirm bug on win7, to me it automaticly added %ProgramFiles% (x86)TestDirIconsIcon-Test.ico but whud realy like to see results from someone that have with win 7 (x64) so maby '%ProgramFiles' & " (x86)TestDirIconsIcon-Test.ico") can work 2. yay it works, thnx alot im using this now: if 32 "%ProgramFiles%" elseif 64 "%ProgramFiles% (x86)" seems to work fine If @ProcessorArch = "X86" Then FileCreateShortcut($RightDir & "TestDirTest.exe", @DesktopDir & "Test.lnk", $RightDir & "TestDir", "", "Test", "%ProgramFiles%" & "TestDirIconsIcon-Test.ico") FileCreateShortcut($RightDir & "TestDirDelete-Test.exe", @DesktopDir & "Delete-Test.lnk", $RightDir & "TestDir", "", "Delete Test", "%ProgramFiles%" & "TestDirIconsIcon-Test-Delete.ico") ElseIf @ProcessorArch = "X64" Then FileCreateShortcut($RightDir & "TestDirTest.exe", @DesktopDir & "Test.lnk", $RightDir & "TestDir", "", "Test", "%ProgramFiles% (x86)" & "TestDirIconsIcon-Test.ico") FileCreateShortcut($RightDir & "TestDirDelete-Test.exe", @DesktopDir & "Delete-Test.lnk", $RightDir & "TestDir", "", "Delete Test", "%ProgramFiles% (x86)" & "TestDirIconsIcon-Test-Delete.ico") EndIf Edited August 1, 2012 by Aapjuh Link to comment Share on other sites More sharing options...
BrewManNH Posted August 1, 2012 Share Posted August 1, 2012 On 64 bit Windows, there's an environment variable for %programfiles% and %programfiles(x86)%, so you could actually use the correct environment variable instead of slapping one together like that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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