Jump to content

Network Klasörüne Dosya Nasıl Atılır ?


muratboy31
 Share

Recommended Posts

Arkadaşlar merhaba,

Öncelikle herkesin bayramı mübarek olsun...

 

Ben network te bulunan bir klasöre resim dosyasını atıp bunu mysql veri tabanına yolunu yazmak istiyorum, acaba daha önce böyle bir işlem yapan beni yönlendirebilir mi ?

 

Teşekürler

Link to comment
Share on other sites

Kullanıcı adı ve şifre istemesi yani Guest hesabı girişi istemesinin sebebi;
Senin o bilgisayardaki klasörün paylaştırılmamasından kaynaklanıyor.
Klasörü paylaşıma aç girişe gerek kalmaz.
Gerisi zaten File.Copy komutu.

Link to comment
Share on other sites

Keşke baştan belirtsen :)
Ams kendinden bağımsız olan inputa yazı aktarabiliyorsa eğer.
Kullanıcı adını gireceğin inputun adı diyelim UserLogin

O zaman

Input.SetText("UserLogin", "admin")

şeklinde olur.

Ancak dediğim gibi Ams bunu destekliyor mu bilmiyorum.
AutoIt destekliyordu.

Bunu da denemek gerek.

Link to comment
Share on other sites

:) Yukarıda ne yazmışım
Destekliyor mu bilmiyorum!
Dene öğren bu kadar basit.

Link to comment
Share on other sites

  • Editor

Drive Get Enumarable olması lazımdı öyle bir fonksiyonla tüm sürücüleri listeletip bir for döngüsünde Autoit.GetMap ile tek tek kontrol edersin.

Link to comment
Share on other sites

  • Editor

Yada bu kodlarla da listelete bilirsin. LuaCom pluginini aktif etmen lazım.

function WMIDateStringToDate(dtmDate)
    if dtmDate then
        dtmDate = tostring(dtmDate);
        return (String.Mid (dtmDate, 7, 2)  .. "/" ..
                String.Mid (dtmDate, 5, 2)  .. "/" ..
                String.Left(dtmDate, 4)     .. " " ..
                String.Mid (dtmDate, 9, 2)  .. ":" .. 
                String.Mid (dtmDate, 11, 2) .. ":" .. 
                String.Mid (dtmDate, 13, 2)
               );
    else
        return "";
    end
end

function Escape(v)
    if (v == nil) then return ""; end
    if (type(v) == "table") then return Table.Concat(v, ", "); end
    if (type(v) == "boolean") then
        if (v == true) then return "Yes"; else return "No"; end
    end
    return v;
end

