@pcinfogmach
לכל מי שביקש נוסף כעת אפשרויות החלפה ברגקס
תודה רבה לכל העוזרים ובפרט ל-@מד ול-@dovid שללא העצות שלהם לא יודע אם הייתי יכול להשלים את המלאכה

הפורום כעת לקריאה בלבד, לקריאה נוספת.
@pcinfogmach
לכל מי שביקש נוסף כעת אפשרויות החלפה ברגקס
תודה רבה לכל העוזרים ובפרט ל-@מד ול-@dovid שללא העצות שלהם לא יודע אם הייתי יכול להשלים את המלאכה

@yossiz
וואו! תודה רבה.
להלן תקציר תוכן הכתבה:
(אפשר לעשות דוקטורט בוורד רק מהנושא הזה
)
בכתבה מוצג קוד לחישוב דינאמי של הערכים השונים של גווני ערכת הנושא (בערכים דצימליים המומרים ל-hex מיוחד לוורד).
בנוסף, מופיע קוד לקבלת ערכי ה-hex הקלאסיים של צבעי ערכת הנושא
העיקרון של הקודים הללו מוסבר בתת-כתבה, והוא קצר וברור.
כמו כן, מוצג קוד המדמה את הגוונים ב-hex באמצעות HSL. מדובר בקוד מעט מורכב, ולא בהכרח חיוני — שכן בדיאלוג של Word יש רק ערכים סטטיים מסוימים. הדרך היחידה לייצר גוונים אחרים היא באמצעות הקוד שבכתבה, שרוב המשתמשים כלל אינם מכירים או מתעניינים בו.
כמו"כ אין קוד המחשב כיצד הדיאלוג ב-Word מפיק את הגוונים ועבור אלו צבעים. למעשה, קיימים שלושה סוגי חישוב גוונים בדיאלוג: רקע, טקסט והדגשה. ואפשר לעשות זאת בצורה סטטית.
בס"ד יש עדכונים
עוד לא הספקתי את ההחלפה אבל החיפוש מוכן
תודה לכל המסייעים.
אשמח מאוד לשמוע על באגים אם יש.
שימו לב! אם התקנתם את הגירסה הישנה יש להסיר אותה ולהתקין את החדשה. עקב העובדה שהייתי צריך להחליף את הפרוייקט באמצע העבודה.
זוהי פשלה חד פעמית בעז"ה ומכאן ואילך יהיה אפשר להתקין עדכונים ברגע בלי לדאוג אחר הסרת הקודם. איתכם הסליחה.
כמו"כ יצרתי גיטהאב והוספתי קוד בתוכנה עבור בדיקת עידכונים אוטומטית.
https://github.com/pcinfogmach/RegexInWordPublish/releases/tag/v1

לגופו של עניין:
אין לי היכרות עם מדיה-ויקי או עם הפורמט שלו, והמשמעות של הנקודה ושל ה-"|" אינן ברורות לי דיו. עם זאת, אני מניח שמדובר בפורמט מסודר עם כללים, ואם תלמד איך הוא בנוי, אני בטוח שתוכל לנתח כל טקסט בסגנון הזה די בקלות הכל שאלה של כמה זמן אתה מוכן להשקיע.
אם נתעלם לרגע מהנקודה ומה-"|", נוכל להשתמש בשילוב של רג'קס וקוד רקורסיבי עם מבנה נתונים פשוט (@dovid רמז לזה כבר).
אבל חשוב לציין שזה בהנחה שהטקסט לא מכיל שגיאות או אי-עקביות – אחרת זה כאב ראש * 20.
להלן דוגמא ב-C# שהזנתי ל-LinqPad, הקוד הינו סקיצה בעלמא תוכל לשפר אותו כיד ה' הטובה עליך:
void Main()
{
string content = "{{some content{{some more content{{some more content{{some more content}}}}}}}}";
var root = new NestedContent(content, null);
root.Dump(); // Dump the root object to view its structure
}
class NestedContent
{
public string Content { get; set; }
public NestedContent Child { get; set; }
public NestedContent(string content, NestedContent parent)
{
// Trim only the outermost braces (single pair at start and end)
if (content.StartsWith("{{") && content.EndsWith("}}"))
{
content = content.Substring(2, content.Length - 4);
}
var match = Regex.Match(content, @"\{\{.*\}\}");
if (match.Success)
{
string nestedContent = match.Value;
this.Content = content.Replace(nestedContent, ""); // Replace inner braces content
Child = new NestedContent(nestedContent, this); // Recursive call for nested content
}
else
{
this.Content = content; // Set content when no more nested structures
}
}
}
והתוצאה:

