radyofon Posted July 26, 2013 Share Posted July 26, 2013 İyi Çalışmalar arkadaşlar, AMS' de %username% %systemdrive% %systemroot% gibi komutların karşılığı var mı? C:\Kullanıcılar\kullanıcı adı\ altına bir dosya kopyalabilmem için bu variable'lara ihtiyacım var. Çünkü her bilgisayarda kullanıcı adı değişiyor. Bunun AMS' de bir karşılığı var mı? File.Copy komutuyla var olan dosyanın yerine yenisini her bilgisayarda kopyalamam gerekiyor. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted July 26, 2013 Share Posted July 26, 2013 kod editöründeyken CTRL+Space'e basınca açılan listeden hepsini bulabilirsiniz: kullanımı: klasor = Shell.GetFolder(SHF_MYDOCUMENTS) Dialog.Message("", klasor) Edit: help dosyasından Shell.GetFolder'ı aratırsanız orda tam liste varmış yeni farkettim. Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 26, 2013 Author Share Posted July 26, 2013 Üstadım maalesef orada %username% ile ilgili bir şey bulamıyorum. Ben x.bat dosyasını c:\users\kintaro altına kopyalamak istiyorum. kintaroyu örnek olarak verdim. Bu her bilgisayarda değişken. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted July 26, 2013 Share Posted July 26, 2013 Setup factory için yapılmış bir örnek bulup onu AMS'ye uyarladım: local adf = Shell.GetFolder(SHF_MYDOCUMENTS) Dialog.Message("", adf) local lastSlashPos = String.ReverseFind (adf,"\\"); userDir = String.Left (adf, lastSlashPos - 1); Dialog.Message ("Kullanici Klasörü:", userDir); Windows 8'de çalışıyor ama Win7 ve XP'de denemek lazım. Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 26, 2013 Author Share Posted July 26, 2013 Teşekkürler üstadım. Buna göre yaparım artık. Klavyen dert görmesin. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 26, 2013 Editor Share Posted July 26, 2013 Dialog.Message("",os.getenv("USERNAME")); Quote Link to comment Share on other sites More sharing options...
KintaRo Posted July 26, 2013 Share Posted July 26, 2013 LUA ile denemek aklıma gelmemişti, helal :) boynuz kulağı geçiyor işte ne yaparsın :D Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 26, 2013 Share Posted July 26, 2013 Sanıyorum registry ile de yapılabilir... Quote Link to comment Share on other sites More sharing options...
reyiz Posted July 26, 2013 Share Posted July 26, 2013 os.getenv() komutu ile Windows değişkenlerini kullanabilirsiniz. pairs de komutu kullanmış fakat bu şekilde sadece kullanıcı adı alınabiliyor. profil = os.getenv("USERPROFILE") Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 27, 2013 Author Share Posted July 27, 2013 @pairs Kullanıcı adını aldıktan sonra onu File.Copy komutunda nasıl kullanabiliriz? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 27, 2013 Editor Share Posted July 27, 2013 File.Copy("C:\\Users\\"..os.getenv("USERNAME").."\\Documents\\a.bat",_SourceFolder.."\\a.bat"); bu şekilde belgelerim altındaki a.bat dosyasını exenin yanına kopyalar. Quote Link to comment Share on other sites More sharing options...
reyiz Posted July 27, 2013 Share Posted July 27, 2013 Bu şekilde kullanım yaparsanız sağlıklı olmaz. Farklı sistemlerde çalışmayabilir. File.Copy(os.getenv("USERPROFILE").."\\Documents\\a.bat",_SourceFolder.."\\a.bat"); Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 27, 2013 Author Share Posted July 27, 2013 (edited) Sevgili pairs ".java.policy" diye bir dosyayı "c:\Kullanıcılar\kullanıcı adı" içerisine kopyalamam gerekiyor. Yazdığım komut aşağıda ve çalışmıyor. Acaba reyiz'in dediği gibi çalışmıyor mu? Deneme yaptığım sistem 64bit Win7 File.Copy("AutoPlay\\Docs\\.java.policy", os.getenv("USERPROFILE"), true, true, true, true); Edited July 27, 2013 by radyofon Quote Link to comment Share on other sites More sharing options...
reyiz Posted July 27, 2013 Share Posted July 27, 2013 Denediğiniz komut doğru ve bende çalışıyor. Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 27, 2013 Author Share Posted July 27, 2013 (edited) Ben bir yerde hata yapıyorum mutlaka. os.getenv komutundan önce C:\\USER girmek gerekli mi acaba? Öyle de denedim olmadı. Bir de şöyle de düşünmek gerekir. Kullanıcıların sistem dosyalarının bulunduğu kısım C olmayabilir de. Bu durumda ne yapmak gerekir? Acaba eksik plugin mi var? Edit --------- Arada bir dialog vardı, Orada hata varmış. teşekkürler @pairs, teşekkürler KintaRo Fakat dediğim gibi, kullanıcının bulunduğu directory C değil ise ne yapacağız. Her türlü koşulda çalışması için ana dizin adını almamız gerekmez mi? SessionVar.Get mi kullanmalıyız? Nasıl yapmalıyız? Edited July 27, 2013 by radyofon Quote Link to comment Share on other sites More sharing options...
reyiz Posted July 27, 2013 Share Posted July 27, 2013 Userprofile zaten kullanıcı profilinin tam yolunu veriyor. Apz dosyasını verebilir misiniz? Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 27, 2013 Author Share Posted July 27, 2013 İşte apz dosyası. https://hotfile.com/dl/236290608/a9680a6/Copy_of_MEB_DYS.apz.html Quote Link to comment Share on other sites More sharing options...
DivaneTR Posted July 27, 2013 Share Posted July 27, 2013 İşte apz dosyası. https://hotfile.com/dl/236290608/a9680a6/Copy_of_MEB_DYS.apz.html File.Copy("AutoPlay\\Docs\\.java.policy", "C:\\Users\\"..os.getenv("USERNAME").."\\.java.policy", true, true, true, true); 9. satır bu şekilde olmalı. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 27, 2013 Editor Share Posted July 27, 2013 radyofon kullanıcı adını istedin sadece o yüzden username dedim .Os.GetEnv() fonksiyonuyla sistemde çalışan tüm fonksiyonlaı kullanabilirsin. Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 28, 2013 Author Share Posted July 28, 2013 @DivaneTR 9.satırı bu şekilde düzelttim. Fakat dediğim gibi ana dizin her zaman c olmayabilir. O zaman ne yapacağız. Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 28, 2013 Author Share Posted July 28, 2013 Ana dizinin değişken olabileceğini yani C:, D:, E:, F:, olabileceğini düşünerek KintaRo üstadın yapmış olduğu scriptin daha iyi sonuç vereceğini düşündüm ve aşağıdaki gibi bir script yaptım. if System.Is64BitOS() then Wow64.DisableFsRedirection(); end local adf = Shell.GetFolder(SHF_MYDOCUMENTS) local lastSlashPos = String.ReverseFind (adf,"\\"); userDir = String.Left (adf, lastSlashPos - 1); Dialog.Message ("Kullanici Klasörü:", userDir); Dialogoldjavapolicy = Dialog.Message("Eski .java.policy dosyasını silme", userDir.." altındaki '.java.policy' dosyasını\r\n\r\nsilmemi ve yenisini kopyalamamı ister misiniz?", MB_YESNO, MB_ICONINFORMATION); if (Dialogoldjavapolicy==IDYES) then File.Copy("AutoPlay\\Docs\\.java.policy", userDir, true, true, true, true); end if System.Is64BitOS() then Wow64.RevertFsRedirection(); end Quote Link to comment Share on other sites More sharing options...
reyiz Posted July 28, 2013 Share Posted July 28, 2013 Userprofile değişkeni bütün Windows sürümlerinde kullanılabilir. Sizin sisteminizde bir sorun olmalı. Bu şekilde dener misiniz birde? File.Copy("AutoPlay\\Docs\\.java.policy", os.getenv("USERPROFILE").."\\.java.policy", true, true, true, true); Quote Link to comment Share on other sites More sharing options...
radyofon Posted July 29, 2013 Author Share Posted July 29, 2013 @reyiz sistemimde sorun olduğundan değil. Komutun: File.Copy("AutoPlay\\Docs\\.java.policy", "C:\\Users\\"..os.getenv("USERNAME").."\\.java.policy", true, true, true, true); şeklinde olması nedeniyle. Dikkat edersen burada Users dan önce kök dizin olarak C: var. Demek istediğim bunun D: de olabileceği ya da başka bir harf. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted July 29, 2013 Share Posted July 29, 2013 Sistemin kurulu olduğu kök dizini bulmak için şunu kullanabilirsiniz: sysdrive = String.SplitPath(_SystemFolder).Drive; Dialog.Message("", sysdrive) Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 29, 2013 Editor Share Posted July 29, 2013 Radyofon tam olarka nereye kopyalatmak istiyorsun onu söylersen ona göre kod yazalım. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.