local sOutput      = "";
local sOutputTitle = "Computer: localhost\r\n==========================================\r\n\r\n";
local oWMIService  = luacom.GetObject("winmgmts:\\\\localhost\\root\\CIMV2");
local oColItems    = oWMIService:ExecQuery("SELECT * FROM Win32_MappedLogicalDisk", "WQL", 48);
if oColItems then
    local oEnum   = luacom.GetEnumerator(oColItems);
    local oItem = oEnum:Next();
    while oItem do
        sOutput = sOutput .. "Access: " .. Escape(oItem:Access()) .. "\r\n";
        sOutput = sOutput .. "Availability: " .. Escape(oItem:Availability()) .. "\r\n";
        sOutput = sOutput .. "BlockSize: " .. Escape(oItem:BlockSize()) .. "\r\n";
        sOutput = sOutput .. "Caption: " .. Escape(oItem:Caption()) .. "\r\n";
        sOutput = sOutput .. "Compressed: " .. Escape(oItem:Compressed()) .. "\r\n";
        sOutput = sOutput .. "ConfigManagerErrorCode: " .. Escape(oItem:ConfigManagerErrorCode()) .. "\r\n";
        sOutput = sOutput .. "ConfigManagerUserConfig: " .. Escape(oItem:ConfigManagerUserConfig()) .. "\r\n";
        sOutput = sOutput .. "CreationClassName: " .. Escape(oItem:CreationClassName()) .. "\r\n";
        sOutput = sOutput .. "Description: " .. Escape(oItem:Description()) .. "\r\n";
        sOutput = sOutput .. "DeviceID: " .. Escape(oItem:DeviceID()) .. "\r\n";
        sOutput = sOutput .. "ErrorCleared: " .. Escape(oItem:ErrorCleared()) .. "\r\n";
        sOutput = sOutput .. "ErrorDescription: " .. Escape(oItem:ErrorDescription()) .. "\r\n";
        sOutput = sOutput .. "ErrorMethodology: " .. Escape(oItem:ErrorMethodology()) .. "\r\n";
        sOutput = sOutput .. "FileSystem: " .. Escape(oItem:FileSystem()) .. "\r\n";
        sOutput = sOutput .. "FreeSpace: " .. Escape(oItem:FreeSpace()) .. "\r\n";
        sOutput = sOutput .. "InstallDate: " .. WMIDateStringToDate(oItem:InstallDate()) .. "\r\n";
        sOutput = sOutput .. "LastErrorCode: " .. Escape(oItem:LastErrorCode()) .. "\r\n";
        sOutput = sOutput .. "MaximumComponentLength: " .. Escape(oItem:MaximumComponentLength()) .. "\r\n";
        sOutput = sOutput .. "Name: " .. Escape(oItem:Name()) .. "\r\n";
        sOutput = sOutput .. "NumberOfBlocks: " .. Escape(oItem:NumberOfBlocks()) .. "\r\n";
        sOutput = sOutput .. "PNPDeviceID: " .. Escape(oItem:PNPDeviceID()) .. "\r\n";
        sOutput = sOutput .. "PowerManagementCapabilities: " .. Escape(oItem:PowerManagementCapabilities()) .. "\r\n";
        sOutput = sOutput .. "PowerManagementSupported: " .. Escape(oItem:PowerManagementSupported()) .. "\r\n";
        sOutput = sOutput .. "ProviderName: " .. Escape(oItem:ProviderName()) .. "\r\n";
        sOutput = sOutput .. "Purpose: " .. Escape(oItem:Purpose()) .. "\r\n";
        sOutput = sOutput .. "QuotasDisabled: " .. Escape(oItem:QuotasDisabled()) .. "\r\n";
        sOutput = sOutput .. "QuotasIncomplete: " .. Escape(oItem:QuotasIncomplete()) .. "\r\n";
        sOutput = sOutput .. "QuotasRebuilding: " .. Escape(oItem:QuotasRebuilding()) .. "\r\n";
        sOutput = sOutput .. "SessionID: " .. Escape(oItem:SessionID()) .. "\r\n";
        sOutput = sOutput .. "Size: " .. Escape(oItem:Size()) .. "\r\n";
        sOutput = sOutput .. "Status: " .. Escape(oItem:Status()) .. "\r\n";
        sOutput = sOutput .. "StatusInfo: " .. Escape(oItem:StatusInfo()) .. "\r\n";
        sOutput = sOutput .. "SupportsDiskQuotas: " .. Escape(oItem:SupportsDiskQuotas()) .. "\r\n";
        sOutput = sOutput .. "SupportsFileBasedCompression: " .. Escape(oItem:SupportsFileBasedCompression()) .. "\r\n";
        sOutput = sOutput .. "SystemCreationClassName: " .. Escape(oItem:SystemCreationClassName()) .. "\r\n";
        sOutput = sOutput .. "SystemName: " .. Escape(oItem:SystemName()) .. "\r\n";
        sOutput = sOutput .. "VolumeName: " .. Escape(oItem:VolumeName()) .. "\r\n";
        sOutput = sOutput .. "VolumeSerialNumber: " .. Escape(oItem:VolumeSerialNumber()) .. "\r\n";
        if (Dialog.Message("WMI Output",  sOutputTitle .. sOutput, 1) == 2) then break; end
        sOutput = "";
        oItem = oEnum:Next();
    end
else
    Dialog.Message("WMI Output", "No WMI Objects Found for class: Win32_MappedLogicalDisk");
end
Link to comment
Share on other sites