@האדם-החושב
זה יפה שכולם פיענחו מה אתה רוצה לי זה לקח קצת זמן עד שקלטתי שאני צריך לקרוא את מה שכתבת בפנים בקונטקסט של הכותרת ולנחש שבעצם אתה שואל איך לעשות רגקס שיפתור את הבעיה.
אתה כותב הבעיה מתחילה מבלי לפרט מה עשית לפני שהבעיה התחילה.
אישית לא הייתי שואל ככה אלא איך לפתור את הבעיה והאם רגקס הוא כיוון טוב.
כאשר עובדים עם TextBox ב-WPF, לפעמים נרצה לשפר את חוויית המשתמש על ידי ביצוע פעולות אוטומטיות, כמו בחירת כל הטקסט כאשר הרכיב מקבל פוקוס או קביעה אוטומטית של פוקוס על TextBox בעת הטעינה.
אשמח לקבל הערות והארות.
מצו"ב הקוד:
public class TextBoxFocusBehavior
{
public static bool GetSelectAll(FrameworkElement frameworkElement)
{
return (bool)frameworkElement.GetValue(SelectAllProperty);
}
public static void SetSelectAll(FrameworkElement frameworkElement, bool value)
{
frameworkElement.SetValue(SelectAllProperty, value);
}
public static bool GetCaptureFocus(FrameworkElement frameworkElement)
{
return (bool)frameworkElement.GetValue(CaptureFocusProperty);
}
public static void SetCaptureFocus(FrameworkElement frameworkElement, bool value)
{
frameworkElement.SetValue(CaptureFocusProperty, value);
}
public static readonly DependencyProperty CaptureFocusProperty =
DependencyProperty.RegisterAttached("CaptureFocus",
typeof(bool), typeof(TextBoxFocusBehavior),
new FrameworkPropertyMetadata(false, OnCaptureFocusChanged));
public static readonly DependencyProperty SelectAllProperty =
DependencyProperty.RegisterAttached("SelectAll",
typeof(bool), typeof(TextBoxFocusBehavior),
new FrameworkPropertyMetadata(false, OnSelectAllChanged));
private static void OnSelectAllChanged
(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var frameworkElement = d as FrameworkElement;
if (frameworkElement == null) return;
if (e.NewValue is bool == false) return;
if ((bool)e.NewValue)
{
frameworkElement.GotFocus += SelectAll;
frameworkElement.PreviewMouseDown += IgnoreMouseButton;
}
else
{
frameworkElement.GotFocus -= SelectAll;
frameworkElement.PreviewMouseDown -= IgnoreMouseButton;
}
}
private static void OnCaptureFocusChanged
(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var frameworkElement = d as FrameworkElement;
if (frameworkElement == null) return;
if (e.NewValue is bool == false) return;
if ((bool)e.NewValue)
{
frameworkElement.Loaded += FrameworkElement_Loaded;
}
else
{
frameworkElement.Loaded -= FrameworkElement_Loaded;
}
}
private static void FrameworkElement_Loaded(object sender, RoutedEventArgs e)
{
var frameworkElement = e.OriginalSource as FrameworkElement;
frameworkElement.Focus();
}
private static void SelectAll(object sender, RoutedEventArgs e)
{
var frameworkElement = e.OriginalSource as FrameworkElement;
if (frameworkElement is TextBox)
((TextBoxBase)frameworkElement).SelectAll();
else if (frameworkElement is PasswordBox)
((PasswordBox)frameworkElement).SelectAll();
}
private static void IgnoreMouseButton
(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var frameworkElement = sender as FrameworkElement;
if (frameworkElement == null || frameworkElement.IsKeyboardFocusWithin) return;
e.Handled = true;
frameworkElement.Focus();
}
}
המחלקה TextBoxFocusBehavior מספקת שתי יכולות:
Select All: בחירת כל הטקסט כאשר הרכיב מקבל פוקוס.
Capture Focus: קביעה כי רכיב מסוים יקבל פוקוס אוטומטית בעת טעינת החלון.
דוגמאות שימוש:
<TextBox Text="Hello, World!"
local:TextBoxFocusBehavior.SelectAll="True"
local:TextBoxFocusBehavior.CaptureFocus="True" />
מצו"ב הקוד (מתאים במיוחד עבור DarkTheme)

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:Double x:Key="ScrollBarWidth">16</system:Double>
<system:Double x:Key="ScrollBarArrowHeight">4</system:Double>
<system:Double x:Key="ScrollBarArrowWidth">8</system:Double>
<SolidColorBrush x:Key="ScrollBarButtonBackgroundBrush" Color="#888888" Opacity="0.4" />
<SolidColorBrush x:Key="ScrollBarButtonHighlightBackgroundBrush" Color="#B0B0B0" Opacity="0.4" />
<Style TargetType="{x:Type ScrollBar}">
<Setter Property="Foreground" Value="#FF999999"/>
<Style.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Width" Value="{StaticResource ScrollBarWidth}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Border BorderThickness="1">
<Border.BorderBrush>
<SolidColorBrush Color="#888888" Opacity="0.6"/>
</Border.BorderBrush>
<Border.Background>
<SolidColorBrush Color="#888888" Opacity="0.1"/>
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0"
Command="ScrollBar.LineUpCommand"
Height="{StaticResource ScrollBarWidth}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Rectangle x:Name="ButtonRectangle"
Fill="Transparent"/>
<Path x:Name="ButtonPath" HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 10 L 10 10 L 5 0 Z"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ScrollBar}}"
Stretch="Fill"
Height="{StaticResource ScrollBarArrowHeight}"
Width="{StaticResource ScrollBarArrowWidth}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonRectangle" Property="Fill" Value="{StaticResource ScrollBarButtonHighlightBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Track Name="PART_Track" IsDirectionReversed="True" VerticalAlignment="Stretch" Grid.Row="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageUpCommand"
Background="Transparent">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}"
Height="{TemplateBinding ActualHeight}"
Width="{TemplateBinding ActualWidth}" />
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Rectangle x:Name="ThumbRectangle"
Fill="{StaticResource ScrollBarButtonBackgroundBrush}"
Margin="1,0,1,0"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ThumbRectangle" Property="Fill" Value="{StaticResource ScrollBarButtonHighlightBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageDownCommand"
Background="Transparent">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}"
Height="{TemplateBinding ActualHeight}"
Width="{TemplateBinding ActualWidth}" />
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
</Track>
<Button Grid.Row="2"
Command="ScrollBar.LineDownCommand"
Height="{StaticResource ScrollBarWidth}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Rectangle x:Name="ButtonRectangle"
Fill="Transparent"/>
<Path HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 10 0 L 5 10 Z"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ScrollBar}}"
Stretch="Fill"
Height="{StaticResource ScrollBarArrowHeight}"
Width="{StaticResource ScrollBarArrowWidth}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonRectangle" Property="Fill" Value="{StaticResource ScrollBarButtonHighlightBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Foreground" Value="#FF999999"/>
<Setter Property="Height" Value="{StaticResource ScrollBarWidth}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Border BorderThickness="1">
<Border.BorderBrush>
<SolidColorBrush Color="#888888" Opacity="0.6"/>
</Border.BorderBrush>
<Border.Background>
<SolidColorBrush Color="#888888" Opacity="0.1"/>
</Border.Background>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Command="ScrollBar.LineLeftCommand"
Width="{StaticResource ScrollBarWidth}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Rectangle x:Name="ButtonRectangle"
Fill="Transparent"/>
<Path HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 5 L 10 0 L 10 10 Z"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ScrollBar}}"
Stretch="Fill"
Height="{StaticResource ScrollBarArrowWidth}"
Width="{StaticResource ScrollBarArrowHeight}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonRectangle" Property="Fill" Value="{StaticResource ScrollBarButtonHighlightBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Track Name="PART_Track" IsDirectionReversed="False" HorizontalAlignment="Stretch" Grid.Column="1">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageLeftCommand"
Background="Transparent">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}"
Height="{TemplateBinding ActualHeight}"
Width="{TemplateBinding ActualWidth}" />
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Rectangle x:Name="ThumbRectangle"
Fill="{StaticResource ScrollBarButtonBackgroundBrush}"
Margin="0,1,0,1"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ThumbRectangle" Property="Fill" Value="{StaticResource ScrollBarButtonHighlightBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageRightCommand"
Background="Transparent">
<RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton">
<Rectangle Fill="{TemplateBinding Background}"
Height="{TemplateBinding ActualHeight}"
Width="{TemplateBinding ActualWidth}" />
</ControlTemplate>
</RepeatButton.Template>
</RepeatButton>
</Track.IncreaseRepeatButton>
</Track>
<Button Grid.Column="2"
Command="ScrollBar.LineRightCommand"
Width="{StaticResource ScrollBarWidth}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Rectangle x:Name="ButtonRectangle"
Fill="Transparent"/>
<Path HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 10 5 L 0 0 L 0 10 Z"
Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ScrollBar}}"
Stretch="Fill"
Height="{StaticResource ScrollBarArrowHeight}"
Width="{StaticResource ScrollBarArrowWidth}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonRectangle" Property="Fill" Value="{StaticResource ScrollBarButtonHighlightBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
@אלף-שין,
כמישהו שחקר את הנושא למעלה משנה, אני רוצה לשתף אותך בתובנות שלי. התיאוריה של בניית אינדקסים באמת נשמעת פשוטה וקליטה, אבל היישום הרבה יותר מורכב. דוגמה קטנה לכך:
כשאינדקס שוקל כמה גיגה-בייטים, כמה זמן לדעתך לוקח לקרוא את התוכן שלו בצורה הקלאסית של קריאת תוכן קובץ? הבעיה היא שאי אפשר לטעון אינדקס כזה לזיכרון ה-RAM כי הוא גדול מדי. לכן, נאלצים לעבור שורה שורה באינדקס בזמן החיפוש.
אני מקצר כי אין לי כוח להאריך, אבל תאמין לי, בניית אינדקס זה לא דבר של מה בכך. במיוחד כשמדובר באינדקסים גדולים.
קוד קצר למרכז כפתורים בפקד ToolBar ב-WPF כך שבמקום להיות מוצמדים לצד הכפתורים יהיו מוצמדים למרכז:
בלי:

עם:

<ToolBar.Resources>
<Style TargetType="{x:Type ToolBarPanel}">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</ToolBar.Resources>
קוד C# לאפשר ניווט ב-wpf combobox על ידי המקשים של המקלדת (אין אפשרות מובנית לעשות זו בצורה יעילה)
void ComboBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
ComboBox comboBox = sender as ComboBox;
if (e.Key == Key.Up)
{
if (comboBox.SelectedIndex > 0) // Move selection up
comboBox.SelectedIndex--;
e.Handled = true;
}
else if (e.Key == Key.Down) // Move selection down
{
if (comboBox.SelectedIndex < comboBox.Items.Count - 1)
comboBox.SelectedIndex++;
e.Handled = true;
}
else if (e.Key == Key.Enter)
{
if (e.OriginalSource is ComboBoxItem comboBoxItem)
{
//dosomething
}
}
}
היה לי צורך ליצור ולקרוא קיצורי דרך ב-C# אז חקרתי את הנושא קצת וזה מה שיצא.
בעיקרון יש דרך פשוטה לעשות זאת על ידי IWshRuntimeLibrary
כדי להשתמש בה יש להוסיף את ה- refrence הבא:
Reference > COM > Windows Script Host Object Model.
ואז אפשר ליצור קיצור דרך:
static void createShortcut(string sourcePath, string destinationPath)
{
var wshShell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)wshShell.CreateShortcut(destinationPath);
shortcut.TargetPath = sourcePath;
shortcut.Description = $"Shortcut to {sourcePath}";
shortcut.Save();
}
או לקרוא אותם
public static string GetShortcutTarget(string shortcutFilePath)
{
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutFilePath);
return shortcut.TargetPath;
}
שיטה זו עובדת יפה אם איזור המערכת מוגדר לעברית אבל אם ברצונכם להשתמש בה גם במחשבים שבהם אין איזור המערכת מוגדר כעברית (כלומר עם תיקיות או קבצים עם שמות בעברית ויש עברית מותקן במחשב אבל איזור המערכת במחשב אינו מוגדר כעברית - מצוי מאוד אצל חוצניקים)

