When I start a session I can set the pagesize and linesize with the corresponding set command + desired value. How can I make it so that this value sticks upon launch of a new session?
Open glogin.sql with notepad and add the following lines at the bottom: (including --- without "quotes") then save.
SET LINESIZE 200
SET PAGESIZE 1000
"---"
Related
I'm use Visual Basic 6 to create a table with many Textbox which named txtNo1, txtNo2, txtNo3,...
I want to use the "For...Next..." loop to assign a content to these Textbox.
How can I call all these Textbox in the simplest way?
For i = 1 to 100
txtNo (......) .txt = "ABC"
Next i
Instead of using unique textboxes, each with a unique name, you should use a (textbox) control array:
Place the 1st textbox on the form, name it 'txtNo'
Copy it and paste it onto the form
VB will ask you "There's already a control named 'txtNo'. Would you like to create a control array?". Answer "Yes"
Paste as the textbox as many times as you need it
Then your code looks like
' Control arrays typically start at index 0
For i = 0 to 100
txtNo(i) .txt = "ABC"
Next i
Jim Mack's solution works as well, code for it:
' Assuming your form is named 'Form1'
For each ctrl in Form1.Controls
If TypeOf ctrl Is Textbox
For i = 1 To 100
If ctrl.Name = "txtNo" & CStr(i) Then
ctrl.Text = "ABC"
End If
End If
End If
It's a bit more complex, but therefore more flexible as works with multiple control types (in one loop).
If you need an easiest way to create your textboxes as a table, you can Load the controls at runtime. You have to add only the first TextBox control to your form, set the name to "txtNo", and Index to 0 in the Properties window.
In your code, call Load() to create additional controls, and you can set the Top/Left and other properties
For i = 1 To 100
Load txtNo(i)
txtNo(i).Top = txtNo(i - 1).Top + txtNo(i - 1).Height + 150
txtNo(i).Left = txtNo(i - 1).Left
txtNo(i).Text = "Textbox " & i
txtNo(i).Visible = True
Next i
If you need again to change any control property, from your list of controls, you can iterate only over your control list, instead of all controls of your Form
For i = txtNo.LBound() To txtNo.UBound()
Form1.Controls("txtNo")(i).Text = "New text " & i
Next i
I'm trying to create an AppleScript that creates hyperlinks on every linked image in InDesign.
This is what I have come up with so far.
tell application "Adobe InDesign CC 2017"
activate
tell active document
set grphicBoxs to all graphics of layer activeLayer
set myLinks to {}
repeat with I in grphicBoxs
set iLink to item link of i
set end of myLinks to iLink
end repeat
repeat with theLinkRef in myLinks
set theLinkName to ((name of theLinkRef) as string)
display dialog "theLinkName: " & theLinkName
set myHyperLink to "www.myURL"
set myHyperLinkName to "myURL name"
try
set hyperLinkPreSet to make hyperlink URL destination with properties `{name:myHyperLinkName, destination URL:myHyperLink}`
on error
set hyperLinkPreSet to hyperlink URL destination myHyperLinkName
end try
try
set hyperLinkObject to make hyperlink page item source with properties `{name:myHyperLinkName, source page item:rectangle theLinkName, hidden:false}`
on error
set TheHS to hyperlink page item source myHyperLinkName
end try
display dialog "hyperLinkObject:" & hyperLinkObject
make new hyperlink with properties `{destination:myHyperLink, source:hyperLinkObject, visible:false}`
end repeat
end tell
end tell
The expected result is that the hyperlink preset that is created is applied to the chosen object. But I get this error message.
Invalid value for parameter 'source' of method 'make'. Expected page
item, but received nothing.
Is there anyone here who has successfully created hyperlinks on linked objects who can help me?
Problem solved
set activeLayer to "Layer 1"
set counter to 1
tell application "Adobe InDesign CC 2017"
activate
tell active document
set grphicBoxs to all graphics of layer activeLayer
set myLinks to {}
repeat with i in grphicBoxs
set iLink to item link of i
set end of myLinks to iLink
end repeat
repeat with theLinkRef in myLinks
set theLinkName to ((name of theLinkRef) as string)
set theLinkNameNoext to text 1 thru ((offset of "." in theLinkName) - 1) of theLinkName
set myHyperLink to "http://macscripter.net"
set myHyperLinkName to theLinkNameNoext & " " & counter
make hyperlink with properties {name:myHyperLinkName, source:make hyperlink page item source with properties {source page item:rectangle counter}, destination:make hyperlink URL destination with properties {destination URL:myHyperLink}}
set counter to counter + 1
end repeat
end tell
end tell
It seems not as easy as i thought it should be.
My Script fetches Link URL's from websites
As of now, the resulting URL's are just text and i need them to be put out as URL's (clipboard or variable) to paste them into an email message
I have tried various things from saving first to a rtf file and reading/pasting it to my email message body or copy and paste trough the clipboard.
Any help would be awesome as i can't get this solved since 2 days. Thanks
--prompt for keyword
display dialog "Keyword or Sentence" default answer "mad dog" buttons {"Done"} default button 1
set Keyword to text returned of the result
--create URL filter from Keyword
set my text item delimiters to " "
delay 0.2
set split_list to every text item of Keyword -- split in to list of everything between the spaces
set my text item delimiters to "-"
set Filter to (split_list as text) -- join, using the - as the delimter
--Open Pages
set site_url to "https://teespring.com/search?q=" & Keyword
tell application "Safari"
activate
open location site_url
end tell
-- wait until page loaded
property testingString : "Help" --Text on website to look for
set pageLoaded to false
tell application "Safari"
repeat while pageLoaded is false
set readyState to (do JavaScript "document.readyState" in document 1)
set pageText to text of document 1
if (readyState is "complete") and (pageText contains testingString) then set pageLoaded to true
delay 0.2
end repeat
end tell
-- get number of links
set theLinks to {}
tell application "Safari" to set num_links to (do JavaScript "document.links.length" in document 1)
set linkCounter to num_links - 1
-- retrieve the links
repeat with i from 0 to linkCounter
tell application "Safari" to set end of theLinks to do JavaScript "document.links[" & i & "].href" in document 1
end repeat
theLinks
set nonExcludedURLs to {}
--Filter URLs
repeat with i from 1 to length of theLinks
if item i of theLinks contains Filter then
set end of nonExcludedURLs to item i of theLinks
end if
end repeat
nonExcludedURLs
on page_loaded(timeout_value)
delay 2
repeat with i from 1 to the timeout_value
tell application "Safari"
if (do JavaScript "document.readyState" in document 1) is "complete" then
set nonExcludedURLs to {}
return true
else if i is the timeout_value then
return false
else
delay 1
end if
end tell
end repeat
return false
end page_loaded
Found the solution. Maybe i described the problem not very well.
I just needed to split the resulting url's from a block of text to single lines with the following code:
set Single_URLs to ""
repeat with this_line in nonExcludedURLs -- the URL's as block of text
set Single_URLs to Single_URLs & this_line & return --split into lines
end repeat
I have project with win auth and i use "securityTrimmingEnabled" option for detect to which parts of menu user have access.
I set site map node properties:
siteMapNode.ParentNode.Title = entity.Parent.Title;
siteMapNode.ParentNode.RouteValues["id"] = entity.Parent.Id;
And if "securityTrimmingEnabled" is false, everything is ok and i have correct url in map path(/portfolios/facility/57), if "securityTrimmingEnabled" is true, title of node is ok, but "id" param is not correct(/portfolios/facility/0)
How i can resolve this issue?
This is basically the same issue described here.
The AuthorizeAttributeAclModule is accessing the Url property and causing it to be request cached, so setting properties that affect the URL afterward (such as in a controller action) has no effect.
Option 1
Move the code that sets the RouteValues["id"] into a IDynamicNodeProvider implemenation. This will load the values into the shared cache at application startup (and when the cache expires), but it also loads them before the AuthorizeAttributeAclModule fires.
Option 2
Move the code that sets the values into the Application_BeginRequest event as described here.
Option 3
Create a custom implementation of RequestCacheableSiteMapNode that doesn't override the Url property and a custom SiteMapNodeFactory to provide instances of your new class, then inject them both with DI.
Option 4
Remove the request cache value for the Url property manually, so it can be regenerated the next time the Url property is accessed.
var parentNode = siteMapNode.ParentNode;
parentNode.Title = entity.Parent.Title;
parentNode.RouteValues["id"] = entity.Parent.Id;
var urlRequestCacheKey = "__MVCSITEMAPNODE_" + parentNode.SiteMap.CacheKey + "_" + parentNode.Key + "_Url_True_";
this.HttpContext.Items.Remove(urlRequestCacheKey);
I have a Windows Form Multiline Textbox.
I want to use Shift+Enter Instead of using Enter key to make a new line in textbox, and the traditional Enter key will be used to focus on the next control.
I mean Shift+Enter will work exactly like Enter key on normal multiline textbox (Regard to textbox maxlength --> So you cant enter newline, or current selected text will be delete when you insert newline,...)
I've tried to override OnKeyDown, to insert newline on Shift+Enter, but it doesn't work as I expected.
you'll need to override OnKeyDown and check for enter key using the KeyDownEvent's KeyCode property.
If enter was pressed and the keydownevent's modifiers property does not equal Keys.Shift you'll need to suppress the key press. Here's the documentation on how to do that:
http://msdn.microsoft.com/en-us/library/system.windows.forms.keyeventargs.suppresskeypress(v=vs.110).aspx
If shift+enter was pressed you'll need to insert Environment.NewLine at the cursor position, then move the cursor after the inserted Environment.NewLine. Here's how to do that:
How to paste text in textbox current cursor?
Here is my implementation in VB .NET.
Regard to Maxlength of the textbox and current selected text
Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
If (Me.Multiline AndAlso e.KeyData = (Keys.Shift Or Keys.Enter)) Then
Dim intRemainCharCount As Integer = Me.MaxLength - Me.Text.Length + Me.SelectedText.Length
'' Check if have enough space to place NewLine
If (Environment.NewLine.Length > intRemainCharCount) Then
MyBase.OnKeyDown(e)
Return
End If
Dim intPos = Me.SelectionStart
Me.Paste(Environment.NewLine)
'' Reset selection start (Reset cusor position)
Me.SelectionStart = intPos + Environment.NewLine.Length
e.Handled = True
e.SuppressKeyPress = True
Return
End If
MyBase.OnKeyDown(e)
End Sub
Change the property for Accept Return for the Multiline doesn't even require coding anything, unless you have an event listening to the KeyDown, in which case you can put a condition to check if the Textbox is focussed.