AutoIt.DriveMapAdd("X:", "\\\\192.168.1.2\\folder", 0, "user", "pass")
Numara = 1
local tbImg = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "Pictures (.png, .jpg, .tif)|*.png;*.jpg;*.tif|", "", "dat", false, false);
if (tbImg[1] ~= "CANCEL") then
local ext=String.SplitPath(tbImg[1]).Extension;
File.Copy(tbImg[1], "X:\\resimler\\"..Numara.""..ext, true, true, false, true, nil);
Input.SetText("Input1","\\\\192.168.1.2\\folder\\resimler\\"..Numara..""..ext);
Image.Load("Image1", "X:\\resimler\\"..Numara..""..ext);

end

AutoIt.DriveMapDel("X:")    --- bu kodu kullandığımda dosya upload işi bitmeden map siliniyor, acaba upload bittikten sonra silmesini nasıl sağlarım ?

Link to comment
Share on other sites

  • Editor

Global Function

function kopyala(FileTotal,FileCopied)
if FileTotal == FileCopied then
--Map lenen sürücüyü sil
end
end

Buton veya nerede kullanacaksan.

File.Copy("C:\\MyDir\\*.*", "C:\\DestDir\\", true, true, false, true, kopyala);
Link to comment
Share on other sites

Yanlış mı yapıyorum pairs ? olmadı...

 

Button code:

AutoIt.DriveMapAdd("X:", "\\\\192.168.1.2\\folder", 0, "user", "pass")
Numara = 1
local tbImg = Dialog.FileBrowse(true, "Locate File", _DesktopFolder, "Pictures (.png, .jpg, .tif)|*.png;*.jpg;*.tif|", "", "dat", false, false);
if (tbImg[1] ~= "CANCEL") then
local ext=String.SplitPath(tbImg[1]).Extension;
File.Copy(tbImg[1], "X:\\resimler\\"..Numara.""..ext, true, true, false, true, kopyala);
Image.Load("Image1", "X:\\resimler\\"..Numara..""..ext);

end

 

Global code:

function kopyala(FileTotal,FileCopied)
if FileTotal == FileCopied then
AutoIt.DriveMapDel("X:")
end
end
 

Link to comment
Share on other sites

  • Editor

sanırım gerek kalmadı oldu gibi ama şöyle birşey fark ettim autoit plugin ile mapleme yaparken sorun oluyor sanırım mapleme olmadı taki ben manuel olarak network drive windows explorer da açana kadar...

Map lemeye gerek kalmayacak eve geçeyim ufak bi ayar çekicem.

Link to comment
Share on other sites

  • Editor

Aklıma şu geldi manuel olarak denediğimde çalıştı ams ile kullanıldıgındada çalışacagını umuyorum bi denersin map yapıp silmene gerek kalmaz hem.

otantike = File.Run("cmd", "/C net use \\192.168.1.2\folder /USER:domain\kullaniciadi password", _WindowsFolder.."\\System32", SW_HIDE, false);
File.Copy("C:\\MyDir\\*.*", "\\192.168.1.2\\folder", true, true, false, true, nil);

Link to comment
Share on other sites

File.Run("cmd", "/C net use \\\\192.168.1.2\\folder /USER:muratboy31 123456", _WindowsFolder.."\\System32", SW_HIDE, false);
File.Copy("AutoPlay\\Docs\\Test.Pdf", "\\\\192.168.1.2\\folder", true, true, false, true, nil);

 

bu şekilde çalıştı ama şöyle bir sorun çıktı... program kapanmıyor dosya attıktan sonra belli bir süre...

Link to comment
Share on other sites

File.Run("cmd", "/C net use \\\\192.168.1.2\\folder /USER:muratboy31 123456", _WindowsFolder.."\\System32", SW_HIDE, false);
File.Copy("AutoPlay\\Docs\\Test.Pdf", "\\\\192.168.1.2\\folder", true, true, false, true, nil);

 

bu şekilde çalıştı ama şöyle bir sorun çıktı... program kapanmıyor dosya attıktan sonra belli bir süre...

 

yanlış hatırlamıyorsam bu şekilde map kalıcı oluyor ama

123456 nın sonuna

/persistent:no

yani

File.Run("cmd", "/C net use \\\\192.168.1.2\\folder /USER:muratboy31 123456 /persistent:no", _WindowsFolder.."\\System32", SW_HIDE, false);

komutunu eklerseniz maplemeyi geçici olarak yapacaktır. Bilginize

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...