תתיקלו בשגיאה בקוד מאחר ו- WshShell אינו ממוטב ל-Unicode.
במקום זאת מצאתי שיטה אחרת המובאת להלן (מבוסס על כתבה זו:http://www.vbaccelerator.com/home/NET/Code/Libraries/Shell_Projects/Creating_and_Modifying_Shortcuts/article.asp)
יצרתי בה גם פונקציות ליצירת וקריאת קיצורי דרך אם תעיינו בקוד תמצאו שם אפרויות לעוד דברים.
using System;
using System.Runtime.InteropServices;
using System.Text;
public enum EShellLinkResolveFlags : uint
{
SLR_NO_UI = 0x0001,
SLR_ANY_MATCH = 0x0002,
SLR_UPDATE = 0x0004,
SLR_NOUPDATE = 0x0008,
SLR_NOSEARCH = 0x0010,
SLR_NOTRACK = 0x0020,
SLR_NOLINKINFO = 0x0040,
SLR_INVOKE_MSI = 0x0080,
SLR_NO_UI_WITH_MSG_PUMP = 0x101,
SLR_OFFER_DELETE_WITHOUT_FILE = 0x200,
SLR_KNOWNFOLDER = 0x400,
SLR_MACHINE_IN_LOCAL_TARGET = 0x800,
SLR_UPDATE_MACHINE_AND_SID = 0x1000
}
public class ShellLink
{
private IShellLinkW link = null;
public ShellLink()
{
link = (IShellLinkW)new CShellLink();
}
public void Open(
string linkFile,
IntPtr hWnd,
EShellLinkResolveFlags resolveFlags,
ushort timeOut
)
{
uint flags;
if ((resolveFlags & EShellLinkResolveFlags.SLR_NO_UI) == EShellLinkResolveFlags.SLR_NO_UI)
{
flags = (uint)((int)resolveFlags | (timeOut << 16));
}
else
{
flags = (uint)resolveFlags;
}
// Get the IPersistFile interface and call Load:
((IPersistFile)link).Load(linkFile, 0);
// Resolve the link:
link.Resolve(hWnd, flags);
}
public string Arguments
{
get
{
StringBuilder arguments = new StringBuilder(260, 260);
link.GetArguments(arguments, arguments.Capacity);
return arguments.ToString();
}
set
{
link.SetArguments(value);
}
}
public void CreateShortcut(string shortcutPath, string targetPath, string arguments, string description)
{
link.SetPath(targetPath);
link.SetArguments(arguments);
link.SetDescription(description);
IPersistFile persistFile = (IPersistFile)link;
persistFile.Save(shortcutPath, true);
}
public string ReadShortcutPath(string shortcutPath)
{
if (System.IO.File.Exists(shortcutPath))
{
link = (IShellLinkW)new CShellLink();
IPersistFile persistFile = (IPersistFile)link;
persistFile.Load(shortcutPath, 0);
StringBuilder pathBuilder = new StringBuilder(260, 260);
link.GetPath(pathBuilder, pathBuilder.Capacity, default, 0);
return pathBuilder.ToString();
}
else
{
throw new System.IO.FileNotFoundException("Shortcut file not found.", shortcutPath);
}
}
[ComImport]
[Guid("000214F9-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface IShellLinkW
{
void GetPath(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
int cchMaxPath,
ref _WIN32_FIND_DATAW pfd,
uint fFlags);
void GetIDList(out IntPtr ppidl);
void SetIDList(IntPtr pidl);
void GetDescription(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile,
int cchMaxName);
void SetDescription(
[MarshalAs(UnmanagedType.LPWStr)] string pszName);
void GetWorkingDirectory(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir,
int cchMaxPath);
void SetWorkingDirectory(
[MarshalAs(UnmanagedType.LPWStr)] string pszDir);
void GetArguments(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs,
int cchMaxPath);
void SetArguments(
[MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
void GetHotkey(out short pwHotkey);
void SetHotkey(short pwHotkey);
void GetShowCmd(out uint piShowCmd);
void SetShowCmd(uint piShowCmd);
void GetIconLocation(
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
int cchIconPath,
out int piIcon);
void SetIconLocation(
[MarshalAs(UnmanagedType.LPWStr)] string pszIconPath,
int iIcon);
void SetRelativePath(
[MarshalAs(UnmanagedType.LPWStr)] string pszPathRel,
uint dwReserved);
void Resolve(
IntPtr hWnd,
uint fFlags);
void SetPath(
[MarshalAs(UnmanagedType.LPWStr)] string pszFile);
}
[ComImport]
[Guid("00021401-0000-0000-C000-000000000046")]
[ClassInterface(ClassInterfaceType.None)]
private class CShellLink { }
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0, CharSet = CharSet.Unicode)]
private struct _WIN32_FIND_DATAW
{
public uint dwFileAttributes;
public _FILETIME ftCreationTime;
public _FILETIME ftLastAccessTime;
public _FILETIME ftLastWriteTime;
public uint nFileSizeHigh;
public uint nFileSizeLow;
public uint dwReserved0;
public uint dwReserved1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string cFileName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string cAlternateFileName;
}
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 0)]
private struct _FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[ComImport]
[Guid("0000010B-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface IPersistFile
{
[PreserveSig]
int GetClassID(out Guid pClassID);
[PreserveSig]
int IsDirty();
void Load(
[MarshalAs(UnmanagedType.LPWStr)] string pszFileName,
uint dwMode);
void Save(
[MarshalAs(UnmanagedType.LPWStr)] string pszFileName,
[MarshalAs(UnmanagedType.Bool)] bool fRemember);
void SaveCompleted(
[MarshalAs(UnmanagedType.LPWStr)] string pszFileName);
void GetCurFile(
[MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName);
}
}
@ארי
לפני שמישהו ימליץ מה ואיפה, אולי כדאי שתפרט קצת יותר.
זה תחביב? יש לך מטרה מסויימת? לאן אתה שואף להגיע? כמה זמן אתה מוכן להשקיע בזה? ומהו תחום העניין שלך (עלול להשליך על איזה שפה כדאי לך ללמוד)? אלו שאלות שאתה צריך גם לענות לעצמך.
ועוד שאלה רבת השלכות: האם אתה שולט באנגלית וכמה?
ועוד הערה קטנה - מכיון שאתה רוצה להתקדם הלאה, זה נכון שקל יותר ללמוד מתוך עשייה אבל - יש הבדל גדול בין תכנות באקסס ו-vba לתכנות מלא, וצריך ללמוד את זה. זה לא רק נושא של ידיעות, צריך גם ללמוד איך לתכנת.
בהצלחה רבה
קוד C# להמרת מספר למספר עברי - מקווה שיהיה שימושי למישהו.
using System;
public class ClassHebrewNumbering
{
public static string ToHebrewNumber(int number)
{
if (number < 1)
{
throw new ArgumentOutOfRangeException("המספר צריך להיות מעל 1");
}
string hebrewNumber = "";
while (number >= 400)
{
hebrewNumber += "ת";
number -= 400;
}
// Handle numbers 100-390
if (number >= 300)
{
hebrewNumber += "ש";
number -= 300;
}
else if (number >= 200)
{
hebrewNumber += "ר";
number -= 200;
}
else if (number >= 100)
{
hebrewNumber += "ק";
number -= 100;
}
// Handle numbers 10-90
if (number >= 10)
{
int tensIndex = (number / 10) - 1; // Subtract 1 to match array indexing
hebrewNumber += Tens[tensIndex];
number -= (tensIndex + 1) * 10; // Add 1 back for indexing
}
// Handle numbers 1-9
if (number > 0)
{
hebrewNumber += Units[number - 1]; // Subtract 1 to match array indexing
}
hebrewNumber = hebrewNumber.Replace("יה", "טו");
hebrewNumber = hebrewNumber.Replace("יו", "טז");
//hebrewNumber.Replace("רעב", "ערב");
//hebrewNumber.Replace("רעד", "עדר");
//hebrewNumber.Replace("רע", "ער");
//hebrewNumber.Replace("רצח", "רחצ");
//hebrewNumber.Replace("תשמד", "תדשם");
//hebrewNumber.Replace("שמד", "שדמ");
//hebrewNumber.Replace("שד", "דש");
return hebrewNumber;
}
private static readonly string[] Units =
{
"א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט"
};
private static readonly string[] Tens =
{
"י", "כ", "ל", "מ", "נ", "ס", "ע", "פ", "צ", "ק"
};
}
@שואף-לדעת
הוראות לשימוש בשדה SEQ דרך רצועת הכלים ב-Word:
SEQ דוגמה
לחץ על "אישור" (OK).
הוספת שדות SEQ נוספים:
חזור על שלב 1 עבור כל מקום בו אתה רוצה להוסיף את השדה SEQ, והשתמש באותו שם רצף ("דוגמה" הינו שם הרצף שהתמשנו בו במדריך זה אתה יכול גם לבחור שם רצף אחר).
אם אתה מעונין במשהו קצת יותר מתקדם עיין כאן
https://www.techrepublic.com/article/10-steps-to-creating-inline-numbering-in-a-word-document/
הכתבה באנגלית אבל תוכל הלריץ על זה תרגום דפדפן די בקלות
@י.פל. כתב בלמה צריך עדיין מתכנתים:
אנחנו לא יודעים לארוג. אנחנו צריכים תמונות של 'בית הכוסות'. חלק נרחב מהנשים לא יודעות לאפות חלות. יש כאלו שלא יודעים להחזיק עט... רוב משתמשי האינטרנט כותבים עם שגיאות כתיב מחרידות.
ולכן?
זה רע?
רע בעצם לא
רע באופן אישי כן - או לא. תלוי במקרה. בן אדם צריך להיות מודע לעצמו ולמה הוא עושה. זה כל מה שבאתי לומר. ההבדל בים מכונת כביסה לתיכנות על ידי AI רחוק מזרח ממערב. מכונת כביסה הוא שימוש טכני - נדיר הוא האדם שמסתכל על תכנות ב-AI כמו על מכונת כביסה. ויעידו הכורתות והפוסטים למיניהם תוכנה ש"יצרתי" כו'. כשהיצירה האנושית נהפכית להיות טכנית היא נהפכת להיות צל של עצמה. זה לא נכון בכל מקרה וזה לא כלל גורף אבל יש בזה נקודה למחשבה עבור כל אח באשר הוא.