Regex reg = new Regex("^a1.mp3");
Shell S = new Shell(); int CSIDL_INTERNET_CACHE = 0x20;
Folder F = S.NameSpace(CSIDL_INTERNET_CACHE); foreach (FolderItem FI in F.Items()) { Match ma = reg.Match(FI.Path);
if (ma.Success == true) { foreach (FolderItemVerb FIV in FI.Verbs()) { if (FIV.Name == "复制(&C)"||FIV.Name =="&Copy") { FIV.DoIt(); break; } }
} }
Regex reg2 = new Regex("sometimes"); int CSIDL_DESKTOP = 0x00; Folder G = S.NameSpace(CSIDL_DESKTOP); foreach (FolderItem GI in G.Items()) { Match ma = reg2.Match(GI.Path);
if (ma.Success == true) { foreach (FolderItemVerb GIV in GI.Verbs()) { if (GIV.Name == "粘贴(&P)"||GIV.Name =="&Paste") { GIV.DoIt(); break; } } } } Marshal.FinalReleaseComObject(S); }
}
就是将ie临时文件中的a1.mp3复制到桌面的sometimes文件夹。经常失效。好像是没有复制到,然后把原来剪切板中的内容复制到文件夹中去了我用搜狗浏览器截图的时候也经常碰到这种问题,就是提示复制到了,然后ctrl+v还是上次的那张图片
Shell S = new Shell(); int CSIDL_INTERNET_CACHE = 0x20;
Folder F = S.NameSpace(CSIDL_INTERNET_CACHE); foreach (FolderItem FI in F.Items()) { Match ma = reg.Match(FI.Path);
if (ma.Success == true) { foreach (FolderItemVerb FIV in FI.Verbs()) { if (FIV.Name == "复制(&C)"||FIV.Name =="&Copy") { FIV.DoIt(); break; } }
} }
Regex reg2 = new Regex("sometimes"); int CSIDL_DESKTOP = 0x00; Folder G = S.NameSpace(CSIDL_DESKTOP); foreach (FolderItem GI in G.Items()) { Match ma = reg2.Match(GI.Path);
if (ma.Success == true) { foreach (FolderItemVerb GIV in GI.Verbs()) { if (GIV.Name == "粘贴(&P)"||GIV.Name =="&Paste") { GIV.DoIt(); break; } } } } Marshal.FinalReleaseComObject(S); }
}
就是将ie临时文件中的a1.mp3复制到桌面的sometimes文件夹。经常失效。好像是没有复制到,然后把原来剪切板中的内容复制到文件夹中去了我用搜狗浏览器截图的时候也经常碰到这种问题,就是提示复制到了,然后ctrl+v还是上次的那张图片
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
//using System.Text.RegularExpressions;
//using System.Collections;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
string path = (Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\sometimes");
if (!Directory.Exists(path))
{ Directory.CreateDirectory(path);
}
System.Threading.Thread.Sleep(2000);
// ArrayList sth= new ArrayList();
//string path2 = (Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
string path4;
string path3 = (Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)) + "\\Content.IE5";
DirectoryInfo TheFolder2 = new DirectoryInfo(path3);
foreach (DirectoryInfo NextFolder2 in TheFolder2.GetDirectories()) // sth.Add(NextFolder2.Name); // foreach (Object o in sth)
{
// path4 = path3 + "/" + o.ToString();
path4 = path3 + "\\" + NextFolder2.Name;
DirectoryInfo TheFolder4 = new DirectoryInfo(path4); foreach (FileInfo NextFile in TheFolder4.GetFiles()) if (NextFile.Name == "a1.mp3") File.Copy(NextFile.FullName, path + "\\To love's End.mp3", true); break;
}
}
}
}